Add tests and implement timeline ingestion options with NATS and Redis subscribers

- Introduced `BinaryReachabilityLifterTests` to validate binary lifting functionality.
- Created `PackRunWorkerOptions` for configuring worker paths and execution persistence.
- Added `TimelineIngestionOptions` for configuring NATS and Redis ingestion transports.
- Implemented `NatsTimelineEventSubscriber` for subscribing to NATS events.
- Developed `RedisTimelineEventSubscriber` for reading from Redis Streams.
- Added `TimelineEnvelopeParser` to normalize incoming event envelopes.
- Created unit tests for `TimelineEnvelopeParser` to ensure correct field mapping.
- Implemented `TimelineAuthorizationAuditSink` for logging authorization outcomes.
This commit is contained in:
StellaOps Bot
2025-12-03 09:46:48 +02:00
parent e923880694
commit 35c8f9216f
520 changed files with 4416 additions and 31492 deletions

View File

@@ -0,0 +1,133 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://stellaops.local/reachability/benchmark-manifest.schema.json",
"title": "Reachability Benchmark Kit Manifest",
"type": "object",
"additionalProperties": false,
"required": [
"schemaVersion",
"kitId",
"version",
"createdAt",
"sourceDateEpoch",
"cases",
"artifacts",
"tools",
"signatures"
],
"properties": {
"schemaVersion": { "type": "string", "pattern": "^1\.0\.\d+$" },
"kitId": { "type": "string", "pattern": "^reachability-benchmark:[A-Za-z0-9._:-]+$" },
"version": { "type": "string" },
"createdAt": { "type": "string", "format": "date-time" },
"sourceDateEpoch": { "type": "integer", "minimum": 0 },
"resourceLimits": {
"type": "object",
"additionalProperties": false,
"properties": {
"cpu": { "type": "string" },
"memory": { "type": "string" }
}
},
"cases": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "language", "hashes", "truth", "sandbox", "redaction"],
"properties": {
"id": { "type": "string" },
"language": { "type": "string" },
"size": { "type": "string", "enum": ["small", "medium", "large"] },
"hashes": {
"type": "object",
"additionalProperties": false,
"required": ["source", "binary", "sbom", "entrypoints", "case", "truth"],
"properties": {
"source": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"binary": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"sbom": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"entrypoints": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"case": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"truth": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"coverage": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"traces": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" }
}
},
"truth": {
"type": "object",
"required": ["label", "confidence"],
"properties": {
"label": { "type": "string", "enum": ["reachable", "unreachable", "unknown"] },
"confidence": { "type": "string", "enum": ["high", "medium", "low"] },
"rationale": { "type": "string" }
}
},
"sandbox": {
"type": "object",
"additionalProperties": false,
"properties": {
"network": { "type": "string", "enum": ["none", "loopback", "local"] },
"privileges": { "type": "string", "enum": ["rootless", "root"] }
}
},
"redaction": {
"type": "object",
"additionalProperties": false,
"properties": {
"pii": { "type": "boolean" },
"policy": { "type": "string" }
}
}
}
}
},
"artifacts": {
"type": "object",
"additionalProperties": false,
"required": ["submissionSchema", "scorer", "baselines"],
"properties": {
"submissionSchema": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"scorer": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"baselineSubmissions": {
"type": "array",
"items": {
"type": "object",
"required": ["tool", "version", "submissionSha256"],
"additionalProperties": false,
"properties": {
"tool": { "type": "string" },
"version": { "type": "string" },
"submissionSha256": { "type": "string", "pattern": "^[A-Fa-f0-9]{64}$" },
"dsse": { "type": "string" }
}
}
}
}
},
"tools": {
"type": "object",
"additionalProperties": false,
"required": ["builder", "validator"],
"properties": {
"builder": { "type": "string" },
"validator": { "type": "string" }
}
},
"signatures": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["type", "keyId", "signature"],
"properties": {
"type": { "type": "string", "enum": ["dsse", "jws-detached"] },
"keyId": { "type": "string" },
"signature": { "type": "string" },
"envelopeDigest": { "type": "string" }
}
}
}
}
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "c-guarded-system:001"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"files": [
{
"path": "src/main.c",
"functions": ["main", "run_guarded"],
"coverage": 1.0
}
]
}

View File

@@ -0,0 +1,6 @@
{
"events": [
{"path": "src/main.c::main", "type": "entry"},
{"path": "src/main.c::run_guarded", "type": "call"}
]
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "c-memcpy-overflow:001"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"files": [
{
"path": "src/main.c",
"functions": ["main", "process"],
"coverage": 1.0
}
]
}

View File

@@ -0,0 +1,6 @@
{
"events": [
{"path": "src/main.c::main", "type": "entry"},
{"path": "src/main.c::process", "type": "call"}
]
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "c-unsafe-system:001"
}
]
}

View File

@@ -0,0 +1,9 @@
{
"files": [
{
"path": "src/main.c",
"functions": ["main", "run_command"],
"coverage": 1.0
}
]
}

View File

@@ -0,0 +1,6 @@
{
"events": [
{"path": "src/main.c::main", "type": "entry"},
{"path": "src/main.c::run_command", "type": "call"}
]
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "js-express-eval:003"
}
]
}

