Regular Expressions 101

Community Patterns

gitlab-push-rules-prohibited-file-names-regex

0

Regular Expression
Golang

`
(?m)(.?aws/credentials$|.?chef/(.*).pem$|.?gem/credentials$|.?irssi/config$|.?purple/accounts.xml$|.?recon-ng/keys.db$|.?ssh/config$|.?xchat2?/servlist_?.conf$|.agilekeychain$|.asc$|.bek$|.cscfg$|.dayone$|.exports|.extra|.functions|.fve$|.gnucash$|.jks$|.keychain$|.kwallet$|.log$|.mdf$|.ovpn$|.p12$|.pcap$|.pem$|.pfx$|.pkcs12$|.psafe3$|.rdp$|.sdf$|.sqlite$|.tblk$|.tpm$|Favorites.plist|LocalSettings.php|^(.|_)?netrc$|^.*_dsa$|^.*_ecdsa$|^.*_ed25519$|^.*_rsa$|^.?(bash_|zsh_)?aliases$|^.?(bash_|zsh_)?profile$|^.?(bash_|zsh_|sh_|z)?history$|^.?(bash|zsh|csh)rc$|^.?dbeaver-data-sources.xml$|^.?dockercfg$|^.?env$|^.?git-credentials$|^.?gitconfig$|^.?gitrobrc$|^.?htpasswd$|^.?irb_history$|^.?muttrc$|^.?mysql_history$|^.?npmrc$|^.?pgpass$|^.?psql_history$|^.?s3cfg$|^.?trc$|^.?tugboat$|^kdbx?$|^key(pair)?$|^key(store|ring)$|^sftp-config(.json)?$|^sql(dump)?$|carrierwave.rb|config(.inc)?.php$|config/hub$|configuration.user.xpl|credential|credentials.xml|database.yml|doctl/config.yaml$|etc/passwd$|etc/shadow$|filezilla.xml|jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin.xml|journal.txt|knife.rb|omniauth.rb|otr.private_key|password|proftpdpasswd|recentservers.xml|robomongo.json|secret_token.rb|settings.py|terraform.tfvars|ventrilo_srv.ini)
`
gm

Description

GitLab Push Rules

Citation Push rules are essentially pre-receive Git hooks that are easy to enable in a user-friendly interface. They are defined globally if you are an admin or per project so you can have different rules applied to different projects depending on your needs. <sup>1</sup>

Prohibited File Names

GitLab allows Administrators and Maintainers to restrict the kinds of files pushed to a repository. One way of enforcing push rules is via the: Project > Settings > Repository > Push Rules > Prohibited file names text field, where you can enter a concatenated regular expression (using the RE2 syntax).

TL;DR

This RE2 regular expression pattern is for testing GitLab Push Rules using GitLab's Project > Settings > Repository > Push Rules > Prohibited file names text field.

References

<a name="ref-gl-push-rules-docs"></a> [1]: Push Rules. (2019) | GitLab. Retrieved March 04, 2019, from https://docs.gitlab.com/ee/push_rules/push_rules.html

Submitted by gregswindle - 5 years ago