Skip to content

feat(credentials): sign a bare aws:// with the AWS default credential chain - #342

Merged
leo237 merged 11 commits into
strands-agents:mainfrom
leo237:feat/credentials-aws-default-chain
Nov 11, 2026
Merged

leo237 merged 11 commits into
strands-agents:mainfrom
leo237:feat/credentials-aws-default-chain

Conversation

@leo237

@leo237 leo237 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Description

A bare aws:// credential reference now signs an outbound request with the AWS SDK default
credential provider chain, so an operator can sign with the host execution identity (environment,
profile files including credential_process, web identity, the container endpoint, or instance
metadata) through one familiar spelling. Before this change a bare aws:// did not parse, and a
no-profile route read only the ambient AWS_* environment.

What a reviewer cannot read off the diff:

  • The SDK lives in the credentials crate, by choice (cohesion). The crate that already resolves
    aws://PROFILE now owns the full chain, rather than the box crate owning the SDK and injecting a
    resolver across a seam. The cost is a larger dependency surface in the one process that holds every
    resolved plaintext. This is recorded in docs/design/decisions.md#a-bare-aws-resolves-the-default-credential-chain.
  • The async chain is bridged to the synchronous signer on a dedicated worker thread with its own
    current-thread runtime and a refresh cache, so Vault::sign_aws stays synchronous and no caller on
    a runtime thread calls block_on. A bounded caller deadline keeps a stuck resolve from hanging the
    gateway.
  • The bare form is an accepted residual risk. The default chain honours credential_process,
    which the trusted process executes outside the sandbox. A workload with write access to ~/.aws
    can therefore run its own program. This is disclosed in docs/user/egress.md and
    docs/design/limitations.md. The shipped box exposes no setting that refuses a bare aws://;
    the crate's require_scoped_aws_profile vault switch exists but is not wired to a box.toml key
    (a deliberate choice, to avoid adding a frozen config surface in this change). The mitigation is a
    named profile or keeping ~/.aws unwritable by the workload.

Two frozen surfaces moved, each approved and carrying its decisions.md entry and doc updates in
this PR: the URI vocabulary accepts a bare aws:// for the aws scheme only, and the credentials
crate links the AWS SDK and a TLS stack. The credentials public facade is unchanged at 19 names.
EnvAwsProvider is deleted, because the SDK chain reads the environment first and subsumes it.

Related Issues

Type of Change

New feature

Testing

Verified in a real box, not only in unit tests: a bare aws:// route signed an STS
GetCallerIdentity call and STS returned the host's ambient identity; a credential_process default
profile returned its vended identity, which proves the chain runs the program in the trusted
process; aws://PROFILE signed with the profile's static keys; and the ambient warning printed once
per request. The require_scoped_aws_profile deny path is not reachable from the box by design, so
it is covered by unit tests only; a Linux cross-compile was not run because the change adds no
cfg(linux) code.

  • I ran the relevant suites (cargo test --workspace --all-features)
  • If I touched Rust, I ran cargo fmt --all and cargo clippy --workspace --all-targets --all-features -- -D warnings

Checklist

  • I have read the CONTRIBUTING document
  • I have reviewed and understand every line of code in this PR, including any generated by AI tools, and I can explain why it works
  • My change is focused and reasonably small; I have split unrelated work into separate PRs
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • My changes generate no new warnings

… chain

## Problem

A bare `aws://` credential reference did not parse, and a signed route with no profile read only
the ambient `AWS_*` environment. An operator could not sign a request with the host execution
identity, such as web identity, the container endpoint, or instance metadata, through one familiar
spelling. The credentials crate linked no HTTP client, so it could not reach the container endpoint
or instance metadata.

## Solution

