-
Notifications
You must be signed in to change notification settings - Fork 9
fix: disable pod creation in single-user mode #258
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 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 |
|---|---|---|
|
|
@@ -472,15 +472,22 @@ export function createServer(options = {}) { | |
|
|
||
| // Pod creation endpoint with rate limiting | ||
| // Limit: 1 pod per IP per day to prevent resource exhaustion and namespace squatting | ||
| fastify.post('/.pods', { | ||
| config: { | ||
| rateLimit: { | ||
| max: 1, | ||
| timeWindow: '1 day', | ||
| keyGenerator: (request) => request.ip | ||
| // Disabled in single-user mode | ||
| if (singleUser) { | ||
| fastify.post('/.pods', async (request, reply) => { | ||
| return reply.code(403).send({ error: 'Forbidden', message: 'Pod creation disabled in single-user mode' }); | ||
| }); | ||
| } else { | ||
|
Comment on lines
+475
to
+480
|
||
| fastify.post('/.pods', { | ||
| config: { | ||
| rateLimit: { | ||
| max: 1, | ||
| timeWindow: '1 day', | ||
| keyGenerator: (request) => request.ip | ||
| } | ||
| } | ||
| } | ||
| }, handleCreatePod); | ||
| }, handleCreatePod); | ||
| } | ||
|
|
||
| // Mashlib CDN mode: redirect chunk requests to CDN | ||
| if (mashlibEnabled && mashlibCdn) { | ||
|
|
||
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.
In single-user mode this route no longer has the per-IP rate limit (1/day) that exists in the non-single-user branch. Even though it always returns 403, removing the limiter is a behavior regression that makes it easier to spam the endpoint (CPU/log noise). Consider keeping the same rateLimit config on the single-user handler as well.