Fix: Check vault encryption header instead of decrypting files
Some checks failed
CI / lint-and-test (push) Successful in 54s
CI / ansible-validation (push) Successful in 2m20s
CI / secret-scanning (push) Successful in 1m26s
CI / dependency-scan (push) Failing after 1m21s
CI / sast-scan (push) Successful in 2m4s
CI / license-check (push) Successful in 53s
CI / vault-check (push) Successful in 2m0s
CI / playbook-test (push) Successful in 1m56s
CI / container-scan (push) Failing after 1m13s
Some checks failed
CI / lint-and-test (push) Successful in 54s
CI / ansible-validation (push) Successful in 2m20s
CI / secret-scanning (push) Successful in 1m26s
CI / dependency-scan (push) Failing after 1m21s
CI / sast-scan (push) Successful in 2m4s
CI / license-check (push) Successful in 53s
CI / vault-check (push) Successful in 2m0s
CI / playbook-test (push) Successful in 1m56s
CI / container-scan (push) Failing after 1m13s
This commit is contained in:
parent
6d14cf9253
commit
67a9b3ca2b
@ -213,15 +213,22 @@ jobs:
|
||||
echo "No vault files found"
|
||||
exit 0
|
||||
fi
|
||||
failed=0
|
||||
for vault_file in $vault_files; do
|
||||
echo "Checking $vault_file..."
|
||||
if ansible-vault view "$vault_file" > /dev/null 2>&1; then
|
||||
echo "✓ $vault_file is properly encrypted"
|
||||
# Check if file starts with ANSIBLE_VAULT header (doesn't require password)
|
||||
if head -n 1 "$vault_file" | grep -q "^\$ANSIBLE_VAULT"; then
|
||||
echo "✓ $vault_file is properly encrypted (has vault header)"
|
||||
else
|
||||
echo "✗ ERROR: $vault_file appears to be unencrypted or invalid"
|
||||
exit 1
|
||||
echo "✗ ERROR: $vault_file does not have ANSIBLE_VAULT header - may be unencrypted!"
|
||||
failed=1
|
||||
fi
|
||||
done
|
||||
if [ $failed -eq 1 ]; then
|
||||
echo "Some vault files are not encrypted. Please encrypt them with: ansible-vault encrypt <file>"
|
||||
exit 1
|
||||
fi
|
||||
echo "All vault files are properly encrypted!"
|
||||
|
||||
playbook-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user