Skip to content
Snippets Groups Projects
Commit cfa5ce51 authored by Jörg Sachse's avatar Jörg Sachse
Browse files

chore: improve commit hook IP-Regex to reduce false positives

parent 7e56cd3d
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
#!/usr/bin/env bash
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
......@@ -103,7 +103,7 @@ echo "SUCCESS: URL detection stage."
### IP address detection stage
# This is pretty basic regex matching, but it's a start.
IP_REGEX='[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'
IP_REGEX='[^:alpha:\-/][0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}'
${GREP_CMD} ${GREP_EXCLUDES} -e "${IP_REGEX}" "${REPOPATH}" | grep -v "127.0.0"
if [[ ${?} -eq 0 ]]; then
echo "ERROR: found IP address."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment