-
Notifications
You must be signed in to change notification settings - Fork 2
fix(security): harden authentication, add rate limiting, CSRF, input validation #60
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
268c4ab
a9cf90f
afb4917
6e0ecb0
26c7ffd
3f7017c
a796e4d
e2c049c
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 | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||||||||||||||||||||||||
| const API_BASE = import.meta.env.VITE_API_URL ?? "http://localhost:3001"; | ||||||||||||||||||||||||||||||||||||
| const API_BASE = import.meta.env.VITE_API_URL; | ||||||||||||||||||||||||||||||||||||
|
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.
Removing the fallback means Proposed fix-const API_BASE = import.meta.env.VITE_API_URL;
+const API_BASE = import.meta.env.VITE_API_URL;
+if (!API_BASE) {
+ throw new Error("VITE_API_URL environment variable is required");
+}Or provide a development fallback if intended: -const API_BASE = import.meta.env.VITE_API_URL;
+const API_BASE = import.meta.env.VITE_API_URL ?? "http://localhost:3001";📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| export class ApiError extends Error { | ||||||||||||||||||||||||||||||||||||
| constructor( | ||||||||||||||||||||||||||||||||||||
|
|
@@ -94,3 +94,10 @@ export const api = { | |||||||||||||||||||||||||||||||||||
| return res.blob(); | ||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| export async function checkSetup(): Promise<boolean> { | ||||||||||||||||||||||||||||||||||||
| const res = await fetch(`${API_BASE}/admin/auth/setup/check`, { | ||||||||||||||||||||||||||||||||||||
| method: "GET", | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
| return res.status !== 410; | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+98
to
+103
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.
This bypasses the Proposed fix using try/catch export async function checkSetup(): Promise<boolean> {
- const res = await fetch(`${API_BASE}/admin/auth/setup/check`, {
- method: "GET",
- });
- return res.status !== 410;
+ try {
+ const res = await fetch(`${API_BASE}/admin/auth/setup/check`, {
+ method: "GET",
+ });
+ return res.status !== 410;
+ } catch {
+ // Network error - assume setup not complete to allow retry
+ return false;
+ }
}As per coding guidelines: "All server calls go through src/lib/api.ts." 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: weroperking/Betterbase
Length of output: 636
Synchronize CI Bun version with Dockerfile versions.
CI runs
1.3.10but all Dockerfiles pin1.3.9-debianand1.3.9-alpine(lines 11, 18, 23). This version skew means CI tests won't catch1.3.9-specific failures that occur in production builds and containers.🤖 Prompt for AI Agents