From cfa5ce51cf4e3d6d3f1d124f885bd268d4f653e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <Joerg.Sachse@slub-dresden.de> Date: Mon, 21 Dec 2020 11:16:42 +0100 Subject: [PATCH] chore: improve commit hook IP-Regex to reduce false positives --- .githooks/pre-commit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 39148cf..cfd5a55 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -1,4 +1,4 @@ -#!/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." -- GitLab