-
Notifications
You must be signed in to change notification settings - Fork 0
π‘οΈ Sentinel: [MEDIUM] Fix missing control character validation on schema fields #988
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -190,7 +190,11 @@ class IndexRedundancyOut(BaseModel): | |
| class DiagramViewCreateIn(BaseModel): | ||
| """Request body for saving an ERD canvas view.""" | ||
|
|
||
| name: str = Field(min_length=1, max_length=200) | ||
| name: str = Field( | ||
| min_length=1, | ||
| max_length=200, | ||
| pattern=r"^[^\x00-\x1F\x7F]+$", | ||
| ) | ||
|
Comment on lines
+193
to
+197
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π Maintainability & Code Quality | π‘ Minor | β‘ Quick win λ³κ²½λ νλμ focused validation testsλ₯Ό μΆκ°νμΈμ. κ° λ³κ²½ νλμμ π Affects 1 file
π€ Prompt for AI AgentsSource: Coding guidelines |
||
| # Opaque client layout (node positions, hidden tables, viewport). The API | ||
| # bounds the serialized size in the endpoint to prevent abuse. | ||
| layout_json: dict | ||
|
|
@@ -214,8 +218,16 @@ class DiagramViewDetailOut(DiagramViewOut): | |
| class TableAnnotationUpsertIn(BaseModel): | ||
| """Request body for creating/updating a table annotation.""" | ||
|
|
||
| schema_name: str = Field(min_length=1, max_length=255) | ||
| relation_name: str = Field(min_length=1, max_length=255) | ||
| schema_name: str = Field( | ||
| min_length=1, | ||
| max_length=255, | ||
| pattern=r"^[^\x00-\x1F\x7F]+$", | ||
| ) | ||
| relation_name: str = Field( | ||
| min_length=1, | ||
| max_length=255, | ||
| pattern=r"^[^\x00-\x1F\x7F]+$", | ||
| ) | ||
|
Comment on lines
+221
to
+230
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ποΈ Data Integrity & Integration | π‘ Minor | β‘ Quick win π Supported by static analysisπ Script executed: # Read only the repository guidance that applies to backend Python files and prior scoped learnings.
printf '%s\n' '--- applicable repository guidance ---'
find /tmp/coderabbit-repo-knowledge/contextualwisdomlab-pg-erd-cloud-d2563f2a -path '*/backend*/*.md' -o -path '*/learnings/*.md' 2>/dev/null | sort | while read -r f; do
printf '\n### %s\n' "$f"
cat "$f"
done
printf '%s\n' '--- changed hunk ---'
git diff -- backend/app/schemas.py
printf '%s\n' '--- schemas definitions ---'
cat -n backend/app/schemas.py | sed -n '180,245p'
printf '%s\n' '--- annotation API ---'
cat -n backend/app/api/annotations.py | sed -n '1,145p'
printf '%s\n' '--- directly related symbols and tests ---'
rg -n --glob '!node_modules' --glob '!dist' \
'TableAnnotation|TableAnnotationUpsertIn|schema_name|relation_name|upsert_annotation' \
backend/app backend/tests tests 2>/dev/null | head -250Repository: ContextualWisdomLab/pg-erd-cloud Length of output: 33087 π Script executed: printf '%s\n' '--- TableAnnotation model ---'
cat -n backend/app/models.py | sed -n '210,270p'
printf '%s\n' '--- migration/schema files containing table_annotation ---'
rg -n -C 5 'table_annotation|TableAnnotation|schema_name.*relation_name' \
backend/alembic backend/migrations backend 2>/dev/null | head -260
printf '%s\n' '--- focused annotation tests ---'
cat -n backend/tests/test_api_annotations.py | sed -n '1,180p'
printf '%s\n' '--- schema validation tests and request models ---'
rg -n -C 4 'DiagramViewCreateIn|TableAnnotationUpsertIn|ApiKeyCreateIn|pattern=' \
backend/tests backend/app/schemas.pyRepository: ContextualWisdomLab/pg-erd-cloud Length of output: 34777 π Script executed: printf '%s\n' '--- repository state ---'
git status --short
printf '%s\n' '--- current and parent request-model definitions ---'
for rev in HEAD HEAD^; do
printf '\n### %s\n' "$rev"
git show "$rev:backend/app/schemas.py" 2>/dev/null | nl -ba | sed -n '215,235p' || true
done
printf '%s\n' '--- current commit summary ---'
git log -2 --oneline -- backend/app/schemas.pyRepository: ContextualWisdomLab/pg-erd-cloud Length of output: 507 κΈ°μ‘΄ μ΄λ Έν μ΄μ ν€μ νΈνμ±μ νμΈνμΈμ.
κΈ°μ‘΄ λ°μ΄ν°λ₯Ό κ°μ¬νκ³ , ν΄λΉ νμ΄ μμΌλ©΄ λ§μ΄κ·Έλ μ΄μ λλ νΈνμ± κ²½λ‘λ₯Ό μΆκ°νμΈμ. π€ Prompt for AI Agents |
||
| body: str = Field(min_length=1, max_length=10_000) | ||
|
|
||
|
|
||
|
|
@@ -302,7 +314,11 @@ class DbmlConvertOut(BaseModel): | |
| class ApiKeyCreateIn(BaseModel): | ||
| """Request body for creating an API key.""" | ||
|
|
||
| key_name: str = Field(min_length=1, max_length=128) | ||
| key_name: str = Field( | ||
| min_length=1, | ||
| max_length=128, | ||
| pattern=r"^[^\x00-\x1F\x7F]+$", | ||
| ) | ||
|
|
||
|
|
||
| class ApiKeyOut(BaseModel): | ||
|
|
||
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.
π Info: Trailing-newline anchoring safe under default regex engine
$in^[^\x00-\x1F\x7F]+$matches before a trailing newline under Pythonre, which would let"foo\n"pass. Pydantic v2 defaults to the Rust regex engine where$is end-of-text, and noregex_engineoverride exists, so no bypass. Consistent with prior use inProjectCreateInandConnectionCreateIn.Was this helpful? React with π or π to provide feedback.