Repository navigation
scripts: reject long-lived AKIA keys in env (credential guard) - #574
Merged
Merged
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR574Version: 🤖 Updated on each push. |
Contributor
Author
Review (pr-review-toolkit:code-reviewer)Critical: none. Important — both fixed in 42a5ba2:
Strengths confirmed:
|
This branch was previously deployed
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
Implements principles 5 and 6 from PR #571 (`docs/operations/access-policies.md`) at the script layer. Admin scripts in `scripts/` now refuse to run when a long-lived AKIA* access key is set in the process environment — a real risk on shared infrastructure (e.g., the hallu clone of nemar-cli lives under `/data/qumulo/`, a multi-tenant SDSC mount).
What changed
New: `scripts/lib/aws-creds-guard.sh` — small shared library exporting `nemar_guard_aws_credentials`:
Updated scripts (sourced the guard, removed legacy env-var-required checks, updated docstrings to point at the new credential flow):
Why this matters
Even though none of these scripts currently leak credentials directly, the previous pattern (`export AWS_ACCESS_KEY_ID=...`) means:
/.bash_history`, `/.zsh_history`).By rejecting AKIA in env at the start of every admin script, we close the most common foot-gun: an admin sourcing a `credentials.sh` file or running `export` and then forgetting to clean up.
Test plan
Companion to
Follow-ups