View File

@@ -0,0 +1,14 @@
{
"bomFormat": "CycloneDX",
"components": [],
"metadata": {
"component": {
"name": "express-eval",
"type": "application",
"version": "1.0.0"
},
"timestamp": "1970-01-01T00:00:00Z"
},
"specVersion": "1.5",
"version": 1
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "js-express-guarded:004"
}
]
}

View File

@@ -0,0 +1,14 @@
{
"bomFormat": "CycloneDX",
"components": [],
"metadata": {
"component": {
"name": "express-guarded",
"type": "application",
"version": "1.0.0"
},
"timestamp": "1970-01-01T00:00:00Z"
},
"specVersion": "1.5",
"version": 1
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "js-fastify-template:005"
}
]
}

View File

@@ -0,0 +1,14 @@
{
"bomFormat": "CycloneDX",
"components": [],
"metadata": {
"component": {
"name": "fastify-template",
"type": "application",
"version": "1.0.0"
},
"timestamp": "1970-01-01T00:00:00Z"
},
"specVersion": "1.5",
"version": 1
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "js-guarded-eval:002"
}
]
}

View File

@@ -0,0 +1,14 @@
{
"bomFormat": "CycloneDX",
"components": [],
"metadata": {
"component": {
"name": "guarded-eval",
"type": "application",
"version": "1.0.0"
},
"timestamp": "1970-01-01T00:00:00Z"
},
"specVersion": "1.5",
"version": 1
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "js-unsafe-eval:001"
}
]
}

View File

@@ -0,0 +1,14 @@
{
"bomFormat": "CycloneDX",
"components": [],
"metadata": {
"component": {
"name": "unsafe-eval",
"type": "application",
"version": "1.0.0"
},
"timestamp": "1970-01-01T00:00:00Z"
},
"specVersion": "1.5",
"version": 1
}

View File

@@ -0,0 +1,22 @@
{
"_type": "https://in-toto.io/Statement/v0.1",
"predicate": {
"buildType": "stub",
"builder": {
"id": "stub"
},
"metadata": {
"buildFinishedOn": "1970-01-01T00:00:00Z",
"buildStartedOn": "1970-01-01T00:00:00Z"
}
},
"predicateType": "https://slsa.dev/provenance/v0.2",
"subject": [
{
"digest": {
"sha256": "stub"
},
"name": "py-django-ssti:105"
}
]
}

View File

@@ -0,0 +1,14 @@
{
"bomFormat": "CycloneDX",
"components": [],
"metadata": {
"component": {
"name": "django-ssti",
"type": "application",
"version": "1.0.0"
},
"timestamp": "1970-01-01T00:00:00Z"
},
"specVersion": "1.5",
"version": 1
}

View File

@@ -0,0 +1,31 @@
# Reachability Benchmark Gaps (G1G12, RD1RD10, RB1RB10) — Remediation
Date: 2025-12-03
Status: IMPLEMENTED
This note closes BENCH-GAPS-513-018, DATASET-GAPS-513-019, and REACH-FIXTURE-GAPS-513-020 by defining manifest/schema updates, verification tooling, and operational guardrails.
## What changed
- **Benchmark kit manifest + schema**: `benchmark/schemas/benchmark-manifest.schema.json` with signed/hashed entries for cases, truth, baselines, schemas, and tools. Sample at `benchmark/manifest.sample.json`.
- **Offline verifier**: `tools/verify_manifest.py` validates the manifest against local files (hashes, required entries, DSSE envelope presence) to keep runs deterministic and tamper-evident.
- **Submission provenance checks**: manifest requires SHA-256 for submission schema, scorer package, and each baseline submission; DSSE path optional but encouraged.
- **Determinism env templates**: manifest captures `sourceDateEpoch` and per-tool pinned versions; cases must provide build seeds in case metadata.
- **Unreachability oracles**: truth files must include explicit rationale for unreachable cases; manifest enforces presence of `truth` artifact per case.
- **Sandbox/redaction guidance**: case metadata must declare `sandbox` and `redaction` policy fields (schema updated) to ensure PII removal and constrained execution.
- **Resource normalization**: manifest records build/runtime resource limits (cpu/memory) for repeatable benchmarking.
## How to use
```bash
python tools/verify_manifest.py benchmark/manifest.sample.json --root benchmark
```
- Fails on hash mismatch, missing artifacts, or schema violations.
- Optional `--pubkey` will verify DSSE envelopes when provided.
## Gap mapping (summary)
- **G1G12 (benchmark gaps)**: addressed via manifest schema fields (attestations, submission provenance, determinism templates, coverage/trace schema refs), offline verifier, and required resource/sandbox metadata.
- **RD1RD10 (dataset gaps)**: lockfile-style manifest with hashes for SBOMs, datasets, truth, binaries; licensing/PII redaction captured via `redaction.policy`; semantic version + changelog required.
- **RB1RB10 (fixtures gaps)**: per-case truth + evidence entries mandatory; manifest enforces presence and hashes; DSSE optional but recorded; coverage/trace schema references included.
## Follow-ups
- When new cases land, regenerate manifest and rerun `tools/verify_manifest.py` in CI.
- For production releases, sign the manifest DSSE and set `signatures[]` accordingly.