Repository navigation
fix(storage,crypto,oci): zeroize keys, guard oci ssrf, clean local tmp files, unify gcp auth - #1852
Closed
nikhilunni wants to merge 6 commits into
Closed
nikhilunni wants to merge 6 commits into
nikhilunni wants to merge 6 commits into
Conversation
nikhilunni
marked this pull request as ready for review
December 2, 2026 21:53
… local tmp files, unify GCP auth
… schedule `seal_with_aad` and `open_with_aad` had no caller. A sealed row does not record whether it was sealed with AAD, so a reader cannot select the right open without a schema change, and an open that falls back to empty AAD gives no binding. The API stays out until a change adds the format marker and the callers together. Turn on the aes-gcm `zeroize` feature so the expanded AES and GHASH keys are cleared on drop, as the raw DEK and KEK already are. The persisted envelope format does not change; the aes-gcm 0.10.3 vector still opens. Restore the two facts the earlier cleanup dropped: why `SysRng` is used (a `!Send` RNG makes the seal future `!Send`), and that a failure of the fixed-vector test is a data problem, not a value to update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… redirects The address check ran a DNS lookup before every pull part, so a ranged layer pull did one lookup per part on the resume path. A registry that passes the check is now kept in a per-client set. A policy change (`with_insecure_loopback`, `with_private_registries`) clears the set, so a clone with a stricter policy does not reuse a looser result. The HEAD probe client refused all redirects. A registry with a redirecting storage driver answers a blob HEAD with a redirect, so a bake against it failed. Redirects now follow to HTTPS hosts that are not loopback names or private address literals, or to any HTTPS host when private registries are allowed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pback opt-in `ENGRAM_OCI_ALLOW_PRIVATE_REGISTRIES` is a new setting that a deployment with an in-cluster registry or a private registry endpoint must set, so the configuration reference lists it for the coordinator and the host agents. The compose file comment now names the loopback opt-in. The Tiltfile entries move next to the other local-service settings, away from the first line of `coord_env`, which another open change also edits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`list_prefix` hid every name that started with `.tmp.`, but no staging file has that shape: `put_streaming` names its staging file `<stem>.tmp.<pid>.<nanos>`. The rule hid valid keys such as `.tmp.key`. Only the real staging shape is now filtered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nikhilunni
force-pushed
the
audit/p1-crypto-oci-storage
branch
from
December 2, 2026 21:56
bd895e2 to
0a051b2
Compare
Contributor
Author
|
Combined into #1860 with the other audit PRs, so they merge and deploy together. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardens cryptography, OCI registry access, local blob staging, and cloud client resilience:
engram-crypto: Zeroizes raw DEKs,EnvVarKeyProviderkey material, and (with the aes-gcmzeroizefeature) the expanded AES and GHASH keys on drop. The persisted envelope format does not change: old rows open on the new build, and rows the new build seals open on the old build. No AAD API is added: a sealed row does not record whether it used AAD, so AAD needs a format marker and its callers in one change.engram-oci: Gates plaintext loopback HTTP behindENGRAM_OCI_ALLOW_INSECURE_LOOPBACK=1(the Tiltfile sets it) and rejects private, loopback, link-local, and metadata registry addresses unlessENGRAM_OCI_ALLOW_PRIVATE_REGISTRIES=1. A registry passes the check once per client, so a ranged pull does not do one DNS lookup per part. The blob HEAD probe follows redirects only to HTTPS hosts that are not loopback names or private address literals. oci-client owns its own DNS, redirects, and token requests, so DNS rebinding and those redirects stay a network egress policy concern.engram-storage-local: Removes<stem>.tmp.<pid>.<nanos>staging files on a failedput_streamingand filters that shape out oflist_prefix.crates/engram-cloud-gcp/src/auth.rs) with single-flight refresh and conditional 401 invalidation, used byengram-cloud-gcpandengram-secrets-gcp; bounded transient retries inengram-kms-aws,engram-secrets-aws,engram-secrets-gcp, andengram-cloud-gcp. GKEdeleteInstancescarries arequestId, so a retry does not repeat the delete.Upgrade note
A deployment that pulls from an in-cluster registry, or from a cloud registry behind a private endpoint (for example an ECR VPC endpoint with private DNS), must set
ENGRAM_OCI_ALLOW_PRIVATE_REGISTRIES=1on the coordinator and the host agents (extraEnvin both charts) before it rolls this build. Without it, image enables and pulls from that registry fail.Validation
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo hakari generate --diff.cargo nextest runforengram-crypto,engram-oci,engram-storage-local,engram-cloud-gcp,engram-secrets-gcp,engram-kms-aws,engram-secrets-aws.🤖 Generated with Claude Code