Skip to content

Commit b6bb8fb

Browse files
ci: add pre-commit check ensuring FIPS compliance (#3899)
# What does this PR do? this commit adds a new pre-commit hook to scan for non-FIPS compliant function usage within llama-stack Closes #3427 ## Test Plan Ran locally Signed-off-by: Nathan Weinberg <nweinber@redhat.com>
1 parent e809d21 commit b6bb8fb

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.pre-commit-config.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ repos:
152152
files: ^src/llama_stack/ui/.*\.(ts|tsx)$
153153
pass_filenames: false
154154
require_serial: true
155-
156155
- id: check-log-usage
157156
name: Ensure 'llama_stack.log' usage for logging
158157
entry: bash
@@ -171,7 +170,23 @@ repos:
171170
exit 1
172171
fi
173172
exit 0
174-
173+
- id: fips-compliance
174+
name: Ensure llama-stack remains FIPS compliant
175+
entry: bash
176+
language: system
177+
types: [python]
178+
pass_filenames: true
179+
exclude: '^tests/.*$' # Exclude test dir as some safety tests used MD5
180+
args:
181+
- -c
182+
- |
183+
grep -EnH '^[^#]*\b(md5|sha1|uuid3|uuid5)\b' "$@" && {
184+
echo;
185+
echo "❌ Do not use any of the following functions: hashlib.md5, hashlib.sha1, uuid.uuid3, uuid.uuid5"
186+
echo " These functions are not FIPS-compliant"
187+
echo;
188+
exit 1;
189+
} || true
175190
ci:
176191
autofix_commit_msg: 🎨 [pre-commit.ci] Auto format from pre-commit.com hooks
177192
autoupdate_commit_msg: ⬆ [pre-commit.ci] pre-commit autoupdate

0 commit comments

Comments
 (0)