Skip to content

test(agent-core): pin capsule load, host-call and audit guards at entry points - #89

Open
SaulBuilds wants to merge 1 commit into
mainfrom
test/runtime-entry-pins
Open

SaulBuilds wants to merge 1 commit into
mainfrom
test/runtime-entry-pins

Conversation

@SaulBuilds

Copy link
Copy Markdown
Contributor

Tests only. Pins existing guards at the runtime entry points (capsule load, host-call dispatch, audit read path, doctor roll-up) instead of only in helper modules. No production code changes.

New file agent/core/tests/capsule_load_pins.rs:

  • from_archive_stops_reading_at_the_decompression_bound, verified_load_stops_reading_at_the_decompression_bound, load_from_dir_refuses_an_over_cap_capsule_at_the_read: an archive that expands past MAX_DECOMPRESSED_BYTES is refused at the read, through the production readers (the existing unit test used an explicit small cap).
  • verified_load_refuses_a_wit_socket_import_the_manifest_denies, ..._filesystem_import_... (+ control verified_load_accepts_a_consistent_capsule): the WIT/manifest cross-check on the verified load path, using a capsule repacked and signed with a test key.
  • a_runaway_start_function_traps_during_instantiate: a component whose core start never returns traps during instantiate once the epoch advances (60 s hang verdict).
  • eth_send_host_call_carries_the_manifest_tier_to_the_gate: the host function passes the manifest's tier and required roles to the approval gate.
  • resolved_wasmtime_is_at_or_above_the_floor + negative control floor_check_flags_an_old_wasmtime.

New file agent/core/tests/audit_doctor_pins.rs:

  • verify_integrity_rejects_a_forged_signature_written_past_append
  • doctor_report_with_a_skipped_check_is_not_a_pass

Standard: met

  • Revert check, per guard (guard reverted, new test run, guard restored):
    • decompression cap at read_archive → 3 load tests red
    • WIT cross-check in from_archive_verified → 2 red
    • bounded instantiate epoch deadline → runaway-start test red
    • tier carried in the eth-send ApprovalRequest → tier test red
    • signature re-verification in verify_integrity → forged-signature test red
    • Skipped → Warn roll-up → doctor test red
      Before this PR none of these reverts failed any test in the crate.
  • cargo +1.96.0 test -p citrate-agent-core: lib 334 passed (unchanged), new integration binaries 10 + 2 passed. Count 334 → 346.
  • rustfmt clean; clippy reports nothing in the new files.
  • Tests write only to temp dirs; no network.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4

…ir entry points

Integration tests through the public API:
- Capsule::from_archive / from_archive_verified / CapsuleDispatch::load_from_dir
  stop reading at the production decompression bound.
- from_archive_verified refuses a validly signed capsule whose WIT imports
  sockets or filesystem the manifest denies.
- a component whose start function never returns traps during instantiate
  once the epoch advances.
- the eth-send host call hands the gate the calling manifest's risk tier and
  required roles.
- AuditChain::verify_integrity rejects a forged role signature written to the
  sink directly; doctor::run rolls a skipped check up to Warn.
- resolved wasmtime / wasmtime-wasi / wasmtime-wasi-io stay at or above the
  floor in agent/core/Cargo.toml (with a negative control).

Each new test goes red when the guard it pins is reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGMeatV8UjtCB4CTbWuAv4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant