-
Notifications
You must be signed in to change notification settings - Fork 548
fix(jailbreak): handle URL joining with/without trailing slashes #1346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes URL joining logic in NIM jailbreak detection to properly handle base URLs and classification paths with various combinations of trailing and leading slashes.
- Introduces a new
join_nim_url()
helper function to normalize URL joining behavior - Updates
jailbreak_nim_request()
to use the new URL joining function instead of directurljoin
- Adds comprehensive test coverage for all possible slash combinations in URL paths
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
File | Description |
---|---|
nemoguardrails/library/jailbreak_detection/request.py | Adds join_nim_url() helper function and updates jailbreak_nim_request() to use normalized URL joining |
tests/test_jailbreak_request.py | Updates tests to use new helper function and adds comprehensive test cases for all slash combinations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1346 +/- ##
===========================================
+ Coverage 71.04% 71.05% +0.01%
===========================================
Files 162 162
Lines 16398 16402 +4
===========================================
+ Hits 11650 11655 +5
+ Misses 4748 4747 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Fix URL joining in NIM jailbreak detection to handle base URLs with/without trailing slashes and classification paths with/without leading slashes.
join_nim_url()
helper functionjailbreak_nim_request()
to use normalized URL joining