Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@
**Vulnerability:** The standard user authentication routes (login, register, and reset-password) did not have a maximum length constraint on passwords. This allows an attacker to supply extremely long strings, which `bcrypt` will try to hash, causing CPU exhaustion and creating a Denial of Service (DoS) vulnerability.
**Learning:** `bcrypt` (and `bcryptjs`) is intentionally slow. While `bcrypt` may internally truncate passwords to 72 bytes, depending on the implementation the input string processing itself or the full string parsing before truncation can be very costly. In this codebase, the admin authentication correctly checked for a max length, but user schemas did not.
**Prevention:** Always enforce a maximum string length limit (e.g. `.max(1024)`) on user inputs that will be passed into expensive algorithms like bcrypt hashing.

## 2025-08-07 - Mutation Bypass๋ฅผ ํ†ตํ•œ SQL Injection ์ทจ์•ฝ์  ๋ฐฉ์ง€
**Vulnerability:** `packages/web/src/lib/erd.ts` ๋‚ด์˜ `ERDModel` ํด๋ž˜์Šค์—์„œ `getTable`, `addTable`, `addColumn`, `addForeignKey` ๋“ฑ์˜ ๋ฉ”์„œ๋“œ๊ฐ€ ๊ฐ์ฒด์˜ ์ฐธ์กฐ(reference)๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ฑฐ๋‚˜ ๋‚ด๋ถ€ ๋ฐฐ์—ด์— ๊ทธ๋Œ€๋กœ ์ €์žฅํ•˜์—ฌ, ์™ธ๋ถ€์—์„œ ๊ฐ์ฒด์˜ ํ”„๋กœํผํ‹ฐ(์˜ˆ: `table.name`, `column.type`)๋ฅผ ์ž„์˜๋กœ ๋ณ€์กฐ(mutation)ํ•  ์ˆ˜ ์žˆ๋Š” ์ทจ์•ฝ์ ์ด ์กด์žฌํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด SQL Injection ํ•„ํ„ฐ๋ง์„ ์šฐํšŒํ•˜๊ณ  ์•…์˜์ ์ธ DDL ๋ฌธ์„ ์ฃผ์ž…ํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
**Learning:** ์‹๋ณ„์ž์— ๋Œ€ํ•œ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ(Snake Case ๋“ฑ)๋ฅผ ์ˆ˜ํ–‰ํ•˜๋”๋ผ๋„, ์ƒํƒœ ๊ฐ์ฒด๊ฐ€ ์ฐธ์กฐ๋กœ ๋…ธ์ถœ๋˜๋ฉด ์–ธ์ œ๋“ ์ง€ ๊ฒ€์ฆ ์ดํ›„์— ๊ฐ’์„ ๋ณ€์กฐํ•˜์—ฌ SQL ์ฃผ์ž… ๊ณต๊ฒฉ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
**Prevention:** ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌํ•˜๋Š” ํด๋ž˜์Šค์—์„œ ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ฑฐ๋‚˜ ๋‚ด๋ถ€ ๋ฐฐ์—ด์— ์ถ”๊ฐ€ํ•  ๋•Œ๋Š” ํ•ญ์ƒ `structuredClone()` ๋“ฑ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊นŠ์€ ๋ณต์‚ฌ(deep copy)๋ฅผ ์ˆ˜ํ–‰ํ•˜์—ฌ ์™ธ๋ถ€ ๋ณ€์กฐ๋ฅผ ์ฐจ๋‹จํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

