Skip to content

impl(010): rustev-serve increment 1, the service tests and fixtures - #191

Merged
bartekus merged 1 commit into
mainfrom
impl/010-serve-tests
Oct 23, 2026
Merged

bartekus merged 1 commit into
mainfrom
impl/010-serve-tests

Conversation

@bartekus

Copy link
Copy Markdown
Contributor

Split from #186, stacked on the sources PR. The loopback handler and transport tests, committed test certificates and synthetic Sigstore fixtures (with their regeneration script), and the section 5 coverage map. Checks: rustev-serve tests (all pass locally including socket tests), clippy, make gate, couple.

@github-actions

Copy link
Copy Markdown

AI review (findings)

The PR adds integration tests and fixtures for rustev-serve, updates one spec sentence, and commits test TLS certificates and Sigstore fixtures. I reviewed for bugs, security issues, and governance inconsistencies.

Finding 1 — sync #[test] wrapping a Service that almost certainly requires a Tokio runtime

sigstore_signed_plan_registers_offline_and_tampering_is_refused in handlers.rs is declared #[test] (synchronous). Every other test in the same file that calls the shared service() helper — which calls Service::new(…) — is declared #[tokio::test]. Service::new manages an async admission queue, blocking thread pool, sink, and shutdown machinery; it is nearly certain to call tokio::spawn internally. Calling it without an active Tokio runtime will panic at runtime ("no reactor running"). The test name includes "offline" but that describes the cryptographic verification path, not the service lifecycle.

Finding 2 — RSA private keys committed to the repository

tests/fixtures/client-key.pem and tests/fixtures/server-key.pem are 2048-bit RSA private keys committed in plaintext. The README.md documents them as test-only and says the CA key was discarded, but there is no mechanism to verify the CA-key claim, and future tooling (secret scanners, automated deployment scripts) will treat these as real credentials. The CA itself is also committed (ca.pem), meaning any party with the repo can issue arbitrary certificates trusted by the test CA. For a project with a formal governance model and signed-bundle registration, this is a concrete risk surface.

{"head": "f1e945b80582f4b40db9358aa6dddaeb6387400f", "verdict": "findings", "findings": [{"path": "integrations/rustev-serve/tests/handlers.rs", "line": null, "summary": "sigstore_signed_plan_registers_offline_and_tampering_is_refused is declared #[test] (sync) but calls service() which creates a Service that requires a Tokio runtime; all other callers of service() use #[tokio::test], so this test will panic without a runtime."}, {"path": "integrations/rustev-serve/tests/fixtures/client-key.pem", "line": 1, "summary": "RSA private key committed in plaintext; though documented as test-only, secret scanners and deployment tooling treat committed private keys as real credentials, and the CA key-discard claim cannot be verified from repo contents."}, {"path": "integrations/rustev-serve/tests/fixtures/server-key.pem", "line": 1, "summary": "RSA private key committed in plaintext; same concern as client-key.pem."}]}

Subject: 208e2b6...f1e945b, diff digest 28ca80000d3bade4010b89496d14474f7c06df397e7e0316e629bb4c206b1602, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 23, 2026 08:24 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/010-serve-src branch 4 times, most recently from ad08652 to eb37d54 Compare October 23, 2026 08:50
@bartekus
bartekus force-pushed the impl/010-serve-tests branch from f1e945b to d188a03 Compare October 23, 2026 08:51
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Looking at the diff, I'm reviewing: a new rcgen dev-dependency, a TestPki helper that generates TLS material at runtime, new handler and transport tests, a coverage doc, a README update, and a small spec text change.

support/mod.rs — TestPki

  • Directory created with 0o700 (Unix) before writing keys ✓
  • SystemRandom nonce makes the directory name unpredictable ✓
  • Drop removes the temp directory ✓
  • No private keys committed (consistent with updated README and REPO CONTEXT, which lists no .pem files under fixtures) ✓

handlers.rs — individual test cases

  • ed25519_signature_positive_tampered_invalid_and_unknown: uses a fixed seed ([42; 32]) for a throwaway test key. Acceptable for a test; the key material is not committed.
  • standalone_remote_sink_*: binds to 127.0.0.1:0 (loopback + ephemeral port) ✓. The inner JoinSet grows unboundedly but is dropped when the outer task is aborted — acceptable resource lifecycle for test code.
  • http_routes_enforce_group_headers_*: chunked body is "401\r\n{x×1025}\r\n0\r\n\r\n" where 0x401 = 1025, matching the configured limit of 1024 — boundary is correct ✓.
  • stalled_decision_stream_*: buffer of 16, 1 admitted event, 15 step events, 85 drops — arithmetic matches the 100-step definition ✓.

transport.rs

  • configuration_rejects_clear_tcp_bearer_and_unsafe_socket_modes: mode 511 = 0o777 is correctly expected to be rejected as an unsafe socket mode ✓.
  • references_never_read_outside_configured_roots: path traversal cases (../, /, ./) all map to Inaccessible; symlink escape is tested on Unix ✓.

Spec change (specs/010-integrations/spec.md)

  • Previous text promised committed TLS test certificates delivered "in the change after the sources." This PR is that subsequent change; the TLS approach changed from committed files to runtime generation, so "committed test certificates" is correctly dropped from the description. The Sigstore fixtures are already in the base tree (REPO CONTEXT confirms them). The wording update is consistent with what is actually delivered.

Dependency

  • rcgen = { version = "=0.14.10", ... } is dev-only and pinned to an exact version ✓.

No concrete defects found.

{"head": "d188a03e7e9c9e4547bf4be459bb6f8706caaa78", "verdict": "no-findings", "findings": []}

