[Aikido] Prevent arbitrary command execution via unskipped !exec YAML tags in secret enumeration - #2972
Conversation
…to prevent arbitrary command execution during secret enumeration and list inventory operations.
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
CodeRabbit (@coderabbitai) isn't the entire point of |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
for file in cmd/list/utils.go cmd/secret/shared.go cmd/secret/shared_test.go pkg/ai/tools/atmos/secret_list.go pkg/ai/tools/atmos/secret_list_test.go; do
if [ -f "$file" ]; then
echo "===== $file ====="
rg -n -C 5 'AtmosYamlFuncExec|skip|Skip|Process|yaml' "$file" || true
fi
done
echo "===== Definitions and call sites ====="
rg -n -C 4 'AtmosYamlFuncExec|func.*[Ss]kip|[Ss]kip.*func|skip.*functions' \
-g '*.go' . || trueLength of output: 175509
The issue is narrower than I stated. Secret and inventory enumeration are intended to inspect declarations without resolving credentials or evaluating side-effecting YAML functions. Those paths already skip This patch does not disable My “arbitrary command execution vulnerability” wording was too broad. The relevant concern is unintended command execution during a non-execution operation. You are interacting with an AI system. |
|
CodeRabbit (@coderabbitai) I agree with the stated concern, but this is a policy based concern. Controlling when |
|
Tip For best results, initiate chat on the files or code changes.
The patch is appropriate only if list and secret-enumeration operations explicitly guarantee that they never evaluate I do not consider the unconditional skip a generally safe correctness change without that contract. 🐇 ✏️ Learnings added
You are interacting with an AI system. |
|
CodeRabbit (@coderabbitai) give me an example of how/where list and secret-enumeration operations explicitly could use !exec. Maybe it makes sense to disable, but it's too abstract/opaque to comprehend without an example. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
for file in cmd/list/utils.go cmd/secret/shared.go pkg/ai/tools/atmos/secret_list.go; do
echo "===== OUTLINE: $file ====="
ast-grep outline "$file" --items all --type function --view expanded || true
echo
echo "===== MATCHES: $file ====="
rg -n -C 8 'AtmosYamlFuncExec|skipCustom|skip.*Func|Process.*YAML|ProcessYAML|yaml.*Process|secret|inventory' "$file" || true
echo
done
echo "===== YAML FUNCTION DEFINITIONS / EVALUATION CALLS ====="
rg -n -C 5 'AtmosYamlFuncExec|func.*Exec|!exec|Process.*Yaml|Process.*YAML|Process.*Config' -g '*.go' . || trueLength of output: 200949 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "===== Target-file matches ====="
rg -n -C 12 'AtmosYamlFuncExec|ProcessCustomYamlTags|ExecuteDescribeComponent|skip' \
cmd/list/utils.go \
cmd/secret/shared.go \
pkg/ai/tools/atmos/secret_list.go \
cmd/secret/shared_test.go \
pkg/ai/tools/atmos/secret_list_test.go || true
echo "===== Target-file function map ====="
for file in cmd/list/utils.go cmd/secret/shared.go pkg/ai/tools/atmos/secret_list.go; do
echo "--- $file ---"
ast-grep outline "$file" --items all --type function --view expanded || true
done
echo "===== Existing !exec examples in relevant areas ====="
rg -n -C 8 '!exec|AtmosYamlFuncExec' \
cmd/list cmd/secret pkg/ai/tools/atmos tests/fixtures \
-g '*.go' -g '*.yaml' -g '*.yml' || true
echo "===== YAML tag handler ====="
rg -n -C 10 'func ProcessCustomYamlTags\b|func.*AtmosYamlFuncExec\b|AtmosYamlFuncExec\s*=' \
internal pkg -g '*.go' || trueLength of output: 45191
For example, a stack can contain: components:
terraform:
app:
vars:
aws_profile: !exec ./scripts/select-aws-profile.sh
secrets:
vars:
API_TOKEN:
sops:
file: secrets/app.yaml
path: /api_tokenWithout this patch, This is not hypothetical evaluation behavior. The repository has fixtures with However, I found no existing fixture or code path that requires Your bootstrap case could be valid for a secret operation that resolves a secret provider, for example if a provider configuration obtains a credential through
So the important distinction is:
That makes the change reasonable if the intended contract is “secret declarations must be static.” It is too broad if secret provider configuration is expected to support command-based bootstrap. You are interacting with an AI system. |
what
This patch addresses an arbitrary command execution vulnerability in secret enumeration and list inventory operations by ensuring the !exec YAML tag is properly skipped when credentials are unavailable. The !exec function was missing from credential-free skip lists, allowing potentially malicious YAML configurations to execute arbitrary commands during enumeration. The fix adds AtmosYamlFuncExec to all relevant skip lists across cmd/list/utils.go, cmd/secret/shared.go, cmd/secret/shared_test.go, pkg/ai/tools/atmos/secret_list.go, and pkg/ai/tools/atmos/secret_list_test.go, ensuring consistent security posture across all secret and inventory listing operations.
why
references