Conversation
Replace bcrypt token hashing with configurable FIPS-approved algorithms (HMAC-SHA256, PBKDF2-SHA256) to support deployments on FIPS-enabled hosts (e.g., RHEL 9 in FIPS mode). Existing bcrypt hashes remain verifiable for backward compatibility via automatic prefix detection. Key changes: - Configurable token hashing: TOKEN_HASH_ALGORITHM setting with hmac-sha256 (default), pbkdf2-sha256, and bcrypt options - Redis TLS configuration: SSL CA certs, client certs (mTLS), cert requirements, and minimum TLS version settings - FIPS diagnostics: new fips.py module, `agent-memory fips-check` CLI command, and authenticated GET /v1/fips endpoint - hashlib safety: added usedforsecurity=False to non-security SHA-256 calls - FIPS Docker images: Dockerfile.fips with UBI 9 and Chainguard FIPS targets - Bumped cryptography>=42.0.0 for OpenSSL 3.x FIPS provider support - 24 new FIPS compliance tests covering all crypto boundaries
There was a problem hiding this comment.
FIPS compliance implementation looks solid overall with good test coverage and backward compatibility. A few security considerations identified below.
🤖 Automated review complete. Please react with 👍 or 👎 on the individual review comments to provide feedback on their usefulness.
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
There was a problem hiding this comment.
Pull request overview
This PR adds FIPS 140-3 compliance support to the Agent Memory Server, enabling deployment in federal and regulated environments requiring FedRAMP compliance. The changes make the system "FIPS-capable" by switching from non-approved algorithms (bcrypt/Blowfish) to FIPS-approved alternatives (HMAC-SHA256, PBKDF2-SHA256) and adding configurable Redis TLS settings.
Changes:
- Introduces configurable token hashing with HMAC-SHA256 as the new default (replacing bcrypt), with backward compatibility for existing bcrypt hashes
- Adds Redis TLS configuration options (ca_certs, certfile, keyfile, cert_reqs, min_version)
- Provides FIPS diagnostics via new CLI command (
fips-check) and authenticated API endpoint (GET /v1/fips)
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Updates cryptography minimum version to 42.0.0 for FIPS provider support |
| pyproject.toml | Updates cryptography minimum version to 42.0.0 for FIPS provider support |
| agent_memory_server/auth.py | Implements multi-algorithm token hashing with auto-detection; adds HMAC-SHA256 and PBKDF2-SHA256 support |
| agent_memory_server/config.py | Adds token hashing and Redis TLS configuration settings |
| agent_memory_server/utils/redis.py | Implements TLS kwargs builder for Redis connections based on URL scheme and settings |
| agent_memory_server/utils/recency.py | Adds usedforsecurity=False flag to SHA-256 calls used for deduplication |
| agent_memory_server/fips.py | New module providing FIPS compliance diagnostics (OpenSSL version, kernel FIPS mode, algorithm checks) |
| agent_memory_server/cli.py | Adds fips-check CLI command for runtime FIPS posture assessment |
| agent_memory_server/healthcheck.py | Adds authenticated /v1/fips endpoint for FIPS diagnostics |
| tests/test_fips_compliance.py | Comprehensive test suite covering token hashing algorithms, Redis TLS, and FIPS diagnostics |
| tests/test_token_auth.py | Updates tests for new default HMAC-SHA256 algorithm |
| Dockerfile.fips | New multi-target Dockerfile for FIPS-hardened images (UBI9 and Chainguard variants) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix HMAC verification to compute inline instead of calling hash_token(), avoiding dependency on current token_hash_algorithm setting - Embed iteration count in PBKDF2 hash format (pbkdf2$iterations$salt$hash) so tokens remain valid when iteration count is changed - Add explicit parts validation for PBKDF2 hash parsing - Reject default TOKEN_HASH_SECRET in verify_auth_config() when using hmac-sha256 with token auth enabled - Map redis_ssl_cert_reqs string values to ssl.CERT_* enum constants - Broaden fips.py exception handling (OSError), fix TLS detection to include redis_ssl_ca_certs - Dockerfile.fips: pin image tags, fix cache mount paths for non-root user, remove ENV vars that triggered Jit false positives - Add tests for iteration-change backward compat, algorithm-switch compat, TLS detection via CA certs, and default secret rejection
tylerhutcherson
left a comment
There was a problem hiding this comment.
Looks good in terms of providing Redis TLR and hashing algorithm updates. A few other questions/points:
@bsbodden We need documentation on connecting AMS to Redis w/ SSL enabled. This is something ideally we test before we hand over to customers too.
Do we need to maintain both Docker images?
|
Summary
Add FIPS 140-3 compliance support so AMS can be deployed on FIPS-enabled hosts (e.g., RHEL 9 in FIPS mode) for federal government and regulated-industry deployments requiring FedRAMP compliance.
Problem: The existing
bcrypttoken hashing uses the Blowfish cipher, which is not a FIPS-approved algorithm. Redis connections lack explicit TLS configuration knobs needed for FIPS-compliant data-in-transit.Solution: Make AMS "FIPS-capable" — when deployed on a FIPS-enabled host with the FIPS Docker image, all cryptographic operations use FIPS-approved algorithms via the host's validated OpenSSL module.
Changes
auth.py,config.py): NewTOKEN_HASH_ALGORITHMsetting supportinghmac-sha256(default),pbkdf2-sha256, andbcrypt. Existing bcrypt hashes auto-detected and verified for backward compatibility via hash prefix detection (hmac$,pbkdf2$,$2b$).config.py,utils/redis.py): New settings forREDIS_SSL_CA_CERTS,REDIS_SSL_CERTFILE,REDIS_SSL_KEYFILE,REDIS_SSL_CERT_REQS, andREDIS_SSL_MIN_VERSION. TLS kwargs automatically applied when usingrediss://URLs or when CA certs are configured.fips.py,cli.py,healthcheck.py): Newagent-memory fips-checkCLI command and authenticatedGET /v1/fipsendpoint that report OpenSSL version, kernel FIPS mode, MD5 blocked status, configured token hash algorithm, Redis TLS status, and overall FIPS capability assessment.utils/recency.py): Addedusedforsecurity=Falseto SHA-256 calls used for deduplication (not security), preventing potential issues on strict FIPS OpenSSL configurations.Dockerfile.fips): Multi-target Dockerfile withfips-ubi9(Red Hat UBI 9) andfips-chainguardtargets. ExistingDockerfileunchanged.pyproject.toml): Minimum version raised to>=42.0.0for proper OpenSSL 3.x FIPS provider support.Crypto boundary coverage
Backward compatibility
hmac-sha256butbcryptremains availableDockerfileor default non-FIPS deployment behaviorTest plan
tests/test_fips_compliance.py)Dockerfile.fips --target fips-ubi9on FIPS-enabled hostGET /v1/fipsendpoint returns correct diagnostics on FIPS hostagent-memory fips-checkCLI output on FIPS hostNote
High Risk
Changes core token authentication hashing behavior (new default and new verification paths) and adds Redis TLS configuration, which can impact login validity and connectivity if misconfigured. Also introduces new FIPS diagnostic surfaces (CLI + authenticated API) that need to be reviewed for information exposure and operational expectations.
Overview
Adds a FIPS-capable deployment path by introducing
Dockerfile.fips(UBI9 + Chainguard targets) and bumpingcryptographyto>=42.0.0for OpenSSL 3.x/FIPS provider support.Reworks token hashing to be configurable via
settings.token_hash_algorithmwith new FIPS-friendly schemes (hmac-sha256default,pbkdf2-sha256, plusbcrypt), and updates verification to auto-detect hash formats by prefix for backward compatibility.Adds Redis TLS knobs (
redis_ssl_*) and applies them automatically inget_redis_conn()when usingrediss://or when CA certs are configured; also adds FIPS diagnostics viaagent-memory fips-checkand an authenticatedGET /v1/fipsendpoint, plus test coverage for hashing/TLS/diagnostics andusedforsecurity=Falsefor SHA-256 used in non-security memory dedupe.Written by Cursor Bugbot for commit 898fcc2. This will update automatically on new commits. Configure here.