Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set IFS when calling provider commands #30

Merged
merged 1 commit into from
Jun 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git-secrets
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ load_patterns() {
git config --get-all secrets.patterns
# Execute each provider and use their output to build up patterns
git config --get-all secrets.providers | while read cmd; do
echo "$($cmd)"
echo "$(export IFS=$'\n\t '; $cmd)"
done
}

Expand Down
14 changes: 14 additions & 0 deletions test/pre-commit.bats
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,17 @@ load test_helper
run git commit -m 'This is also fine'
[ $status -eq 0 ]
}

@test "Rejects commits with prohibited patterns in changeset when AWS provider is enabled" {
setup_bad_repo
repo_run git-secrets --install $TEST_REPO
repo_run git-secrets --register-aws $TEST_REPO
cd $TEST_REPO
run git commit -m 'Contents are bad not the message'
[ $status -eq 1 ]
echo "${lines}" | grep -vq 'git secrets --aws-provider: command not found'

[ "${lines[0]}" == "data.txt:1:@todo more stuff" ]
[ "${lines[1]}" == "failure1.txt:1:another line... forbidden" ]
[ "${lines[2]}" == "failure2.txt:1:me" ]
}