-
Notifications
You must be signed in to change notification settings - Fork 0
π‘οΈ Sentinel: [MEDIUM] Fix missing control character validation in Pydantic schemas #980
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 |
|---|---|---|
|
|
@@ -37,3 +37,27 @@ def test_conn_name_rejects_control_characters() -> None: | |
| ConnectionCreateIn(conn_name="my\x00conn", dsn="postgresql://localhost/db") | ||
| with pytest.raises(ValidationError): | ||
| ConnectionCreateIn(conn_name="my\nconn", dsn="postgresql://localhost/db") | ||
|
|
||
| from app.schemas import ApiKeyCreateIn, DiagramViewCreateIn, TableAnnotationUpsertIn | ||
|
|
||
| def test_diagram_view_create_in_rejects_control_characters() -> None: | ||
| with pytest.raises(ValidationError): | ||
| DiagramViewCreateIn(name="View\nNewline", layout_json={}) | ||
| with pytest.raises(ValidationError): | ||
| DiagramViewCreateIn(name="View\x00Null", layout_json={}) | ||
|
|
||
| def test_table_annotation_upsert_in_rejects_control_characters() -> None: | ||
| with pytest.raises(ValidationError): | ||
| TableAnnotationUpsertIn( | ||
| schema_name="schema\n", relation_name="valid_table", body="some body" | ||
|
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. π Info: Trailing-newline rejection depends on rust-regex anchoring The Was this helpful? React with π or π to provide feedback. |
||
| ) | ||
| with pytest.raises(ValidationError): | ||
| TableAnnotationUpsertIn( | ||
| schema_name="valid_schema", relation_name="table\x00", body="some body" | ||
| ) | ||
|
|
||
| def test_api_key_create_in_rejects_control_characters() -> None: | ||
| with pytest.raises(ValidationError): | ||
| ApiKeyCreateIn(key_name="Key\nNewline") | ||
| with pytest.raises(ValidationError): | ||
| ApiKeyCreateIn(key_name="Key\x00Null") | ||
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.
π Maintainability & Code Quality | π‘ Minor | β‘ Quick win
보μ κΈ°λ‘μ μ μ© λ²μλ₯Ό μ€μ λ³κ²½ λ²μλ‘ μ’νμΈμ.
Line 9μ
all Pydantic string fieldsλ μ΄λ² λ³κ²½κ³Ό μΌμΉνμ§ μμ΅λλ€. μ΄λ² λ³κ²½μ λ€ κ°μ μ§μ λ νλλ§ λμμΌλ‘ νλ©°, μ 곡λ μ€ν€λ§μTableAnnotationUpsertIn.bodyκ°μ λ¬Έμμ΄ νλλ μ΄ ν¨ν΄μ μ¬μ©νμ§ μμ΅λλ€.all affected fieldsλ‘ μμ νκ±°λ λμ νλλ₯Ό μ΄κ±°νμΈμ. κ·Έλ μ§ μμΌλ©΄ μ 체 λ¬Έμμ΄ νλκ° λ³΄νΈλ κ²μΌλ‘ μ€ν΄ν μ μμ΅λλ€.π€ Prompt for AI Agents