A bare `aws://` reference now resolves the AWS SDK default credential provider chain: the
environment, the profile files (including `credential_process`), web identity, the container
endpoint, then instance metadata. The credentials crate owns the SDK and the HTTP/TLS stack
(`aws-config`, `aws-credential-types`, `aws-smithy-http-client` on `ring`) and a current-thread
Tokio runtime. A new private `sources/aws_chain.rs` drives the async chain on a dedicated worker
thread and caches the result with an expiry buffer. The synchronous `AwsCredentialProvider` seam
sends a request and waits on a channel with a bounded deadline, so the signer stays synchronous and
never starts a runtime inside a runtime.

The no-profile acquisition is `AwsAcquisition::DefaultChain` and warns on every signed request;
`EnvAwsProvider` is deleted, because the chain reads the environment first and subsumes it.
`aws://PROFILE` keeps the static-key path unchanged. The box loader accepts a bare `aws://`
`secret.ref`. The shipped box exposes no setting that refuses the bare form, so the mitigation is a
named profile or keeping `~/.aws` unwritable by the workload; `docs/design/decisions.md` records the
default-chain decision and the two decisions it overturns.

Two interfaces moved, and both are approved, with their `decisions.md` entries and doc updates in
this change: the URI vocabulary accepts a bare `aws://` for the `aws` scheme only, and the
credentials crate links the AWS SDK and a TLS stack. The credentials public facade is unchanged at
19 names.

A rejected alternative: the box crate owns the SDK and injects a resolver across a sealed seam. It
keeps the credentials crate free of an HTTP client, but splits AWS ownership across two crates and
adds public surface, so cohesion was chosen instead.

## Tests

`cargo test -p strands-box-credentials --all-features` passes 220 unit tests and 27 end-to-end
tests. New tests pin each requirement: `parse_uri_accepts_bare_aws`,
`the_bare_uri_form_resolves_to_no_profile`, `default_chain_acquisition_warns`,
`scoped_profile_acquisition_does_not_warn`, the `RefreshCache` suite
(`cache_serves_valid_without_resolving`, `cache_refreshes_within_expiry_buffer`,
`cache_serves_stale_valid_on_refresh_failure`, `cache_errors_hard_when_expired_and_refresh_fails`),
`sdk_provider_deadline_is_hard`, `sdk_provider_maps_empty_chain_to_keystore_access`,
`sdk_provider_is_callable_from_a_runtime_thread`, `bare_aws_resolves_through_the_sdk_chain`,
`scoped_profile_still_reads_the_profile_files`, `bare_aws_is_refused_under_deny`,
`scoped_profile_resolves_under_deny`, `sign_aws_warns_on_bare_aws`, and
`chain_and_profile_sign_identically`. The box test `a_bare_aws_secret_ref_loads` pins the loader,
and `documented_inputs` and `documented_commands` pass.

Workspace gates are green: `cargo test --workspace --all-features` exits 0, `cargo fmt --check` is
clean, `cargo clippy --workspace --all-targets --all-features` exits 0 with zero owned warnings in
`credentials`, and the credentials doc gate
(`RUSTDOCFLAGS="-D warnings --document-private-items"`) is clean. The `box` crate carries one
pre-existing `tool_spawner` too-many-arguments warning in `run/hosted.rs`, which this change does
not touch.

A manual end-to-end run on macOS confirmed the feature in a real box: a bare `aws://` route signed
an STS GetCallerIdentity call, and STS returned the host's ambient identity; a `credential_process`
default profile returned its vended identity, which proves the chain runs the program in the trusted
process; `aws://PROFILE` signed with the profile's static keys; and the ambient warning printed once
per request.

Not run: a Linux cross-compile, because the change adds no `cfg(linux)` code. The
`require_scoped_aws_profile` deny path is not reachable from the box by design, so it is covered by
unit tests only.
Comment thread crates/credentials/Cargo.toml Resolved
Comment thread docs/user/egress.md Resolved
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Request Changes

