summaryrefslogtreecommitdiff
path: root/.lefthook/pre-push/security_harness
blob: 89a6d4a608d833a6e107face07fc51423fda8cf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env bash

set -e
shopt -s nocasematch # Enable case-insensitive matching

local_branch="$(git rev-parse --abbrev-ref HEAD)"
security_branch_regex="^security.+"
url="$2"

if [[ $local_branch =~ $security_branch_regex ]] && [[ "$url" != *"gitlab-org/security/"* ]]
then
  echo "Pushing security branches to remotes other than gitlab.com/gitlab-org/security has been disabled!"
  echo "Please read https://gitlab.com/gitlab-org/release/docs/blob/master/general/security/developer.md#do-not-push-to-gitlab-orggitlab"
  echo

  exit 1
fi