Vuln Surface Contract v1

Schema: stella.ops/vulnSurface@v1 Status: Draft Sprint: SPRINT_3700_0002_0001 (task SURF-024)

Overview

A vulnerability surface captures the specific methods that changed between a vulnerable and a fixed version of a package. By identifying the exact “trigger” methods that are dangerous — rather than treating the whole package as vulnerable — it lets Stella Ops perform precise reachability analysis.

This contract is for engineers working on Scanner surface computation, the reachability call-graph integration, and VEX automation that consumes surfaces.

Use Cases

  1. Noise Reduction - Only flag findings where code actually calls vulnerable methods
  2. Confidence Tiers - “Confirmed reachable” (calls trigger) vs “Potentially reachable” (uses package)
  3. Remediation Guidance - Show developers exactly which API calls to avoid
  4. VEX Precision - Automatically generate VEX “not_affected” for unreachable triggers

Data Model

VulnSurface

Root object representing a computed vulnerability surface.

FieldTypeRequiredDescription
surface_idintegerYesDatabase ID
cve_idstringYesCVE identifier (e.g., “CVE-2024-12345”)
package_idstringYesPackage identifier in PURL format
ecosystemstringYesPackage ecosystem: nuget, npm, maven, pypi
vuln_versionstringYesVulnerable version analyzed
fixed_versionstringYesFirst fixed version used for diff
sinksVulnSurfaceSink[]YesChanged methods (vulnerability triggers)
trigger_countintegerYesNumber of callers to sink methods
statusVulnSurfaceStatusYesComputation status
confidencenumberYesConfidence score (0.0-1.0)
computed_atstringYesISO 8601 timestamp

VulnSurfaceSink

A method that changed between vulnerable and fixed versions.

FieldTypeRequiredDescription
sink_idintegerYesDatabase ID
method_keystringYesFully qualified method signature
method_namestringYesSimple method name
declaring_typestringYesContaining class/module
namespacestringNoNamespace/package
change_typeMethodChangeTypeYesHow the method changed
is_publicbooleanYesWhether method is publicly accessible
parameter_countintegerNoNumber of parameters
return_typestringNoReturn type
source_filestringNoSource file (from debug symbols)
start_lineintegerNoStarting line number
end_lineintegerNoEnding line number

VulnSurfaceTrigger

A call site that invokes a vulnerable sink method.

FieldTypeRequiredDescription
trigger_idintegerYesDatabase ID
sink_idintegerYesReference to sink
scan_idUUIDYesScan where trigger was found
caller_node_idstringYesCall graph node ID
caller_method_keystringYesFQN of calling method
caller_filestringNoSource file of caller
caller_lineintegerNoLine number of call
reachability_bucketstringYesReachability classification
path_lengthintegerNoShortest path from entrypoint
confidencenumberYesConfidence score (0.0-1.0)
call_typestringYesCall type: direct, virtual, interface, reflection
is_conditionalbooleanYesWhether call is behind a condition

Enums

VulnSurfaceStatus

ValueDescription
pendingSurface computation queued
computingCurrently being computed
computedSuccessfully computed
failedComputation failed
staleNeeds recomputation (new version available)

MethodChangeType

ValueDescription
addedMethod added in fix (not in vulnerable version)
removedMethod removed in fix (was in vulnerable version)
modifiedMethod body changed between versions
unknownChange type could not be determined

Reachability Buckets

BucketDescriptionRisk Level
entrypointSink is directly exposed as entrypointCritical
directReachable from entrypoint with no authentication gatesHigh
runtimeReachable but behind runtime conditions/authMedium
unknownReachability could not be determinedMedium
unreachableNo path from any entrypointLow

Fingerprinting Methods

cecil-il (NuGet/.NET)

Uses Mono.Cecil to compute SHA-256 hash of IL instruction sequence:

IL_0000: ldarg.0
IL_0001: call System.Object::.ctor()
IL_0006: ret

Normalized to remove:

babel-ast (npm/Node.js)

Uses Babel to parse JavaScript/TypeScript and compute hash of normalized AST:

function vulnerable(input) {
  eval(input); // dangerous!
}

Normalized to remove:

asm-bytecode (Maven/Java)

Uses ASM to compute hash of Java bytecode:

ALOAD 0
INVOKESPECIAL java/lang/Object.<init>()V
RETURN

Normalized to remove:

python-ast (PyPI)

Uses Python’s ast module to compute hash of normalized AST:

def vulnerable(user_input):
    exec(user_input)  # dangerous!

Normalized to remove:

Database Schema

-- Surfaces table
CREATE TABLE scanner.vuln_surfaces (
    id UUID PRIMARY KEY,
    tenant_id UUID NOT NULL,
    cve_id TEXT NOT NULL,
    package_ecosystem TEXT NOT NULL,
    package_name TEXT NOT NULL,
    vuln_version TEXT NOT NULL,
    fixed_version TEXT,
    fingerprint_method TEXT NOT NULL,
    total_methods_vuln INTEGER,
    total_methods_fixed INTEGER,
    changed_method_count INTEGER,
    computed_at TIMESTAMPTZ DEFAULT now(),
    UNIQUE (tenant_id, cve_id, package_ecosystem, package_name, vuln_version)
);

-- Sinks table
CREATE TABLE scanner.vuln_surface_sinks (
    id UUID PRIMARY KEY,
    surface_id UUID REFERENCES scanner.vuln_surfaces(id) ON DELETE CASCADE,
    method_key TEXT NOT NULL,
    method_name TEXT NOT NULL,
    declaring_type TEXT NOT NULL,
    change_type TEXT NOT NULL,
    UNIQUE (surface_id, method_key)
);

-- Triggers table
CREATE TABLE scanner.vuln_surface_triggers (
    id UUID PRIMARY KEY,
    sink_id UUID REFERENCES scanner.vuln_surface_sinks(id) ON DELETE CASCADE,
    scan_id UUID NOT NULL,
    caller_node_id TEXT NOT NULL,
    reachability_bucket TEXT NOT NULL,
    confidence REAL NOT NULL,
    UNIQUE (sink_id, scan_id, caller_node_id)
);

API Endpoints

POST /api/v1/surfaces/compute

Request surface computation for a CVE + package.

Request:

{
  "cveId": "CVE-2024-12345",
  "ecosystem": "nuget",
  "packageName": "Newtonsoft.Json",
  "vulnVersion": "13.0.1",
  "fixedVersion": "13.0.2"
}

Response:

{
  "surfaceId": "uuid",
  "status": "pending"
}

GET /api/v1/surfaces/{surfaceId}

Get computed surface with sinks.

GET /api/v1/surfaces/{surfaceId}/triggers?scanId={scanId}

Get triggers for a surface in a specific scan.

Integration Points

  1. Concelier - Feeds CVE + affected version ranges
  2. Scanner - Computes surfaces during SBOM analysis
  3. Call Graph - Provides reachability analysis
  4. VEX Lens - Uses surfaces for automated VEX decisions
  5. UI - Displays surface details and trigger paths

References