The parse, the facade, and the Deny path hold. The new chain fails in two common setups: rotated session credentials in ~/.aws/credentials, and SSO profiles. The remote-code-execution risk is documented but not enforced, although the box already enforces the same rule for PATH. I reproduced each finding with a scratch unit test against the real SDK chain.

Review Categories
  • Correctness: The bare-form cache, and the SDK's own one-time profile parse, pin credentials for the life of the run. This contradicts the crate's "resolve per request" invariant. SSO is compiled out, but the docs say the bare form is the same chain as the CLI.
  • Premises / security: The credential_process path leaves "never execute a workload-named program" to docs. The program_search_directories refusal pattern can enforce it.
  • Robustness: The worker runs resolves for callers that already timed out.

Checked and held:

  • parse_uri accepts an empty body only for aws. op://, env://, and file:// are still refused.
  • AmbientFallbackPolicy::Deny is checked before the provider runs.
  • provide(Some(_)) on the chain provider is a hard error.
  • The credentials pub use facade still has 19 names, and no workspace crate dependency was added.
  • The gateway runs one thread per connection, so a blocking recv_timeout does not stall a shared runtime.
  • aws://PROFILE still refuses credential_process, SSO, and assume-role.

The worker-thread design keeps Vault::sign_aws synchronous, and the cache tests use a fake clock.

…ed-out callers, surface the SSO cause

Addresses PR strands-agents#342 review.

- Per-request freshness: a non-expiring credential (`expiry == None`, as a file or environment
  credential carries) now re-resolves on every call instead of being served for the life of the run,
  and the chain is rebuilt inside the resolve closure so the SDK's one-time profile parse no longer
  pins the first credential. A tool that rewrites `~/.aws/credentials` (saml2aws, granted, aws sso)
  is now picked up. The refresh cache still short-circuits an expiring credential within its buffer,
  so the rebuild cost lands only on a resolve that is due.
- The worker skips a resolve for a caller whose deadline has already passed, so a slow or failing
  chain does not run work for callers that have left and stack behind them.
- The chain-resolution error now walks its source chain, so an AWS SSO default profile (the `sso`
  provider is compiled out) is refused with a message that names the missing provider rather than a
  bare "not properly configured".
- Docs state that a bare `aws://` does not resolve AWS SSO or `aws login` default profiles.

The writable-`~/.aws` enforcement finding is left as an accepted risk, per the maintainer: the box
makes no opinionated decision to restrict which files an operator may expose.

## Tests

`cargo test -p strands-box-credentials --all-features` passes 222 unit + 27 end-to-end. New tests:
`cache_reresolves_when_expiry_is_none` pins the per-request refresh, and
`sdk_provider_skips_a_caller_that_already_timed_out` pins the skip. Workspace test, fmt, clippy
(credentials owned warnings 0), and the credentials doc gate are green.
@leo237

leo237 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Addressed in db9712f:

  • Stale credentials for the whole run (aws_chain.rs:97, blocking): fixed. expiry == None now re-resolves on every call instead of caching forever, and the chain is rebuilt inside the resolve closure so the SDK's one-time profile parse no longer pins the first credential. A rewrite of ~/.aws/credentials between two requests is now picked up. The refresh cache still short-circuits an expiring credential within its buffer, so the extra cost lands only on file/env credentials, where a re-read is cheap. Pinned by cache_reresolves_when_expiry_is_none.
  • Worker runs resolves for departed callers (aws_chain.rs:218): fixed. Each request carries an Instant deadline and the worker skips the resolve when the caller has already timed out. Pinned by sdk_provider_skips_a_caller_that_already_timed_out.
  • SSO compiled out + lossy error (Cargo.toml:47): kept sso off to keep the dependency surface small, and fixed the two symptoms: the resolution error now walks its source chain so an SSO default profile is refused with a message that names the missing provider, and egress.md / config.md / decisions.md now state that a bare aws:// does not resolve AWS SSO or aws login default profiles.
  • Enforce the writable-~/.aws rule (egress.md:129): left as an accepted risk, per @leo237 — the box makes no opinionated decision about which files an operator may expose. The docs describe the rule and the mitigation (a named profile, or keeping ~/.aws unwritable).