## 2026-08-07 - OSV-Scanner ์ทจ์•ฝ์  ํƒ์ง€ ๋ฐ ์˜์กด์„ฑ ๊ฐ•์ œ ๊ณ ์ •
**Vulnerability:** ์˜์กด์„ฑ ์Šค์บ” ์ค‘ `js-yaml`๊ณผ `nanoid` ํŒจํ‚ค์ง€์—์„œ ์•Œ๋ ค์ง„ ๋ณด์•ˆ ์ทจ์•ฝ์ ์ด ๋ฐœ๊ฒฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ํŒจํ‚ค์ง€๋“ค์€ ๋‹ค๋ฅธ ํŒจํ‚ค์ง€์˜ ํ•˜์œ„ ์˜์กด์„ฑ(transitive dependency)์œผ๋กœ ์„ค์น˜๋˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
**Learning:** ์ง์ ‘ ์„ค์น˜ํ•˜์ง€ ์•Š์€ ํ•˜์œ„ ์˜์กด์„ฑ์ด๋ผ๋„ ์ „์ฒด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ณด์•ˆ์— ์˜ํ–ฅ์„ ๋ฏธ์น  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์˜์กด์„ฑ ํŠธ๋ฆฌ ๊นŠ์€ ๊ณณ์— ์žˆ๋Š” ์ทจ์•ฝ์ ์€ ๋ฐœ๊ฒฌ ๋ฐ ์ˆ˜์ •์ด ์–ด๋ ค์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
**Prevention:** `pnpm audit` ๋˜๋Š” `osv-scanner`์™€ ๊ฐ™์€ ๋„๊ตฌ๋ฅผ CI ํŒŒ์ดํ”„๋ผ์ธ์— ํ†ตํ•ฉํ•˜์—ฌ ์ง€์†์ ์œผ๋กœ ์Šค์บ”ํ•˜๊ณ , ์ทจ์•ฝ์ ์ด ๋ฐœ๊ฒฌ๋  ๊ฒฝ์šฐ `package.json`์˜ `pnpm.overrides`๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์•ˆ์ „ํ•œ ํŒจ์น˜ ๋ฒ„์ „์œผ๋กœ ๊ฐ•์ œ ๊ณ ์ •(override)ํ•˜์—ฌ ์„ ์ œ์ ์œผ๋กœ ๋ฐฉ์–ดํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"@babel/core": "7.29.7",
"esbuild": "0.28.1",
"hono": "^4.12.34",
"js-yaml": "^4.3.0",
"js-yaml": "^4.3.1",
"nanoid": "^3.3.18",
"@auth/core": "^0.41.3",
"sharp": "^0.35.3",
"postcss": "^8.5.18",
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/lib/erd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('ERDModel', () => {
const table = model.addTable('users')
expect(table.name).toBe('users')
expect(model.getTables().length).toBe(1)
expect(model.getTable('users')).toBe(table)
expect(model.getTable('users')).toStrictEqual(table)
})

it('should throw when adding duplicate table', () => {
Expand Down
11 changes: 6 additions & 5 deletions packages/web/src/lib/erd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ export class ERDModel {
}
const table: Table = { name, columns: [], foreignKeys: [] }
this.tables.set(name, table)
return table
return structuredClone(table)
}

getTable(name: string): Table | undefined {
return this.tables.get(name)
const t = this.tables.get(name)
return t ? structuredClone(t) : undefined
}

getTables(): Table[] {
return Array.from(this.tables.values())
return Array.from(this.tables.values()).map(t => structuredClone(t))
}

addColumn(tableName: string, column: Column): void {
Expand All @@ -56,7 +57,7 @@ export class ERDModel {
if (table.columns.some((c) => c.name === column.name)) {
throw new Error(`Column '${column.name}' already exists in table '${tableName}'.`)
}
table.columns.push(column)
table.columns.push(structuredClone(column))
}

addForeignKey(tableName: string, fk: ForeignKey): void {
Expand All @@ -80,7 +81,7 @@ export class ERDModel {
`Reference column '${fk.referenceColumn}' does not exist in table '${fk.referenceTable}'.`
)
}
table.foreignKeys.push(fk)
table.foreignKeys.push(structuredClone(fk))
}

generateDDL(): string {
Expand Down
21 changes: 11 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading