Skip to content

🛡️ Sentinel: [MEDIUM] Fix missing control character validation on string fields#632

Open
seonghobae wants to merge 1 commit into
mainfrom
sentinel-pydantic-control-chars-15806007142473192258
Open

🛡️ Sentinel: [MEDIUM] Fix missing control character validation on string fields#632
seonghobae wants to merge 1 commit into
mainfrom
sentinel-pydantic-control-chars-15806007142473192258

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

🚨 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

@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings July 24, 2026 02:09

Copilot AI left a comment

Copy link
Copy Markdown

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 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 to DiagramViewCreateIn.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.

Comment thread backend/app/schemas.py
Comment on lines +193 to +197
name: str = Field(
min_length=1,
max_length=200,
pattern=r"^[^\x00-\x1F\x7F]+$",
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants