Skip to content

Require POST to create web sessions - #10

Merged
lavochkaa merged 1 commit into
mainfrom
fix/login-post-only
Oct 28, 2026
Merged

lavochkaa merged 1 commit into
mainfrom
fix/login-post-only

Conversation

@lavochkaa

Copy link
Copy Markdown
Owner

Why

handle_http_client parsed a form body on /login regardless of the HTTP method. A GET with Content-Length: 11 and login=alice created a web session and returned Set-Cookie. Session creation should require POST.

Change

Return 405 Method Not Allowed with Allow: POST before parsing the form for any other method. Add a socketpair regression that sends a GET body and checks the response, then verifies that a later POST can still create the same username's session.

Verification

  • Before fix: focused HTTP session test failed at the new 405 assertion (exit 134).
  • After fix: sh tests/run.sh passed with C++17, -Wall -Wextra -Werror on macOS with loopback access.
  • git diff --cached --check passed before commit.
  • The pushed branch SHA was independently confirmed with git ls-remote.

Remaining review

  • Linux build and live browser behavior have not been run locally: the Docker daemon socket is absent. Please review the HTTP method behavior and rely on this PR's Linux CI before merging.

@lavochkaa lavochkaa added the bug Something isn't working label Oct 28, 2026
@lavochkaa
lavochkaa marked this pull request as ready for review October 28, 2026 04:24
@lavochkaa
lavochkaa merged commit 909e748 into main Oct 28, 2026
2 checks passed
@lavochkaa
lavochkaa deleted the fix/login-post-only branch October 28, 2026 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant