Skip to content

fix: disable pod creation in single-user mode - #258

Merged
melvincarvalho merged 2 commits into
gh-pagesfrom
issue-257-single-user-pods
Apr 3, 2026
Merged

fix: disable pod creation in single-user mode#258
melvincarvalho merged 2 commits into
gh-pagesfrom
issue-257-single-user-pods

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Summary

  • POST /.pods now returns 403 when --single-user is enabled
  • Prevents unauthorized pod creation on single-user servers

Closes #257

Test plan

  • All 353 tests pass
  • Single-user servers reject pod creation with 403

Returns 403 when POST /.pods is called with --single-user enabled.

Closes #257

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the server’s pod-creation endpoint to enforce --single-user semantics by rejecting new pod creation requests when single-user mode is enabled, addressing Issue #257’s security expectation for single-user deployments.

Changes:

  • Return HTTP 403 for POST /.pods when singleUser is enabled.
  • Keep existing per-IP rate limiting and pod creation handling for non-single-user mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/server.js
keyGenerator: (request) => request.ip
// Disabled in single-user mode
if (singleUser) {
fastify.post('/.pods', async (request, reply) => {

Copilot AI Apr 3, 2026

Copy link

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.

Suggested change
fastify.post('/.pods', async (request, reply) => {
fastify.post('/.pods', {
config: {
rateLimit: {
max: 1,
timeWindow: '1 day',
keyGenerator: (request) => request.ip
}
}
}, async (request, reply) => {

Copilot uses AI. Check for mistakes.
Comment thread src/server.js Outdated
// Disabled in single-user mode
if (singleUser) {
fastify.post('/.pods', async (request, reply) => {
return reply.code(403).send({ error: 'Pod creation disabled in single-user mode' });

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 403 response body here uses { error: 'Pod creation disabled in single-user mode' }, which is inconsistent with other 403 JSON responses (typically { error: 'Forbidden', message: ... }, e.g. auth middleware). Aligning the shape/fields would make error handling more consistent for API clients.

Suggested change
return reply.code(403).send({ error: 'Pod creation disabled in single-user mode' });
return reply.code(403).send({
error: 'Forbidden',
message: 'Pod creation disabled in single-user mode'
});

Copilot uses AI. Check for mistakes.
Comment thread src/server.js
Comment on lines +475 to +480
// Disabled in single-user mode
if (singleUser) {
fastify.post('/.pods', async (request, reply) => {
return reply.code(403).send({ error: 'Pod creation disabled in single-user mode' });
});
} else {

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces new single-user-specific behavior (POST /.pods must return 403), but there doesn’t appear to be a corresponding automated test covering single-user mode in the existing pod lifecycle tests. Adding a test case would prevent regressions and ensure the behavior stays enforced.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Single-user mode should disable pod creation

2 participants