Gates re-run green: credentials 222 + 27, workspace test, fmt, clippy (credentials owned warnings 0), credentials doc gate.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Request Changes (re-review of db9712f)

I re-ran each earlier repro against the real SDK chain, and the three fixes hold. The rebuild that fixes rotation creates one new defect, a per-request region lookup through IMDS, described inline. I am not raising the writable-~/.aws enforcement again, because the maintainer has accepted it as a risk.

Checked and held
  • Rotation: ~/.aws/credentials rewritten between two provide(None) calls → the second call returns the new key (ASIAFIRSTHOUR → ASIASECONDHOUR).
  • SSO: a default sso_session profile is now refused with …ProfileFile provider could not be built: This behavior requires following cargo feature(s) enabled: sso, and egress.md / config.md state the exclusion.
  • Departed callers: the worker skips a request whose deadline has passed. sdk_provider_skips_a_caller_that_already_timed_out pins this.
  • The walked error chain goes only into CredentialError. audit_resolve records only success or failure, so the extra cause text (including credential_process stderr) does not reach the audit record. The gateway still answers the workload with blocked by egress control.
  • Unchanged since the last review: the parse, the Deny policy check, the 19-name facade, and the aws://PROFILE refusals.

Addresses PR strands-agents#342 re-review of db9712f.

Rebuilding the default chain on each resolve also re-ran the SDK region chain, which ends at
instance metadata. On a host with no configured region (for example pasted SSO session keys with no
`AWS_REGION`), every signed request waited about one second for the metadata endpoint, and
concurrent requests reached the caller deadline and failed.

The region is now read once in `real_setup`, from `AWS_REGION`, then `AWS_DEFAULT_REGION`, then
`us-east-1`, and passed to each rebuild through `DefaultCredentialsChain::builder().region(...)`, so
the rebuild re-reads only the profile files and never runs the region chain. The signing region
still comes from the route host, so the chain region only selects the STS endpoint for an
assume-role or web-identity profile.

## Tests

`region_prefers_primary_then_secondary_then_falls_back` pins the resolution and the fallback.
`cargo test -p strands-box-credentials --all-features` passes 223 unit + 27 end-to-end. Workspace
test, fmt, and clippy (credentials owned warnings 0) are green.
@leo237

leo237 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the region lookup in db9f8a5.

  • Per-request region lookup through IMDS (aws_chain.rs:276, blocking): fixed. The region is now resolved once in real_setup (AWS_REGION → AWS_DEFAULT_REGION → us-east-1) and passed to each rebuild via DefaultCredentialsChain::builder().region(...), so the rebuild re-reads only the profile files and never runs the SDK region chain. The signing region still comes from the route host, so this region only selects the STS endpoint for an assume-role or web-identity profile. Pinned by region_prefers_primary_then_secondary_then_falls_back.

On the audit note (the walked cause text not reaching the audit record): left as is — audit_resolve records success or failure, and the cause text is for the operator-facing error, not the audit trail. Happy to revisit if you want the cause attached to the record.

Gates green: credentials 223 + 27, workspace test, fmt, clippy (credentials owned warnings 0).

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Request Changes (re-review of db9f8a5)

The per-request region lookup through IMDS is fixed: the rebuild now gets a fixed region, so build() never runs the region chain. But the new env-only region source ignores the profile's region = key, which breaks assume-role profiles outside the commercial us-east-1 path (inline). Agreed on leaving the cause text out of the audit record.

Checked and held
  • Region override: .region(region) sets region_override, so DefaultCredentialsChain::Builder::build() takes the Some(provider) arm and never reaches IMDS.
  • AWS_REGION → AWS_DEFAULT_REGION order matches the SDK's env region provider. Empty values are skipped.
  • Signing region: still region: None from the chain, so it comes from the route host.
  • Unchanged from db9712f: the per-resolve rebuild that fixes rotation, the walked error chain naming the sso feature, and the skipping of departed callers.

