test: upload the dataset as the steward in the simulated TEE run #248
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #248"
general
weight: 0.35
abendrothj
What and why
Closes #240 (part of #183).
scripts/test-simulated-tee.shseeded the steward's data atenclave-apistartup, because an upload body is sealed by the browser's envelope module, which the script cannot run. So the steward upload route (ADR 0012), the v1 data path, had no end-to-end check, and neither did the approval retry after a revoke (#166).seal-upload, a dev-only binary (required-features = ["dev"]), plays the steward's browser. It seals a seededsynth-datacohort and the snapshot manifest listing it to the steward's public key, under the bindings the browser uses (steward-upload-v1for the object,tenant-snapshot-manifest-v1for the manifest). It declares the cohort's schema and row count in the header and writes the body to stdout. It holds no private key and sends nothing. It runs as its own image and compose service with no network, under thetoolsprofile, soupnever starts it.platform_api::dev::seal_upload(andseal_cohort_uploadfor the cohort). The API tests'common::sealed_uploadnow calls it, so the tests and the tool seal the same way.- starts
enclave-apiwith an empty vault (the compose file no longer passesDEMO_TENANT_*), uploads the body throughPUT /api/v1/datasets/upload_cohort, publishes the dataset and runs the research lifecycle on it;- checks that an upload is refused without a token (401), outside the upload namespace (404) and at a stale version (409: the same body sent again);
- checks that approving the request again after the revoke is refused (404), and that the researcher's next query is still refused (403);
- requires the vault to hold exactly three files, at the version and object id in the steward's header: the upload's object and manifest as
HPK1envelopes, and its record, which must hold exactly the version, row cap and schema in the header, plus the suite. Any other file fails the check, whatever tenant it belongs to. It runs the check after the upload and again as the last stage, after every query, and finds no Parquet magic bytes anywhere;- drops its "Not covered yet" list.
seal-upload.Notes for review
StewDataListRoute) and merges after #246 and #243, so the diff shows only this work: 1f125eb, and the review fixes in 5a7a496 and 8c3bcf2.seal-uploadpasses aSuitePolicytoTenantPublicKey::from_raw, the tests'TenantKeypair::generatetakes a suite, and the script enrolls a framedHPK2key and expectsHPK2in the upload's suite, the record and the envelope check (at least 1140 bytes).maybe_seed_demo_fixtureinwiring.rs) no longer runs end to end; whether to keep that coverage is a maintainer decision. The function itself is untouched; it is outside this issue's "Where".How it was tested
scripts/check.shpasses locally (secret scan skipped: gitleaks is not installed locally).the_seal_upload_tools_cohort_is_stored_and_queryableindataset_upload_api.rsuploads the exact bodyseal-uploadwrites (k = 5). The stored record holds the five declared columns and a row cap of 46, and the enclave query releases 7 groups and suppresses 2, so the declared schema matches what the enclave reads.seal-upload's unit tests accept a tenant, key andupload_dataset (with the default and an explicit k). They refuse a connector dataset, a malformed dataset id, a bad public key, a bad tenant id, an unknown flag, a flag without a value and a missing dataset.docker compose(each service's compose environment, on loopback). All 9 stages passed:- upload: 401, 404 and 409 refusals, and the upload itself;
- vault, after the upload and again after the queries: exactly the upload's 2
HPK1envelopes and its record, which holds exactly what the header declared, and no Parquet magic bytes;- research: 403 before a grant; the aggregate keeps celiac (2 rows) and gout (3) and suppresses lupus (1); 422 for a row-level query; 429 on a spent budget; 404 for the approval retry and 403 after it;
- tamper: 503 for each tampered token, then 200.
CI's
simulated TEE end to endjob runs it on real Docker. On 8c3bcf2 it passed all 9 stages with the same results, which also covers the new image,docker compose runof a profile-only service, and the binary body over Docker's stdout.control/, an extra file under another tenant, an extra envelope, a second snapshot version, a symlink, a missing record, a missing manifest, or nothing at all. Others have a record with an extra field, another suite, another row cap or invalid JSON, an envelope with another magic or too few bytes, or Parquet magic bytes inside an envelope.Checklist
scripts/check.shpasses locally (its secret-scan step was skipped: gitleaks is not installed locally)seal-upload's argument refusals are tested, though not its refusal to write the binary body to a terminal)SECURITY_AUDIT_EVENTcovered byaudit_coverage.rs(none: the API is unchanged, and the script checks refusals that are already audited)seal-uploadrefuses to run without a tenant, key and upload dataset; the script stops at the first unexpected status)seal-uploadseals with the existinghpke_seal_to_tenant)docs/DATA_POLICY.md): the upload issynth-data's seeded cohortCHANGELOG.mdupdated for user-visible changesdocs/adr/if one was made (none: a dev-only tool and test coverage under ADR 0012)