🛡️ Sentinel: [MEDIUM] Fix missing control character validation on string fields#632
🛡️ Sentinel: [MEDIUM] Fix missing control character validation on string fields#632seonghobae wants to merge 1 commit into
Conversation
|
👋 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.
Pull request overview
This PR hardens backend request-schema validation by rejecting ASCII control characters in several user-provided string fields, reducing the risk of log/terminal injection and other downstream handling issues.
Changes:
- Added
pattern=r"^[^\x00-\x1F\x7F]+$"validation toDiagramViewCreateIn.name. - Added the same control-character validation to
TableAnnotationUpsertIn.schema_name/relation_name. - Added the same control-character validation to
ApiKeyCreateIn.key_name.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: str = Field( | ||
| min_length=1, | ||
| max_length=200, | ||
| pattern=r"^[^\x00-\x1F\x7F]+$", | ||
| ) |
🚨 Severity: MEDIUM
💡 Vulnerability:
Several user-provided string fields in Pydantic schema models (
DiagramViewCreateIn.name,TableAnnotationUpsertIn.schema_name,TableAnnotationUpsertIn.relation_name,ApiKeyCreateIn.key_name) only validated minimum and maximum lengths without restricting control characters. This allowed ASCII control characters (such as \x00 or \n) to be successfully ingested.🎯 Impact:
If these strings were subsequently logged, rendered in specific clients, or executed in unexpected ways, they could be used to facilitate log injection (CRLF forging), terminal escape sequence attacks, or minor cross-site scripting/display issues by bypassing simple string sanitization that assumes printable text.
🔧 Fix:
Added explicit regex validation
pattern=r"^[^\x00-\x1F\x7F]+$"to these fields to explicitly reject non-printable ASCII control characters.✅ Verification:
Ran the full backend test suite (
pytest tests/) to ensure the validation regex successfully passes standard valid inputs without breaking any existing tests or integrations.PR created automatically by Jules for task 15806007142473192258 started by @seonghobae