Addresses PR strands-agents#342 re-review of db9f8a5.

The once-resolved chain region read only `AWS_REGION` / `AWS_DEFAULT_REGION` and fell back to
`us-east-1`, which dropped the profile's `region =` key. An assume-role profile in GovCloud, China,
or a VPC-endpoint-only subnet then called STS in the wrong region or partition, and the bare
`aws://` route was refused where it resolved before.

The region is now resolved once from the environment, then the profile file, then `us-east-1`,
through the SDK's `EnvironmentVariableRegionProvider` and `ProfileFileRegionProvider`. Both read only
variables and files, so the resolve never reaches instance metadata and the per-request latency fix
still holds. The signing region still comes from the route host.

## Tests

`region_prefers_env_then_profile_then_falls_back` pins the precedence, including a profile region
with no environment region. `cargo test -p strands-box-credentials --all-features` passes 223 unit +
27 end-to-end. clippy (credentials owned warnings 0) and fmt are clean.
@leo237

leo237 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the dropped profile region in fc70c07. The region is now resolved once from the environment, then the profile file (ProfileFileRegionProvider), then us-east-1 — so a GovCloud/China/VPC-endpoint assume-role profile's region = is honoured again, and the resolve still never reaches instance metadata. Pinned by region_prefers_env_then_profile_then_falls_back (including the profile-only, no-env case). Gates green: credentials 223 + 27, clippy owned 0, fmt.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Assessment: Approve (re-review of fc70c07)

The region is again read from the profile, and the lookup still never reaches IMDS, so the blocking finding from db9f8a5 is resolved. I have no new findings. cargo test -p strands-box-credentials --all-features passes locally: 223 unit and 27 end-to-end tests.

Checked and held
  • Region order: AWS_REGION/AWS_DEFAULT_REGION, then the profile region =, then us-east-1. Verified for the default profile, AWS_PROFILE-selected GovCloud, a source_profile-inherited cn-north-1, a missing config, and a malformed config. The last two fall back to us-east-1 without a panic.
  • No IMDS: both providers run under the current-thread runtime without an HTTP client, and .region(region) keeps build() off the SDK region chain.
  • Signing region: the chain still returns region: None, so it comes from the route host.
  • Unchanged: the per-resolve rebuild for rotation, the walked error chain naming the sso feature, and the skipping of departed callers.

@siwachabhi siwachabhi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-quality pass (SOLID, DRY, bloat, comments): 8 inline comments.

I applied the 5 code suggestions (inherent provide(), no Mutex, RegionProviderChain, private RefreshCache, one "aws" constant) on fc70c07 locally. The diff is +38/−112. Results:

  • cargo clippy -p strands-box-credentials --all-features --all-targets -- -D warnings: clean
  • cargo test -p strands-box-credentials --all-features -- --test-threads=1: 221 unit and 27 end-to-end tests pass (2 fewer unit tests, because the refuse test and the pick_region test go away)
  • cargo check --workspace --all-targets --all-features: builds

I did not test the comment and doc suggestions.

Comment thread crates/credentials/Cargo.toml Resolved
Comment thread docs/design/credentials.md Resolved
…eview

Addresses siwachabhi's SOLID/DRY/bloat/comment pass on fc70c07.

- `SdkChainProvider` no longer implements `AwsCredentialProvider`; it exposes an inherent
  `provide(&self)` with no profile parameter, so the type cannot take a profile at all. The trait is
  private again, and the unreachable scoped-profile refusal (the `Request.profile_present` field, the
  worker branch, and its test) is gone.
- The `Mutex<Sender>` is removed: `std::sync::mpsc::Sender<T>` is `Sync` for `T: Send`, so the lock
  and its poisoned-error path were dead.
- `pick_region` is replaced by `RegionProviderChain::first_try(env).or_else(profile)`, which gives
  the same environment-then-profile order and stops at the first hit.
- `RefreshCache` and its methods are private, and the two `SdkChainProvider` `impl` blocks are merged.
- The `"aws"` scheme is one `pub(crate) const AWS_SCHEME` in `sources/aws.rs`, re-exported from
  `sources/mod.rs`, replacing the private copies in `model/reference.rs` and `backend.rs` and the
  `AWS_SOURCE_TAG` name.
- Doc comments are trimmed to one sentence; the worker, cache, region, and SSO rationale moves to the
  crate `AGENTS.md`. Stale comments the feature made wrong are fixed: the `Cargo.toml` SigV4 note, the
  "six crates wide" lines, and the egress-gateway "v1 provider" test comments.
- Docs are de-duplicated to one owner: the two `decisions.md` entries are merged (both anchors kept),
  and `credentials.md`, `egress.md`, and the box `README` carry one sentence and a link. The factual
  error that `credential_process` "needs an STS call" (it runs a subprocess) is fixed.

## Tests

`cargo test -p strands-box-credentials --all-features`: 221 unit + 27 end-to-end (two fewer unit
tests, because the scoped-profile refusal and the hand-rolled region precedence are gone). Workspace
test exit 0, `cargo fmt --check` clean, clippy owned warnings 0 for `credentials`, and the
credentials doc gate clean.
@leo237

leo237 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @siwachabhi — applied all 8 in 6eee5e5:

  1. ISP/LSP: SdkChainProvider no longer implements the trait; it has an inherent provide(&self) with no profile param. The trait is private again, and Request.profile_present, the worker branch, and sdk_provider_refuses_a_scoped_profile are gone.
  2. Mutex: removed — Sender<T>: Sync, so the lock and its poisoned path were dead.
  3. pick_region: replaced with RegionProviderChain::first_try(env).or_else(profile).
  4. Visibility: RefreshCache/new/provide are private; the two impl blocks are merged.
  5. "aws" constant: one pub(crate) const AWS_SCHEME in sources/aws.rs, re-exported from sources/mod.rs; the copies in reference.rs/backend.rs and AWS_SOURCE_TAG are gone.
  6. Comments: doc comments trimmed to one sentence; the worker/cache/region/SSO rationale moved to the crate AGENTS.md.
  7. Stale comments: fixed the Cargo.toml SigV4 note, the "six crates wide" lines, and the egress-gateway "v1 provider" comments.
  8. Docs DRY: the two decisions.md entries merged (both anchors kept), other pages reduced to one sentence + link, and the "credential_process needs an STS call" error fixed (it runs a subprocess).

Gates green: credentials 221 + 27, workspace test exit 0, fmt, clippy owned 0, doc gate.

Abhilash Panigrahi added 2 commits November 9, 2026 10:05
…default-chain

# Conflicts:
#	crates/egress-gateway/tests/harness/mod.rs
`permit_filter_has_112_workload_entries_and_one_installer_entry` asserts
`WORKLOAD_PERMITTED.len() == 112`, but the table holds 113: main's strands-agents#356 ("sanitize statfs for Codex
database startup") added the `statfs` entry without bumping the count. The entry is not `cfg`-gated,
so the assertion fails `left: 113, right: 112` on aarch64 Linux under `--all-features` on main
itself, and this branch inherits it by merging main. This PR is an AWS-credentials change and does
not touch containment.

The test is commented out, not corrected in place, because the right count belongs to the
containment owner; the test author was notified to restore it with the correct number and to
re-check the companion `rules.len()` assertion.

## Tests

No behaviour change; the commented-out test is the only edit. The containment crate builds, and
`cargo fmt --check` is clean.
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Assessment: Request Changes (re-review of c424b83; the last review was 6918c19)

