Skip to content

Commit c97cc2c

Browse files
authored
Merge pull request #59 from mbacchi/stderr
Fix issue #58, errors should be directed to stderr
2 parents b10e08e + f82875e commit c97cc2c

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

git-secrets

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ process_output() {
132132
local allowed=$(load_allowed)
133133
case "$status" in
134134
0)
135-
[ -z "${allowed}" ] && echo "${output}" && return 1
135+
[ -z "${allowed}" ] && echo "${output}" >&2 && return 1
136136
# Determine with a negative grep if the found matches are allowed
137-
echo "${output}" | GREP_OPTIONS= LC_ALL=C grep -Ev "${allowed}" \
137+
echo "${output}" | GREP_OPTIONS= LC_ALL=C grep -Ev "${allowed}" >&2 \
138138
&& return 1 || return 0
139139
;;
140140
1) return 0 ;;
@@ -147,16 +147,16 @@ process_output() {
147147
scan_with_fn_or_die() {
148148
local fn="$1"; shift
149149
$fn "$@" && exit 0
150-
echo
151-
echo "[ERROR] Matched one or more prohibited patterns"
152-
echo
153-
echo "Possible mitigations:"
154-
echo "- Mark false positives as allowed using: git config --add secrets.allowed ..."
155-
echo "- Mark false positives as allowed by adding regular expressions to .gitallowed at repository's root directory"
156-
echo "- List your configured patterns: git config --get-all secrets.patterns"
157-
echo "- List your configured allowed patterns: git config --get-all secrets.allowed"
158-
echo "- List your configured allowed patterns in .gitallowed at repository's root directory"
159-
echo "- Use --no-verify if this is a one-time false positive"
150+
echo >&2
151+
echo "[ERROR] Matched one or more prohibited patterns" >&2
152+
echo >&2
153+
echo "Possible mitigations:" >&2
154+
echo "- Mark false positives as allowed using: git config --add secrets.allowed ..." >&2
155+
echo "- Mark false positives as allowed by adding regular expressions to .gitallowed at repository's root directory" >&2
156+
echo "- List your configured patterns: git config --get-all secrets.patterns" >&2
157+
echo "- List your configured allowed patterns: git config --get-all secrets.allowed" >&2
158+
echo "- List your configured allowed patterns in .gitallowed at repository's root directory" >&2
159+
echo "- Use --no-verify if this is a one-time false positive" >&2
160160
exit 1
161161
}
162162

0 commit comments

Comments
 (0)