-
Notifications
You must be signed in to change notification settings - Fork 0
π‘οΈ Sentinel: [HIGH] Fix ERD DDL Injection vulnerability #373
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
Changes from 2 commits
09d50a0
d9e6995
4183be7
581e7b2
dd0fb69
2cdfbcb
d1172dd
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 |
|---|---|---|
|
|
@@ -25,6 +25,12 @@ function assertSnakeCaseIdentifier(kind: string, name: string): void { | |
| } | ||
| } | ||
|
|
||
| function assertNoStatementTerminator(value: string): void { | ||
| if (value.includes(';')) { | ||
| throw new Error(`SQL injection prevention: Statement terminators (;) are not allowed.`) | ||
| } | ||
| } | ||
|
|
||
|
Comment on lines
+28
to
+33
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. π Security & Privacy | π Major | ποΈ Heavy lift μΈλ―Έμ½λ‘ κ²μ¬λ§μΌλ‘
π€ Prompt for AI Agents |
||
| export class ERDModel { | ||
| private tables: Map<string, Table> = new Map() | ||
|
|
||
|
|
@@ -49,6 +55,7 @@ export class ERDModel { | |
| addColumn(tableName: string, column: Column): void { | ||
| assertSnakeCaseIdentifier('Table', tableName) | ||
| assertSnakeCaseIdentifier('Column', column.name) | ||
| assertNoStatementTerminator(column.type) | ||
|
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. π Security & Privacy | π Major | β‘ Quick win DDL μμ± κ²½κ³μμλ
κΆμ₯ μ΅μ λ°©μ΄ const columnDefs = table.columns.map((col) => {
+ assertNoStatementTerminator(col.type)
let def = ` ${col.name} ${col.type}`π€ Prompt for AI Agents |
||
| const table = this.tables.get(tableName) | ||
| if (!table) { | ||
| throw new Error(`Table '${tableName}' does not exist.`) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.