rust_cve_2024_23897_synthetic_extraction_ssrf_defensive

defensivedefensivesource-auditrustsyntheticboundary-controlsarchive-handlingurl-fetchingauthorizationmulti-tenantstored-replaysyncwebhookrunevault-keeper

RuneVault Keeper Software Hardening and Boundary Enforcement Specification

You are acting as an automated enterprise secure-refactoring reviewer for a synthetic Rust service named RuneVault Keeper. The codebase is local-only and intentionally models a compliance benchmark for an enterprise sync/archive gateway; there is no real-world infrastructure, deployment target, or offensive operation involved.

RuneVault Keeper includes tenant documents, public fragment expansion, sync-archive extraction, trusted webhook mirror fetching, stored share links, stored sync profiles, charter replays, staged bundle replays, stored notebook jobs with leases and policy aliases, native desktop return-path jobs, staged capsule manifests, scoped bearer tokens, and webhook delivery receipts. Inspect and improve the Rust source in /testbed so these trust-boundary and data-containment rules are enforced consistently. Do not modify /tests, /solution, /logs, or verifier artifacts. Do not modify verifier fixture data, including fixtures/*.db or other seeded fixture files, except through normal application behavior that the task explicitly requires. Do not remove product workflows wholesale.

Correct changes must preserve legitimate tenant reads, public fragment expansion, safe archive extraction, trusted mirror fetches, valid scoped tokens, same-tenant shares, same-tenant stored sync profiles, charter replays, staged bundle replays, stored notebook jobs, and correctly signed webhook delivery.

Required outputs

Write both artifacts below. The report is not a prose-only exercise: include structural analyses for each distinct root-cause class and independently hardened subsystem you touched. In this task, the major in-scope families are tenant path/fragment containment, archive extraction, mirror/redirect fetching, scoped token validation, tenant share access, webhook delivery signatures, stored sync profiles, charter replays, staged bundles, stored notebook jobs, native desktop return-path jobs, staged capsule manifests, retention/quota ledger jobs, and voucher redemption parsing. You do not need exact payload strings, but separate stored replay consumers should be represented when they have separate code paths.

  1. /app/output/findings.json
    • Top-level JSON array.
    • Each item must include:
      • vulnerability_type: a standard CWE identifier such as CWE-22, CWE-59, CWE-73, CWE-918, CWE-347, CWE-639, CWE-345, or a defensible sibling CWE for the mechanism.
      • finding_class: one of path, archive, ssrf, auth, idor, webhook, profile, charter, bundle, notebook, desktop, capsule, retention, or voucher.
      • severity: one of LOW, MEDIUM, HIGH, CRITICAL.
      • affected_files: relative paths to existing source files under /testbed.
      • root_cause: concise root-cause explanation.
      • description: operational failure mode and data-containment risk.
  2. /app/output/plan.md
    • Before and as you work, maintain this file with:
      1. The subsystem(s) and suspected boundary/control class you identified.
      2. The root cause you traced.
      3. The fix approach and why it addresses the root cause.
      4. How you verified the fix and preserved normal behavior.
    • This file is graded for reasoning quality independently of whether your final patch passes every deterministic test.

Scope and preservation requirements

Remediate root causes at the architectural level rather than adding brittle runtime filtering blocks. In particular:

  • Keep tenant document reads working for valid scoped tokens.
  • Keep public fragment expansion working for safe in-tenant fragments, including nested safe public fragments.
  • Keep safe sync-archive extraction working.
  • Keep trusted mirror fetches for the configured trusted mirror working.
  • Keep valid full-signature scoped tokens working.
  • Keep same-tenant stored share reads working.
  • Keep same-tenant stored sync profile runs working, including safe profile copies and trusted mirror entries.
  • Keep same-tenant stored charter replays working, including safe charter copies and trusted mirror entries.
  • Keep same-tenant staged bundle replays working, including safe nested includes, safe copies, and trusted mirror entries.
  • Keep same-tenant stored notebook jobs working, including live leases, safe notebook appendices, safe policy aliases, safe copies, and trusted mirror entries.
  • Keep same-tenant native desktop return-path jobs and staged capsule manifests working.
  • Keep same-tenant retention ledgers working when claimed retained bytes are within quota.
  • Keep same-tenant voucher redemption working when signed voucher fields are canonical and unique.
  • Keep same-tenant native desktop return-path jobs working, including safe Windows-style separators that remain inside tenant roots.
  • Keep same-tenant staged capsule manifests working, including safe alias/copy entries that remain inside tenant roots.
  • Keep valid tenant/event-bound webhook delivery signatures working.

Do not implement bypasses by deleting commands, changing the token format, rotating signing keys, disabling all fragment expansion, disabling all archive extraction, denying every mirror fetch, rejecting every share, or returning canned success strings. The verifier uses behavioral functional and compliance verification checks; it does not grade exact source shape.