[BUG] Compatibility: Support execution on FIPS-enabled Linux kernels (RHEL 9 / Rocky 9)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia cercando nella codebase hashlib.md5, hashlib.sha1, hashlib.new e gli altri algoritmi indicati nell’issue. Ispeziona ogni punto di chiamata per determinare se l’hash viene utilizzato per la sicurezza, quindi verifica la compatibilità con Python 3.9+ e PyPy. Il lavoro è completato quando gli hash appropriati non usati per scopi di sicurezza passano usedforsecurity=False e il comportamento interessato è testato o verificato in un ambiente FIPS-enabled.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Porting OSS to the "Enterprise/Government" RHEL world, a potential issue is that Python's hashlib binds to the system OpenSSL. On RHEL 9 with FIPS mode enabled, OpenSSL will ruthlessly abort any call to a non-validated algorithm (like MD5) unless explicitly told it is not being used for security purposes.
Context
Deploying this project in regulated environments (US Defense / FedRAMP) requires the underlying OS to run in FIPS 140-2/3 mode.
Specifically, when running on RHEL 9 or Rocky Linux 9 (and potentially Amazon Linux 2023) where the kernel is booted with fips=1, the system OpenSSL library disables non-approved cryptographic algorithms.
The Problem
Currently, parts of the codebase might use hashlib.md5() (and possibly other non-FIPS algorithms). In a strict FIPS environment, invoking hashlib.md5() without specific flags causes the Python runtime to crash with a ValueError.
Example Traceback:
ValueError: [digital envelope routines] unsupported
Or in older OpenSSL versions:
ValueError: error:060800A3:digital envelope routines:EVP_DigestInit_ex:disabled for fips
While MD5 is broken for cryptographic security (signatures, collision resistance), it is frequently used for non-security purposes, such as:
- Generating deterministic UUIDs
- Cache keys
- File fingerprinting / ETags
- Internal ID generation
Proposed Solution
Python 3.9+ introduced the usedforsecurity flag in hashlib. We need to audit the codebase and update all instances of non-cryptographic hashing to explicitly flag them.
Before:
m = hashlib.md5(data)
# OR
m = hashlib.new('md5', data)
After:
# explicitly signal to OpenSSL that this is not for security
m = hashlib.md5(data, usedforsecurity=False)
# OR
m = hashlib.new('md5', data, usedforsecurity=False)
Note that in the context of US Government compliance, the flag usedforsecurity=False does not mean "This is insecure." It effectively translates to:
bypass_fips_allowlist=True
or
i_accept_liability_for_using_math_nist_does_not_understand=True
and thus is (in my eyes) badly named (in Python).
Certain cryptographically secure algorithms are simply unknown or too new for NIST (again, professional opinion):
-
BLAKE2 / RIPEMD-160 are not broken. They are just "foreign" or "too new" for NIST. The fact that RHEL crashes on them is a policy enforcement implementation detail, not a security vulnerability in our code.
-
NIST FIPS standards lag behind modern cryptography by 5-10 years. (e.g., They are only just now finalizing PQC, while the industry has moved on). The fact that they force a crash on BLAKE2 (which is arguably safer than the approved SHA-1) is absurd, but it is the reality of the RHEL kernel.
Affected Environments
- Python: CPython 3.11+, PyPy 3.11+
- OS: RHEL 9, Rocky Linux 9, AlmaLinux 9 (UBI 9 images)
- Architecture: x86_64, aarch64
Action Items
- Audit
hashlib.md5usage: Grep the codebase for all instances ofmd5. - Audit
hashlib.sha1usage: SHA-1 is restricted in some newer FIPS profiles for signing, though usually allowed for HMAC. Check ifusedforsecurity=Falseis applicable here as well. - Audit other algorithms: Ensure no usage of ARC4, Blowfish, or RIPEMD, which may be completely removed in FIPS builds regardless of flags.
- Apply Fix: Update calls to use
usedforsecurity=Falsewhere appropriate (targeting Python 3.9+ syntax). - Verify PyPy Compatibility: Ensure PyPy 3.11+ respects this flag or fails gracefully.
- CI/Test: (Optional) Add a test case that mocks a FIPS environment or verifies the flag is passed.
Reference
A quick note on PyPy
PyPy 7.3.11+ (implementing Python 3.9) does support the usedforsecurity argument in the signature to maintain API compatibility, but historically, PyPy's _hashlib implementation was sometimes inconsistent in how it passed that flag down to the C-level OpenSSL EVP_MD_CTX_set_flags.
If running PyPy on RHEL 9, we definitely want to verify this manually. If PyPy ignores the flag and passes the call to a FIPS-locked OpenSSL, it will still crash.
- Lingua principale
- Python
- Stelle
- 2.5k
- Fork
- 769
- Merge medio
- 1g 12h
- PR unite (30g)
- 15
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di crossbario/autobahn-python
-
CI-CD enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
crossbario/autobahn-python#1945 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug CI-CD
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
crossbario/autobahn-python#1932 ·
I maintainer di solito rispondono entro 1 giorno
-
CI-CD enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
crossbario/autobahn-python#1829 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
crossbario/autobahn-python#1983 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
crossbario/autobahn-python#1963 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di crossbario/autobahn-python
Issue simili
-
Consolidate the now-identical CLI-native and composed tasks_packages guards (#5945 follow-up)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
spec-kitty/spec-kitty#6112 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: OpenRouter streaming chunks report the requested router name instead of the model OpenRouter servedForse già presa @Mrun25 l’ha presa oggi. Apertabug llm translation
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
BerriAI/litellm#46095 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
uberdeveloper/fastbt#29 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
andrew-blake/melcloudhome#368 ·
I maintainer di solito rispondono entro 1 giorno
-
lane:discover
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SPARDiffData/differential-data-collection#33 ·
I maintainer di solito rispondono entro 1 giorno