-
Notifications
You must be signed in to change notification settings - Fork 2
Auth revocation, WS ticketing, CSV escaping, rate limiting, and env/security hardening #65
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
Merged
weroperking
merged 2 commits into
main
from
codex/fix-critical-security-vulnerabilities-84zy6i
Apr 26, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| CREATE TABLE IF NOT EXISTS betterbase_meta.revoked_admin_tokens ( | ||
| jti TEXT PRIMARY KEY, | ||
| admin_user_id TEXT REFERENCES betterbase_meta.admin_users(id) ON DELETE SET NULL, | ||
| revoked_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), | ||
| expires_at TIMESTAMPTZ | ||
| ); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_revoked_admin_tokens_expires_at | ||
| ON betterbase_meta.revoked_admin_tokens (expires_at); |
6 changes: 6 additions & 0 deletions
6
packages/server/migrations/018_revoked_admin_tokens_expiry_hardening.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| UPDATE betterbase_meta.revoked_admin_tokens | ||
| SET expires_at = NOW() + INTERVAL '8 hours' | ||
| WHERE expires_at IS NULL; | ||
|
|
||
| ALTER TABLE betterbase_meta.revoked_admin_tokens | ||
| ALTER COLUMN expires_at SET NOT NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| CREATE TABLE IF NOT EXISTS betterbase_meta.rate_limits ( | ||
| key TEXT PRIMARY KEY, | ||
| count INTEGER NOT NULL, | ||
| expires_at TIMESTAMPTZ NOT NULL | ||
| ); | ||
|
|
||
| CREATE INDEX IF NOT EXISTS idx_rate_limits_expires_at | ||
| ON betterbase_meta.rate_limits (expires_at); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| const DANGEROUS_CSV_PREFIX = /^[=+\-@\t\r\n]/; | ||
|
|
||
| export function escapeCSVValue(value: unknown): string { | ||
| if (value === null || value === undefined) return ""; | ||
| const str = String(value); | ||
| const escaped = str.replace(/"/g, '""'); | ||
|
|
||
| if (DANGEROUS_CSV_PREFIX.test(str)) { | ||
| return `"${`'${escaped}`}"`; | ||
| } | ||
|
|
||
| if (str.includes(",") || str.includes('"') || str.includes("\n") || str.includes("\r")) { | ||
| return `"${escaped}"`; | ||
| } | ||
|
|
||
| return str; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.