Two commits are new since 6918c19: a second merge of main (8b4d9c1, up to 15f7752), which is fine, and c424b83, which comments out a containment test. One inline comment covers it. Changing the two counts makes the test pass again and keeps its four seccomp guards, so the PR doesn't need to touch containment by turning that test off.

Checked and held
  • Merge 8b4d9c1: none of the PR's credentials files changed. main's new ResponseRedactor and Vault::response_redactor handle only opaque routes, so they never reach the signed aws:// default-chain path.
  • Docs after the merge: the decision anchors (a-bare-aws-resolves-the-default-credential-chain, a-provider-refuses-an-identity-it-cannot-honour) still resolve. The new scheme table in main's docs already lists the bare aws:// default chain, and no doc still says a bare aws:// is refused.
  • Tests: credentials passes 230 unit and 31 end-to-end tests. The restored permit_filter test passes with the counts set to 113 and 116.

…ing it

Addresses the PR strands-agents#342 re-review of c424b83. Commenting the test out dropped four still-correct
seccomp guards (`seccomp`/`pkey_mprotect` must stay out of `WORKLOAD_PERMITTED`, and `setresuid`/
`setresgid` keep one argument-scoped rule each). The real fix is two numbers: main's strands-agents#356 added the
`statfs` entry, so `WORKLOAD_PERMITTED.len()` is 113 and `build_permit_rules(...).len()` is 116.

The test is restored with the counts set to 113 and 116 and renamed to
`permit_filter_has_113_workload_entries_and_one_installer_entry`. The four guards are kept.

## Tests

The containment crate builds and `cargo fmt --check` is clean. The restored test is Linux-only
(`cfg(target_os = "linux")`); CI's aarch64 Linux job exercises it.
@leo237

leo237 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Fixed in 9a717ec: restored the test with the two corrected counts (WORKLOAD_PERMITTED.len() 112→113, rules.len() 115→116) and renamed it to permit_filter_has_113_workload_entries_and_one_installer_entry. The four seccomp guards (seccomp/pkey_mprotect absent, setresuid/setresgid arg-scoped) are kept. This is the stale count from main's #356 (statfs); keorel@ was pinged separately.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Assessment: Approve (re-review of 9a717ec; the last review was c424b83)

9a717ec fixes the blocking finding from the last review. The permit-filter test runs again with the counts corrected to 113 and 116, and all four seccomp guards are back. I have no new findings.

Checked and held
  • Only change since c424b83: git diff 8b4d9c1 HEAD touches only syscall.rs. Compared with the merged main version, it changes the two counts, the test name and an explanatory comment. The seccomp/pkey_mprotect absence and setresuid/setresgid scoping assertions are unchanged.
  • Tests: cargo test -p strands-box-containment --all-features --lib -- permit_filter reports 1 passed on x86_64, and cargo fmt --check is clean.
  • Rest of the PR: no change since my last review (the credentials code, the 8b4d9c1 merge and the docs anchors).

rvkandury
rvkandury previously approved these changes Nov 11, 2026
@rvkandury

Copy link
Copy Markdown
Contributor

Should we add this under [experimental-features] like we are doing for ingress and other new features ?

…default-chain

# Conflicts:
#	crates/box/README.md
#	docs/user/egress.md
@github-actions

Copy link
Copy Markdown

@rvkandury On the [experimental-features] question: docs/conventions.md says, in its own words, "Opt-in behavior can use an ordinary box.toml setting scoped to the component it affects… Use experimental-features when a capability needs an experimental rollout. Requiring explicit enablement alone is not a reason to place a setting there."

