🛡️ Sentinel: [HIGH] Fix regex newline injection in publish flow#112
🛡️ Sentinel: [HIGH] Fix regex newline injection in publish flow#112calionauta wants to merge 1 commit into
Conversation
Replaced '$' with '\Z' in internal '_is_valid_skill_name' validators within the publish subpackage to prevent trailing newline injection. Added security regression tests in 'tests/test_publish_security_remediation.py'. Co-authored-by: renatocaliari <1719651+renatocaliari@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Code Review
This pull request fixes a security regression by updating the regex pattern in _is_valid_skill_name to use the \Z anchor instead of $ in both local_source.py and external_source.py, preventing newline injection. It also adds corresponding unit tests and documents the regression in .jules/sentinel.md. The reviewer suggests consolidating these duplicate validation functions into a single shared validator in src/agent_sync/validators.py to align with the prevention guidelines documented in the sentinel file.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| # Use \Z instead of $ to prevent newline injection | ||
| pattern = r'^[a-z][a-z0-9]*(-[a-z0-9]+)*\Z' |
There was a problem hiding this comment.
The prevention section in .jules/sentinel.md correctly highlights that duplicating security-critical validation logic is a major source of regressions and recommends consolidating it into a single source of truth. However, this PR still maintains two identical implementations of _is_valid_skill_name in local_source.py and external_source.py.
To prevent future regressions and adhere to the project's own guidelines, please consolidate this validation logic:
- Define a new validator (e.g.,
validate_publish_skill_name(name: str) -> bool) insrc/agent_sync/validators.py. - Import and use this central validator in both
src/agent_sync/publish/local_source.pyandsrc/agent_sync/publish/external_source.py.
🚨 Severity: HIGH
💡 Vulnerability: Internal
_is_valid_skill_namefunctions in thepublishflow were using the vulnerable$anchor in regex patterns.🎯 Impact: This allowed skill names with trailing newlines to bypass validation, potentially leading to command or argument injection if these names were used in shell operations.
🔧 Fix: Replaced the
$anchor with\Zinsrc/agent_sync/publish/local_source.pyandsrc/agent_sync/publish/external_source.pyto ensure absolute end-of-string matching.✅ Verification: Added
tests/test_publish_security_remediation.pywhich specifically tests for newline injection. All 567 project tests passed.PR created automatically by Jules for task 7896769534845444974 started by @renatocaliari