Repository navigation
fix(crewai): replace MD5 with SHA-256 for deterministic run IDs (VULN-115244) - #288
Conversation
…-115244) Co-Authored-By: Claude Code <noreply@anthropic.com>
etserend
left a comment
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-5-5). It may contain mistakes.
Verdict: approve — The one-line swap from MD5 to SHA-256 keeps run IDs deterministic and internally consistent, so CrewAI correlation still works.
Follow-ups
Suggested follow-up work that could be tracked as Jira tickets:
src/splunk_ao/handlers/crewai/handler.py:290-290:_hash_to_uuidbuilds a UUID from raw digest bytes and does not set the version or variant bits. This was also true with MD5.src/splunk_ao/utils/uuid_utils.py:74usesUUID(bytes=digest[:16], version=4)for the same pattern. Passingversion=4, or calling a shared helper, would give RFC 4122-compliant IDs. It would also stop a digest from looking like a UUIDv7 by chance. No current CrewAI path callsconvert_uuid_if_uuid7, so this does not block the change.
Co-Authored-By: Claude Code <noreply@anthropic.com>
etserend
left a comment
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-5-5). It may contain mistakes.
Verdict: approve — The SHA-256 swap removes the MD5 finding and keeps run IDs deterministic, with RFC 4122 version bits now set.
Follow-ups
Suggested follow-up work that could be tracked as Jira tickets:
src/splunk_ao/handlers/crewai/handler.py:288-290:_hash_to_uuidandsrc/splunk_ao/utils/uuid_utils.py:71-74repeat the same SHA-256-to-UUIDv4 logic. Extract a shared helper such asdeterministic_uuid4(value: str)inuuid_utils.py. Both call sites can then use it, so the two derivations cannot drift apart.
…LN-115244) Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
etserend
left a comment
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-5-5). It may contain mistakes.
Verdict: approve — The SHA-256 helper removes the only MD5 use, keeps run IDs deterministic, and keeps uuid7_to_uuid4 output byte-identical.
General Comments
- 🔵 nit (documentation): The PR description is out of date with the branch, which can mislead the human reviewer:
- The Summary does not say that the version and variant bits are now set.
- The Summary does not mention the new shared
deterministic_uuid4helper insrc/splunk_ao/utils/uuid_utils.py:37, or thatuuid7_to_uuid4now calls it. - The test plan reports "92 passed" and only
handler.pylint. That predates commits6efd50danda66ec13, which add a test and touch two more files.
Update the Summary and re-run the test plan on the head commit.
Resolves import conflicts in crewai/handler.py and tests/test_crewai_handler.py against #294 (keep both convert_time_delta_to_ns and deterministic_uuid4; keep asyncio, hashlib and inspect test imports). Co-Authored-By: Claude Code <noreply@anthropic.com>
opikalova
left a comment
There was a problem hiding this comment.
🤖 This review was generated by the Astra agent (claude-opus-5-5). It may contain mistakes.
Verdict: approve — The SHA-256 helper removes the only MD5 use and keeps run IDs deterministic. The CHANGELOG entry now sits under a released version and should move.
General Comments
- 🟡 minor (documentation): Astra found no Jira ticket in the branch name, the title or the description.
- 🔵 nit (documentation): The PR description still does not match the branch. An earlier review raised this, and the text has not changed:
- The Summary says only "the first 16 bytes of a SHA-256 digest". It does not mention the version 4 bits or the shared
deterministic_uuid4helper (src/splunk_ao/utils/uuid_utils.py:37). - The Summary does not say that
uuid7_to_uuid4now calls the helper. - The test plan reports "92 passed" and lint on
handler.pyonly. Commits6efd50danda66ec13came later and touchuuid_utils.py, the tests andCHANGELOG.md.
Update the Summary and test plan for the head commit.
Follow-ups
Suggested follow-up work that could be tracked as Jira tickets:
tests/test_uuid_utils.py:40-49: Add a pinned-value test fordeterministic_uuid4anduuid7_to_uuid4intests/test_uuid_utils.py. The only pinned test istests/test_crewai_handler.py:995. That module is skipped on Python 3.14 (tests/test_crewai_handler.py:18).test_deterministic_conversionchecks only self-consistency and version 4. A change to the shared helper would silently change LangChain run IDs on every version. It would also go untested on 3.14.
…(VULN-115244) Add pinned-value tests for deterministic_uuid4 and uuid7_to_uuid4 so they run on every Python version (the CrewAI module is skipped on 3.14), and move the CrewAI run ID entry from the released 0.6.0 section to Unreleased. Co-Authored-By: Claude Code <noreply@anthropic.com>
|
@opikalova thanks for the review. Addressed in 13229e1 and the updated description:
|
Summary
CrewAIEventListener._hash_to_uuidusedhashlib.md5to derive deterministic UUIDs for event correlation, which Semgrep flags (insecure-hash-algorithm-md5).deterministic_uuid4insplunk_ao/utils/uuid_utils.py. The helper builds a UUID from the first 16 bytes of a SHA-256 digest, with the RFC 4122 version 4 and variant bits set.uuid7_to_uuid4now calls the same helper. Its output is byte-identical to before.CHANGELOG.mdunder[Unreleased].Test plan
poetry run pytest tests/test_uuid_utils.py tests/test_crewai_handler.py -n 0: 6 passed, 121 skipped locally. All 6 passes are intest_uuid_utils.py, including the two new pinned-value tests. The CrewAI module is skipped on Python 3.14, so the CrewAI tests are covered by CI on 3.11-3.13.ruff check --no-fixandruff format --checkclean onuuid_utils.py,crewai/handler.py,tests/test_uuid_utils.pyandtests/test_crewai_handler.py🤖 Generated with Claude Code