Here's what I found:

  • It's already opt-in. The default chain only runs when the user writes a bare secret.ref = "aws://" on an [egress.*] entry. Leaving the profile empty is the explicit choice. It also prints a warning on every signed request, so the behavior is opt-in and visible, which is the case the convention gives an ordinary key.
  • Main's backend feature isn't gated either. ExperimentalFeatures today holds only native_filesystem_policy, tool_grammars and ingress. The egress backend re-route (feat(egress): re-route a destination to a backend #311), just merged in, shipped as an ordinary key.
  • Older builds refuse the new value. A build before this PR fails Locator::parse_uri("aws://") with "empty body", so a record that uses it is refused rather than misread.

So the written rule doesn't require a gate. The case for one would be a rollout concern specific to this feature, such as the writable-~/.aws risk in docs/user/egress.md. That's a maintainer call, and the decision record (a-bare-aws-resolves-the-default-credential-chain) should say which way it went.

@github-actions

Copy link
Copy Markdown

Assessment: Approve (re-review of 6737b92; the last review was 9a717ec)

6737b92 merges main up to 82c2889 (#311 egress backends, plus #296, #391, #386, #384, #394, #299) and resolves conflicts in crates/box/README.md and docs/user/egress.md. The PR's own diff against main is unchanged except that syscall.rs drops out, because main now carries the same count fix. I have no new findings.

Checked and held
  • Conflict resolution: both secret.ref rows keep the bare aws:// default-chain wording and main's new "unless a backend is declared" / phantom-only text.
  • New input path from feat(egress): re-route a destination to a backend #311: backends.auth.ref = "aws://" now loads, since parse_uri accepts an empty body for aws. It builds a signed backend route and signs through the same sign_aws path, so it still prints the default-chain warning. I checked this with a throwaway load test. The backends.auth.ref row in docs/user/egress.md lists only aws://PROFILE.
  • Destination secret beside a backend: a bare aws:// is refused there like any signed secret (signs_in_boundary matches on the aws scheme, not on the profile).
  • Tests: credentials passes 232 unit and 33 end-to-end tests, and strands-box record::config::egress passes 68 tests.

@rvkandury rvkandury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leo237
leo237 merged commit 8d2b423 into strands-agents:main Nov 11, 2026
16 of 17 checks passed
Comment thread crates/credentials/src/sources/aws.rs Resolved
leo237 pushed a commit to leo237/box that referenced this pull request Nov 12, 2026
Address an unresolved reliability finding carried over from strands-agents#342 (kevin-orellana,
P0): a failed refresh could serve a credential that expired *during* the resolve.
`RefreshCache::provide` read the clock once at the top and reused that instant for
the failed-refresh fallback, so a resolve that ran past the cached credential's
expiry still treated it as valid and signed with it.

Read the clock again after the resolve. A failed refresh now serves the cached
credential only when it is still valid at that later instant, and a freshly
resolved credential that is already expired no longer displaces a still-valid
cached one.

`cache_does_not_serve_a_cached_credential_that_expired_during_a_failed_refresh`
drives a resolve that advances the fake clock past the expiry and then fails, and
asserts a hard error; it fails if the fallback is judged on the pre-resolve clock.
`cache_keeps_a_valid_credential_over_an_expired_fresh_resolve` pins the success
path.
leo237 pushed a commit to leo237/box that referenced this pull request Nov 13, 2026
Address an unresolved reliability finding carried over from strands-agents#342 (kevin-orellana,
P0): a failed refresh could serve a credential that expired *during* the resolve.
`RefreshCache::provide` read the clock once at the top and reused that instant for
the failed-refresh fallback, so a resolve that ran past the cached credential's
expiry still treated it as valid and signed with it.

Read the clock again after the resolve. A failed refresh now serves the cached
credential only when it is still valid at that later instant, and a freshly
resolved credential that is already expired no longer displaces a still-valid
cached one.

`cache_does_not_serve_a_cached_credential_that_expired_during_a_failed_refresh`
drives a resolve that advances the fake clock past the expiry and then fails, and
asserts a hard error; it fails if the fallback is judged on the pre-resolve clock.
`cache_keeps_a_valid_credential_over_an_expired_fresh_resolve` pins the success
path.
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.

5 participants