fix: clear CodeQL incomplete URL substring sanitization alerts - #6804
Merged
Conversation
Replace hostname substring checks with urlparse hostname matching in RAG DataType classification, and assert the full mocked Stagehand navigate result instead of searching for a URL substring. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
📝 WalkthroughWalkthroughChangesThe pull request tightens GitHub hostname detection and adds coverage for valid and spoofed URLs. It also strengthens Stagehand navigation assertions and makes streaming event tests handle both positional and keyword mock calls. GitHub URL classification
Test assertion reliability
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
from_content lives on DataTypes, not the DataType enum. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
theCyberTech
marked this pull request as ready for review
August 4, 2026 16:38
CI failed when class-level CrewAIEventsBus.emit patches were shadowed by the singleton instance. Patch both the class and crewai_event_bus.emit, and read events from kwargs/args explicitly. Co-authored-by: Rip&Tear <theCyberTech@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/crewai/tests/llms/test_tool_call_streaming.py`:
- Around line 55-60: Update _event_from_emit_call to return the first positional
argument when no keyword event exists, while preserving the existing
second-argument handling for bound calls. Add a test that patches
crewai_event_bus.emit and invokes it with a positional event, verifying both
collectors retain that event.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ab1b157e-3508-4a6a-9959-e9fc7e89c2a0
📒 Files selected for processing (1)
lib/crewai/tests/llms/test_tool_call_streaming.py
joaomdmoura
enabled auto-merge (squash)
August 5, 2026 05:25
joaomdmoura
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes open CodeQL
py/incomplete-url-substring-sanitizationfindings that still match onmain, and unblocks CI flakes in tool-call streaming tests.CodeQL fixes
DataTypes.from_content(lib/crewai-tools/src/crewai_tools/rag/data_types.py)"github.com" in url.netlocwith hostname checks viaurlparse.lib/crewai-tools/tests/tools/stagehand_tool_test.py)CI flake fix
tests/llms/test_tool_call_streaming.pyfailed in CI with empty tool-call event lists (unrelated to the CodeQL changes). The emit mock only patchedCrewAIEventsBus.emiton the class, which can be shadowed by an instance-levelcrewai_event_bus.emit. The fixture now patches both, and event extraction reads kwargs/args explicitly.Validation
pytest lib/crewai-tools/tests/rag/test_data_types.py: 4 passedGITHUB_ACTIONS=true pytest lib/crewai/tests/llms/test_tool_call_streaming.py: 8 passed