Add a test that an enrollment token cannot read a fenced key

Merged
IC
1d ago
+107-0

Approved issue: none. This pull request changes tests only. If it fits, please label it trivial, as CONTRIBUTING.md allows when there is no design to agree.

What changes

This adds one test, tests::connectors_contract::an_enrollment_token_does_not_reach_a_fenced_key, in crates/credentials-module/src/connectors_tests.rs. It pins the enrolled arm of the transfer-key fence in the scoped read decision (read_surface.rs:3947). An enrollment token with a category grant must get not_found for a fenced key. First, the same token reads an ordinary key in the same category, so the test cannot pass because the token was dropped. No production code changes.

How it was checked

I made 55 small changes to the scoped read decision and the store functions that it calls, one at a time, and ran both full suites (credentials-core and credentials-module) for each change. Existing tests catch 47 of them, and 6 do not change the answer. This test catches one of the remaining two: with the enrolled fence removed, the request gets past the fence and fails later with kind_not_gettable instead of not_found. I can attach the list of the 55 changes if it helps the review.

On the head of this branch (master 7a1be58d plus this commit), on Linux:

  • cargo fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings pass.
  • The new test passes. With the enrolled fence removed, it fails at its assertion.
  • cargo test -p credentials-module --all-features --no-fail-fast: 1951 passed, 1 failed. The failure is shipped_binary_probe_requires_the_gate_export_and_distinguishes_the_seam_binary (tests/import_picker.rs:321). It needs a shipped binary that our runner does not have, and it fails the same way on the clean base f4313a9f.
  • In one earlier run, vault_access_approval_samples_regenerate_byte_for_byte failed with "signal did not arrive within the wall-clock hang guard". It passed in the next full run.
  • This pull request does not change credentials-core. Its run had one failure only, the engine_tests.rs:1188 test from #88.

AI helped write this draft.


Summary by cubic

Adds a test that pins the enrolled arm of the transfer-key fence in the scoped read decision, so an enrollment token with a category grant gets not_found for a fenced key. The test first confirms the same token can read an ordinary key in the same category, so it fails if the token were dropped. Tests only; no production code changes.