feat(auth): plumb --verify-sigv4 and --iam flags through DispatchConfig#388
Merged
vieiralucas merged 2 commits intomainfrom Apr 14, 2026
Merged
feat(auth): plumb --verify-sigv4 and --iam flags through DispatchConfig#388vieiralucas merged 2 commits intomainfrom
vieiralucas merged 2 commits intomainfrom
Conversation
Introduces the opt-in security feature flags without enforcing anything yet. Both features default to off — existing behavior is unchanged. - New `fakecloud_core::auth` module with `IamMode` (off/soft/strict) and `is_root_bypass` (matches `test*` AKIDs case-insensitively, the community-standard local-dev convention used by LocalStack and Floci). - `DispatchConfig` gains `verify_sigv4: bool` and `iam_mode: IamMode`. - `Cli` exposes `--verify-sigv4` / `FAKECLOUD_VERIFY_SIGV4` and `--iam off|soft|strict` / `FAKECLOUD_IAM`. - Startup WARN whenever either feature is enabled, noting that `test` credentials bypass both checks — prevents users from getting false-positive "my policies work" results from unsigned test clients. Groundwork for #381 (multi-account isolation): the new types are shaped so `account_id` will flow from the credential's owning account rather than from global config once the later batches land. No dispatch-time behavior change; actual verification and enforcement land in subsequent batches. Unit tests cover CLI parsing, mode parsing, config plumbing, and the root bypass predicate.
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-core/src/auth.rs">
<violation number="1" location="crates/fakecloud-core/src/auth.rs:106">
P2: `trimmed[..4]` panics on non-ASCII input when byte index 4 falls inside a multi-byte character. Use `str::get(..4)` for a safe, non-panicking slice that also simplifies the function.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Cubic identified a panic risk: trimmed[..4] panics when byte index 4 falls inside a multi-byte UTF-8 character. Switch to str::get(..4) which returns None on non-char-boundary slices and also collapses the empty / short-length branches. Add regression test with multi-byte UTF-8 inputs.
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
First batch of the opt-in SigV4 verification + IAM policy enforcement work. This PR only plumbs the flags — nothing is enforced yet, existing behavior is unchanged.
fakecloud_core::authmodule withIamMode(off/soft/strict) andis_root_bypass(matchestest*AKIDs case-insensitively — the community-standard local-dev convention used by LocalStack and Floci).DispatchConfiggainsverify_sigv4: boolandiam_mode: IamMode.--verify-sigv4/FAKECLOUD_VERIFY_SIGV4and--iam off|soft|strict/FAKECLOUD_IAM.testcredentials bypass both checks — so users don't get false-positive "my policies work" results from unsigned test clients.Roadmap context
This is batch 1 of 9:
aws-sigv4ServiceMetadata7-8. Per-service
action_to_iammappings + resource extractorsAlso sets up the shape for #381 (multi-account isolation): the new types are designed so
account_idwill flow from the credential's owning account rather than from global config once later batches land.Test plan
cargo test -p fakecloud-core auth::— 9 testscargo test -p fakecloud-core dispatch::tests::— 2 testscargo test -p fakecloud cli::— 4 tests (CLI flag parsing)cargo clippy --workspace --all-targets -- -D warningscleancargo fmt --checkcleanfakecloud --iam strict --verify-sigv4prints the startup WARN and otherwise behaves identically to beforeSummary by cubic
Adds opt-in SigV4 verification and IAM policy evaluation flags, wired from the CLI/env into
DispatchConfig. Defaults are off; no request behavior changes. Also fixes a crash inis_root_bypasswith non-ASCII AKIDs.New Features
fakecloud_core::authwithIamMode(off/soft/strict) andis_root_bypassfortest*AKIDs.DispatchConfigaddsverify_sigv4: boolandiam_mode: IamMode.--verify-sigv4(FAKECLOUD_VERIFY_SIGV4) and--iam off|soft|strict(FAKECLOUD_IAM).testcredentials bypass verification and IAM checks.Bug Fixes
is_root_bypassby usingstr::get(..4); added regression tests.Written for commit ba06607. Summary will update on new commits.