Skip to content

🛡️ Sentinel: [MEDIUM] Fix control character injection in schemas - #701

Closed
seonghobae wants to merge 1 commit into
mainfrom
jules/sentinel-fix-control-chars-schemas-10293526622766420780
Closed

🛡️ Sentinel: [MEDIUM] Fix control character injection in schemas#701
seonghobae wants to merge 1 commit into
mainfrom
jules/sentinel-fix-control-chars-schemas-10293526622766420780

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

🚨 Severity: MEDIUM
💡 Vulnerability: User-provided string fields in Pydantic request models (like project names, schema names, and API key names) lacked strict validation against ASCII control characters, only relying on string length constraints.
🎯 Impact: If left unvalidated, injecting control characters (like null bytes, tabs, or carriage returns) into these fields could lead to log injection (CRLF injection), terminal spoofing, or unexpected downstream parsing behavior when interacting with databases or system logs.
🔧 Fix: Implemented explicit regex validation pattern=r"^[^\x00-\x1F\x7F]+$" across multiple string fields in backend/app/schemas.py (DiagramViewCreateIn.name, TableAnnotationUpsertIn.schema_name, TableAnnotationUpsertIn.relation_name, and ApiKeyCreateIn.key_name) to strictly reject any ASCII control characters.
Verification:

  • Executed cd backend && uv run pytest ensuring no regression in test coverage.
  • Ran cd backend && uv run ruff check . ensuring no linting issues were introduced.
  • Verified that only schemas.py was modified and changes are well under the 50 lines constraint.

PR created automatically by Jules for task 10293526622766420780 started by @seonghobae

Summary by CodeRabbit

  • 버그 수정
    • 다이어그램 보기 이름, 테이블 주석의 스키마·관계 이름, API 키 이름에 제어 문자 및 DEL 문자가 포함되지 않도록 입력 검증을 강화했습니다.
    • 기존 필수 입력 및 글자 수 제한은 유지됩니다.

This patch mitigates a potential log/terminal injection vulnerability by
strictly rejecting ASCII control characters from user-provided identifier
and name strings in FastAPI request schemas using a regex pattern.
@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.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

backend/app/schemas.py의 네 입력 필드에 제어 문자와 DEL 문자를 거부하는 정규식 검증을 추가했습니다. 기존 필수값 및 길이 제한은 유지됩니다.

Changes

입력 스키마 검증

Layer / File(s) Summary
입력 필드 정규식 검증
backend/app/schemas.py
DiagramViewCreateIn.name, TableAnnotationUpsertIn.schema_name, TableAnnotationUpsertIn.relation_name, ApiKeyCreateIn.key_name이 제어 문자와 DEL 문자를 거부합니다. 기존 길이 제한과 필수값 검증은 유지됩니다.

Estimated code review effort: 1 (간단) | ~5분

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 스키마의 제어 문자 주입 방지라는 주요 변경 사항을 정확하게 설명합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jules/sentinel-fix-control-chars-schemas-10293526622766420780

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
backend/app/schemas.py (1)

193-193: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

새 정규식 동작에 대한 집중 테스트를 추가하세요.

이 변경은 네 입력 필드의 거부 동작을 변경합니다. 제공된 PR 목표에는 backend/app/schemas.py만 수정된 것으로 되어 있어, 새 검증을 직접 확인하는 테스트 변경이 보이지 않습니다.

각 필드에 \x00, \x1F, \x7F, 탭, 캐리지 리턴, 줄바꿈이 포함된 값이 ValidationError를 발생시키는지 테스트하세요. 일반 Unicode 값과 최소·최대 길이 경계도 유지되는지 확인하세요. TableAnnotationUpsertIn 테스트에는 유효한 body를 함께 제공하세요.

As per coding guidelines: **/*.{py,ts,tsx}: 동작 변경 시 집중 테스트를 추가하거나 갱신해야 합니다.

Also applies to: 217-218, 305-305

🤖 Prompt for 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.

In `@backend/app/schemas.py` at line 193, 새 정규식 검증을 확인하는 집중 테스트를 추가하세요. 해당 네 입력
필드에 NUL(\x00), \x1F, DEL(\x7F), 탭, 캐리지 리턴, 줄바꿈이 포함되면 ValidationError가 발생하는지
검증하고, 일반 Unicode 값과 최소·최대 길이 경계의 유효성은 유지되는지 확인하세요. TableAnnotationUpsertIn
테스트에서는 유효한 body를 함께 제공하세요.

Source: Coding guidelines

🤖 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.

Nitpick comments:
In `@backend/app/schemas.py`:
- Line 193: 새 정규식 검증을 확인하는 집중 테스트를 추가하세요. 해당 네 입력 필드에 NUL(\x00), \x1F,
DEL(\x7F), 탭, 캐리지 리턴, 줄바꿈이 포함되면 ValidationError가 발생하는지 검증하고, 일반 Unicode 값과 최소·최대
길이 경계의 유효성은 유지되는지 확인하세요. TableAnnotationUpsertIn 테스트에서는 유효한 body를 함께 제공하세요.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6cecc461-9661-4fb4-86de-93e482ff97f7

📥 Commits

Reviewing files that changed from the base of the PR and between 5b7d8d6 and 7ae2bac.

📒 Files selected for processing (1)
  • backend/app/schemas.py

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 7ae2bacab3bc6d0df6bbf9cebbf8188b07db41e0.

  • Head SHA: 7ae2bacab3bc6d0df6bbf9cebbf8188b07db41e0

  • Workflow run: 30732788459

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend: schemas.py"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend: schemas.py"]
  R1 --> V1["backend tests"]
Loading

@opencode-agent

opencode-agent Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 7ae2bacab3bc6d0df6bbf9cebbf8188b07db41e0
  • Workflow run: 30732788459
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 7ae2bacab3bc6d0df6bbf9cebbf8188b07db41e0.

  • Head SHA: 7ae2bacab3bc6d0df6bbf9cebbf8188b07db41e0

  • Workflow run: 30732788459

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Backend: schemas.py"]
  S1 --> I1["API and service runtime"]
  I1 --> R1["Review risk: Backend: schemas.py"]
  R1 --> V1["backend tests"]
Loading

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #699, which applies the same schema hardening and adds exhaustive valid/invalid input regression coverage plus the multiline annotation-body guard. Consolidating on the tested PR avoids duplicate merge conflicts.

@seonghobae seonghobae closed this Aug 3, 2026
@google-labs-jules

Copy link
Copy Markdown

Closing as superseded by #699, which applies the same schema hardening and adds exhaustive valid/invalid input regression coverage plus the multiline annotation-body guard. Consolidating on the tested PR avoids duplicate merge conflicts.

Understood. Acknowledging that this work is now superseded by #699 and stopping work on this task.

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.

1 participant