Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Commit 3d4a22f

Browse files
committed
fix: use multiline for regex
1 parent 3fabfba commit 3d4a22f

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

.pre-commit-hooks.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- id: forbid-secrets
2-
name: Check for unencrypted Kubernetes secrets in manifest files
2+
name: Check for unencrypted Kubernetes secrets in manifests
33
description: "Forbid files containing unencrypted Kubernetes secrets to be commited"
44
entry: forbid_secrets
55
language: python

README.md

+1-5
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,11 @@ Add the following to your `.pre-commit-config.yaml`
1717

1818
```yaml
1919
- repo: https://github.com/k8s-at-home/sops-pre-commit
20-
rev: v2.0.2
20+
rev: v2.0.3
2121
hooks:
2222
- id: forbid-secrets
2323
```
2424
2525
## License
2626
2727
This software is licensed under the MIT license (see the LICENSE file).
28-
29-
## Credits
30-
31-
[angelnu](https://github.com/angelnu/k8s-gitops/)

hooks/forbid_secrets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
def contains_secret(filename):
1111
with open(filename, mode="r") as file_checked:
1212
lines = file_checked.read()
13-
kubernetes_secret = re.findall(SECRET_REGEX, lines, re.IGNORECASE)
13+
kubernetes_secret = re.findall(SECRET_REGEX, lines, flags=re.IGNORECASE | re.MULTILINE)
1414
if kubernetes_secret:
15-
sops_secret = re.findall(SOPS_REGEX, lines, re.IGNORECASE)
15+
sops_secret = re.findall(SOPS_REGEX, lines, flags=re.IGNORECASE | re.MULTILINE)
1616
if not sops_secret:
1717
return True
1818
return False

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
name='sops-pre-commit',
55
description='Check for unencrypted Kubernetes secrets in manifest files',
66
url='https://github.com/k8s-at-home/sops-pre-commit',
7-
version='2.0.1',
7+
version='2.0.3',
88

99
author='Devin Buhl',
1010
author_email='[email protected]',

0 commit comments

Comments
 (0)