Granted
$ assume 官方出品 中风险Common Fate 开发的 Granted(assume)简化了多账号 AWS SSO 与 IAM 角色切换,可为不同账号开启隔离浏览器标签(assume -c),并通过 assume <profile> --exec 或 --env 向命令或 .env 注入临时凭证。
brew install common-fate/granted/granted assume 在本地切换 AWS STS 环境变量或拉起隔离浏览器,属于本地 Shell 凭证管理,不能放到 MCP 服务端。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
交互模式下依赖 Shell source 别名包装且无 JSON 输出;Agent 必须设置 FORCE_NO_ALIAS=true 并配合 --exec 使用。
- Requires
FORCE_NO_ALIAS=trueand--execto work cleanly in subshells - No
--jsonoutput mode; designed around interactive shell & browser UX
使用系统钥匙串缓存 SSO 令牌且 --exec 可将 STS 令牌限制在单个子进程,但 --env 会把密钥明文写入 .env。
--execscopes credentials to a single subprocess--env/--exportwrite temporary secrets to local files
可通过 Homebrew tap(common-fate/granted/granted)与二进制安装,但常规交互式 assume 用法需要配置 Shell 别名。
- Requires
alias assume="source assume"for interactive shell export
多账号控制台容器标签体验极佳,但对于能直接传 aws --profile 的无头 Agent 并非刚需。
- Excels at multi-account Firefox/Chrome container sessions (
assume -c)
由 Common Fate 维护的 MIT 开源 Go 项目(common-fate/granted / fwdcloudsec/granted)。
- MIT-licensed open-source repository
docs.commonfate.io 文档清晰,但 FORCE_NO_ALIAS=true 等脚本化变量位置较深。
- Official Granted documentation site
安全边界、鉴权与放权指南
读取 ~/.aws/config 配置,并将 SSO 与 STS 凭证缓存在系统钥匙串或加密的 ~/.granted/ 存储中。
MIT 开源 CLI,免费使用。
# Granted (assume) Agent Rules - Always set `FORCE_NO_ALIAS=true` and `GRANTED_QUIET=true` and prefer `--exec` over bare `assume <profile>` in non-interactive shells. - Never pass `--env` into a git-tracked directory without confirming `.env` is gitignored.
Agent 高频安全命令配方
只读查询(安全推荐)
--exec 在临时角色下执行只读 AWS 命令 FORCE_NO_ALIAS=true GRANTED_QUIET=true assume my-readonly-profile --exec "aws sts get-caller-identity --output json"
跳过交互式别名检测,仅在单次子命令作用域内注入临时 STS 凭证。
受控写入与预演
~/.aws/credentials FORCE_NO_ALIAS=true assume my-profile --export
把当前假设角色的短期 STS 凭证写入本地 ~/.aws/credentials 文件。
核心优势
- +
assume <profile> --exec可将临时 STS 凭证严格限定在单条子命令中。 - +
GRANTED_QUIET=true与FORCE_NO_ALIAS=true支持在 CI 与 Agent 子 Shell 中调用。 - + 使用系统钥匙串安全缓存 SSO 会话。
注意事项与踩坑点
- ! 在未配置 Shell 别名的子 Shell 中直接执行
assume <profile>会触发安装提示,必须设置FORCE_NO_ALIAS=true。 - ! 缺少 JSON 输出,且 SSO 过期后仍需交互式浏览器登录。