10 KiB
10 KiB
AGENTS · Scanner Module
Roles
- Backend / Analyzer Engineer: .NET 10 (preview) for analyzers, worker, web service, plug-ins; keep outputs deterministic.
- QA / Bench Engineer: Adds golden fixtures, regression tests, and perf/determinism benchmarks under
__Tests/__Benchmarks. - Docs Touches (light): Update module docs under
src/Scanner/docswhen behavior/contracts change; mirror in sprint notes.
Required Reading
docs/README.mddocs/07_HIGH_LEVEL_ARCHITECTURE.mddocs/modules/platform/architecture-overview.mddocs/modules/scanner/architecture.mddocs/reachability/DELIVERY_GUIDE.md(sections 5.5–5.9 for native/JS/PHP updates)docs/reachability/purl-resolved-edges.mddocs/reachability/patch-oracles.mddocs/product-advisories/14-Dec-2025 - Smart-Diff Technical Reference.md(for Smart-Diff predicates)- Current sprint file (e.g.,
docs/implplan/SPRINT_401_reachability_evidence_chain.md).
Working Directory & Boundaries
- Primary scope:
src/Scanner/**(analyzers, worker, web service, plugins, __Libraries, __Tests, __Benchmarks, docs). - Avoid cross-module edits unless sprint explicitly permits; note any cross-module change in sprint tracker.
- Keep fixtures minimal/deterministic; store under
src/Scanner/__Tests/Fixturesor__Benchmarks.
Smart-Diff Contracts (Sprint 3500)
The Scanner module now includes Smart-Diff foundation primitives:
Libraries
StellaOps.Scanner.SmartDiff- Core Smart-Diff predicate models and serializationStellaOps.Scanner.Reachability- Reachability gate computation with 3-bit class
Key Types
SmartDiffPredicate- Attestation predicate for differential scansReachabilityGate- 3-bit class (0-7) indicating entry/sink reachabilitySinkCategory- Taxonomy of sensitive sinks (file, network, crypto, etc.)SinkRegistry- Registry of known sinks with category mappings
Predicate Schema
- URI:
stellaops.dev/predicates/smart-diff@v1 - Schema:
docs/schemas/stellaops-smart-diff.v1.schema.json - DSSE-signed predicates for evidence chain
Integration Points
- Integrates with
StellaOps.Policy.Suppressionfor pre-filter rules - Emits to Attestor module for DSSE envelope wrapping
- Consumed by Findings Ledger for triage decisions
Reachability Drift (Sprint 3600)
Reachability Drift Detection tracks function-level reachability changes between scans:
Libraries
StellaOps.Scanner.ReachabilityDrift- Drift detection engine, API models, attestationStellaOps.Scanner.CallGraph- Language-specific call graph extractorsStellaOps.Scanner.VulnSurfaces- Vulnerability surface computation (trigger methods)
Key Types
ReachabilityDriftResult- Drift analysis output (newly reachable, mitigated paths)DriftedSink- Sink that changed reachability state with cause attributionDriftCause- Causal explanation (guard removed, new route, code change)CompressedPath- Compact path representation (entrypoint → key nodes → sink)ReachabilityConfidenceTier- Confirmed/Likely/Present/Unreachable tiers
Predicate Schema
- URI:
stellaops.dev/predicates/reachability-drift@v1 - DSSE-signed attestations for drift evidence chain
Call Graph Extractors (Sprint 20251226-005)
All language-specific call graph extractors are now registered in CallGraphExtractorRegistry via DI:
| Language | Extractor | Analysis Method | Key Sinks Detected |
|---|---|---|---|
| .NET | DotNetCallGraphExtractor |
Roslyn semantic analysis | SQL injection, deserialization, command execution |
| Java | JavaCallGraphExtractor |
ASM bytecode parsing | SQL, LDAP, XXE, deserialization, SSRF, template injection |
| Node.js | NodeCallGraphExtractor |
Babel AST / stella-callgraph-node tool | eval, child_process, fs, SQL templates |
| Python | PythonCallGraphExtractor |
Python AST analysis | subprocess, pickle, eval, SQL string formatting |
| Go | GoCallGraphExtractor |
SSA analysis via external tool | os/exec, database/sql, net/http |
Registry Usage:
// Inject the registry
ICallGraphExtractorRegistry registry;
// Get extractor by language
var extractor = registry.GetExtractor("java");
if (extractor is not null)
{
var request = new CallGraphExtractionRequest(scanId, "java", "/path/to/target");
var snapshot = await extractor.ExtractAsync(request, cancellationToken);
}
// Check if language is supported
if (registry.IsLanguageSupported("python"))
{
// ...
}
DI Registration:
services.AddCallGraphServices(configuration);
Entrypoint Detection
- ASP.NET Core:
[HttpGet],[Route], minimal APIs - Express/Fastify: route handlers
- Background:
IHostedService,BackgroundService - CLI:
Main, command handlers
Drift API Endpoints
GET /api/v1/scans/{scanId}/drift- Get or compute drift between two scansGET /api/v1/drift/{driftId}/sinks- Page drifted sinksPOST /api/v1/scans/{scanId}/compute-reachability- Trigger reachability computationGET /api/v1/scans/{scanId}/reachability/components- List component reachabilityGET /api/v1/scans/{scanId}/reachability/findings- List reachability findingsGET /api/v1/scans/{scanId}/reachability/explain- Explain reachability for CVE + PURL
Drift Documentation
docs/modules/scanner/reachability-drift.mddocs/api/scanner-drift-api.mddocs/operations/reachability-drift-guide.md
Testing
- Unit tests:
src/Scanner/__Tests/StellaOps.Scanner.ReachabilityDrift.Tests/ - Benchmark cases:
bench/reachability-benchmark/ - Golden fixtures: deterministic path compression, DSSE output
Vulnerability Surfaces (Sprint 3700)
Compute vulnerability surfaces by diffing vulnerable vs fixed package versions:
Libraries
StellaOps.Scanner.VulnSurfaces- Surface builder, method fingerprinting, trigger extraction
Key Types
VulnSurface- Computed surface with sink methods and triggersVulnSurfaceSink- Method that changed in security fixVulnSurfaceTrigger- Public API that can reach sinkMethodFingerprint- Stable method identity across versions
Per-Ecosystem Support
- NuGet: Cecil IL fingerprinting
- npm: Babel AST fingerprinting
- Maven: ASM bytecode fingerprinting
- PyPI: Python AST fingerprinting
Integration with Reachability
ISurfaceQueryService- Query triggers for CVE during scan- Confidence tiers: Confirmed (trigger reachable) > Likely (API reachable) > Present (dep only)
- Path witnesses include surface evidence for audit trail
Binary + Call-Stack Reachability (Sprint 3800 Series)
Layered binary reachability with attestable slices for CVE triage:
Sprint Summary
- 3800: Binary call-edge enhancement (disassembly, PLT/IAT, dynamic loading)
- 3810: CVE→Symbol mapping and slice format
- 3820: Slice query and replay APIs
- 3830: VEX integration and policy binding
- 3840: Runtime trace merge (eBPF/ETW)
- 3850: OCI storage and CLI commands
See: docs/implplan/SPRINT_3800_0000_0000_summary.md
Libraries
StellaOps.Scanner.Reachability.Slices- Slice extraction, DSSE signing, verdict computationStellaOps.Scanner.Advisory- CVE→symbol mapping integration with ConcelierStellaOps.Scanner.Runtime- eBPF/ETW runtime trace collectorsStellaOps.Scanner.Storage.Oci- OCI artifact storage for slices
Key Types
ReachabilitySlice- Minimal attestable proof unit for CVE reachabilitySliceQuery- Query parameters (CVE, symbols, entrypoints, policy)SliceVerdict- Result status (reachable/unreachable/unknown/gated)VulnSurfaceResult- CVE→symbol mapping result with confidence
Predicate Schema
- URI:
stellaops.dev/predicates/reachability-slice@v1 - Schema:
docs/schemas/stellaops-slice.v1.schema.json - DSSE-signed slices for audit trail
Slice API Endpoints
POST /api/slices/query- Query reachability for CVE/symbolsGET /api/slices/{digest}- Retrieve attested slicePOST /api/slices/replay- Verify slice reproducibility
CLI Commands (Sprint 3850)
stella binary submit- Submit binary graphstella binary info- Display graph infostella binary symbols- List symbolsstella binary verify- Verify attestation
Documentation
docs/reachability/slice-schema.md- Slice format specificationdocs/reachability/cve-symbol-mapping.md- CVE→symbol service designdocs/reachability/replay-verification.md- Replay workflow guide
Engineering Rules
- Target
net10.0; prefer latest C# preview allowed in repo. - Offline-first: no new external network calls; use
.nuget/packages/cache. - Determinism: stable ordering, UTC ISO-8601 timestamps, no
DateTime.Now/random without seed; normalize path separators. - Logging: structured (
ILoggermessage templates); avoid secrets/paths leakage. - Security: no executing untrusted payloads; keep analyzers pure; include redaction guidance for runtime capture adapters.
- Native analyzers: capture
.note.gnu.build-idwhen present and thread intoSymbolID/code_id; add synthetic roots for.preinit_array/.init_array/_init; emit purl+symbol-digest on call edges; emit Unknowns when symbol→purl or edges are unresolved. - Tests: keep patch-oracle fixtures deterministic (strip binaries; stable compilers); add/maintain
tests/reachability/patch-oracles/**when touching native analyzers.
Testing & Verification
- Default:
dotnet test src/Scanner/StellaOps.Scanner.sln. - Add/extend tests in
src/Scanner/__Tests/**; golden outputs should be deterministic (sorted keys, stable ordering). - Benchmarks under
src/Scanner/__Benchmarks/**; document input and expected ceilings in comments. - Cover multi-RID, trimmed/NativeAOT, self-contained vs framework-dependent cases where applicable.
- Smart-Diff: Run schema validation tests (
SmartDiffSchemaValidationTests) for predicate contract changes.
Workflow Expectations
- Mirror task state in sprint tracker (
TODO → DOING → DONE/BLOCKED); note blockers with the specific decision needed. - Keep resolvers/analyzers parametric on environment data (RID, TFM, search paths); avoid host-global state.
- When adding DI/manifest registrations, ensure restart-time and worker compatibility; update module docs if contracts change.