Subject: eb37d54...d188a03, diff digest e441a5e6547d82621a373b7a889db99811e304efaa952e59c3bff90c77de69d9, 1 call(s). An AI comment is not an approval.

Base automatically changed from impl/010-serve-src to main October 23, 2026 09:18
@bartekus
bartekus force-pushed the impl/010-serve-tests branch from d188a03 to 4765355 Compare October 23, 2026 09:19
@bartekus
bartekus enabled auto-merge (squash) October 23, 2026 09:19
@github-actions

Copy link
Copy Markdown

AI review (findings)

Review

Code

integrations/rustev-serve/Cargo.toml / tests/support/mod.rs
The rcgen dev-dependency is exact-pinned (=0.14.10), listed only under [dev-dependencies], and the TestPki helper correctly restricts the temp directory to 0o700 on Unix and uses a cryptographically random nonce for the path. The Drop impl removes the directory on cleanup. No issues here.

tests/handlers.rs
Several tests (ed25519_signature_positive_tampered_invalid_and_unknown, http_routes_enforce_group_headers_declared_and_chunked_body_bounds) create temp directories keyed by std::process::id() and remove them with a bare fs::remove_dir_all at the end, with no RAII guard. A test panic between creation and cleanup leaves the directory behind. This is a minor test-hygiene gap but not a correctness or security defect, given those directories hold only a test public key and a Unix socket.

tests/transport.rs
The standalone_remote_sink_describes_delivers_and_rejects_bad_receipts sink test uses 127.0.0.1:0, a Mutex-backed capture list and a JoinSet to own connection tasks; the abort path is clean. The timeout/conflict/wrong-digest branches all exercise typed refusals. Nothing anomalous.

Spec inconsistency (concrete defect)

specs/010-integrations/spec.md, line 417

The PR edits only the parenthetical in this sentence but leaves the subject unchanged:

tests/transport.rs over loopback, with committed test certificates and Sigstore fixtures under tests/fixtures/ …

At the same time, tests/fixtures/README.md is updated in this PR to state explicitly:

No TLS private keys or certificates are committed.

TLS material has been moved from committed fixture files to runtime generation via TestPki/rcgen. The spec text still asserts "committed test certificates" — a claim that is directly contradicted by the fixture README introduced in the same change.

{"head": "4765355ea02a528e71ef5c37b770cc514e719d66", "verdict": "findings", "findings": [{"path": "specs/010-integrations/spec.md", "line": 417, "summary": "Spec retains 'committed test certificates' but this PR removes all committed TLS certificates, replacing them with rcgen runtime generation; the fixtures README now explicitly says 'No TLS private keys or certificates are committed.'"}]}

Subject: e8c78d1...4765355, diff digest e441a5e6547d82621a373b7a889db99811e304efaa952e59c3bff90c77de69d9, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus had a problem deploying to statecraft-review-exception October 23, 2026 09:21 — with GitHub Actions Error
@bartekus
bartekus force-pushed the impl/010-serve-tests branch from 4765355 to 78eabbd Compare October 23, 2026 09:22
@github-actions

Copy link
Copy Markdown

AI review (no-findings)

Reviewing the diff for bugs, security problems, and inconsistencies.

Dependency and build changes (Cargo.toml, Cargo.lock): rcgen is pinned to an exact version (=0.14.10) with minimal features, appropriate for a dev-dependency generating throwaway test PKI. No issues.

support/mod.rs (TestPki): Uses SystemRandom for the temp directory nonce (16 bytes, cryptographically random), applies 0o700 to the directory on Unix, and removes everything on Drop. Clean.

handlers.rs: The two tests that create temp directories (ed25519_signature_positive_tampered_invalid_and_unknown, http_routes_enforce_group_headers_declared_and_chunked_body_bounds) use PID-based names rather than the randomized nonce approach from TestPki. In a test-only context this is a minor inconsistency (no real security risk) but worth noting the two styles diverge.

transport.rs — references_never_read_outside_configured_roots: Verifies that test:../outside, test:/outside, test:./inside, symlinks, and URL schemes are all Inaccessible. The Unix symlink case is #[cfg(unix)]-guarded. This is the right coverage for a path-confinement boundary.

transport.rs — configuration_rejects_clear_tcp_bearer_and_unsafe_socket_modes: Unix mode 511 is 0o777 in octal — the test correctly verifies that world-writable sockets are rejected.

Chunked body test: "401\r\n{}\r\n0\r\n\r\n" where 0x401 == 1025 sends one byte over the other_body_bytes: 1024 limit — arithmetic is correct.

sigstore_signed_plan_registers_offline_and_tampering_is_refused: Calls sigstore_verify::verify directly before exercising the service path, giving a detailed crypto diagnostic on failure. The tamper cases modify definition.name and an inclusion proof rootHash; both expect BundleTampered / SignatureInvalid respectively. Logic is sound.

Spec change (specs/010-integrations/spec.md): Accurately replaces the description of committed certificates with runtime generation via rcgen. The Sigstore fixtures are already present in the repo (visible in REPO CONTEXT), consistent with the updated wording.

No concrete defects found.

{"head": "78eabbd6ccf1f5f99334b0941be8382e77d6d28c", "verdict": "no-findings", "findings": []}

Subject: e8c78d1...78eabbd, diff digest c47cecd123624d1fb42971afff9847085d6af1c8902013be601b809ada240701, 1 call(s). An AI comment is not an approval.

@bartekus
bartekus merged commit 15214cb into main Oct 23, 2026
31 checks passed
@bartekus
bartekus deleted the impl/010-serve-tests branch October 23, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant