Refuse passwords over 72 bytes and confirm only stored ones (closes #144)
check / check (push) Waiting to run
check / check (push) Waiting to run
bcrypt cannot hash a password longer than 72 bytes. PASS over the HTTP API answered one with a 500, and the IRC listener confirmed it without storing it. Both transports now refuse a password outside 8 to 72 bytes with the reply a short one already got: 461 over the HTTP API, a NOTICE over the IRC listener. setPassword returns its error, and "Password set" is sent only when the password was stored. A PASS given before registration, an empty one included, is checked after the welcome burst and gets the same NOTICE. Model: opus-5-5
This commit was merged in pull request #173.
This commit is contained in:
@@ -180,7 +180,7 @@ For users who want to access the same session from multiple devices:
|
||||
- **Set password via IRC PASS command**: the authenticated client sends
|
||||
`POST /api/v1/messages` with `{"command":"PASS","body":["mypassword"]}`. The
|
||||
server hashes the password with bcrypt and stores it on the session. Password
|
||||
must be at least 8 characters.
|
||||
must be 8 to 72 bytes.
|
||||
- **Login from another client**: `POST /api/v1/login` with nick and password →
|
||||
server verifies the password, creates a new client for the existing session,
|
||||
and sets an auth cookie. Channel memberships are shared; the new client gets
|
||||
@@ -835,10 +835,11 @@ Set a password on the current session, enabling multi-client login via
|
||||
|
||||
**Behavior:**
|
||||
|
||||
- `body[0]` is the password. Must be at least 8 characters.
|
||||
- `body[0]` is the password. Must be 8 to 72 bytes; bcrypt cannot hash a longer
|
||||
one.
|
||||
- On success, the server responds with `{"status": "ok"}`.
|
||||
- If the password is too short or missing, the server sends ERR_NEEDMOREPARAMS
|
||||
(461) via the message queue.
|
||||
- If the password is too short, too long or missing, the server sends
|
||||
ERR_NEEDMOREPARAMS (461) via the message queue.
|
||||
- Calling PASS again overwrites the previous password.
|
||||
- Once a password is set, `POST /api/v1/login` can be used with the nick and
|
||||
password to create additional clients on the same session.
|
||||
@@ -2678,9 +2679,11 @@ IRC_LISTEN_ADDR: ""
|
||||
|
||||
- **Wire format**: CR-LF delimited lines, max 512 bytes per line
|
||||
- **Connection registration**: Clients must send `NICK` and `USER` to register.
|
||||
An optional `PASS` before registration sets the session password (minimum 8
|
||||
characters). Registering creates a session without a hashcash stamp; closing
|
||||
the connection ends the session, as `QUIT` does.
|
||||
An optional `PASS` before registration sets the session password (8 to 72
|
||||
bytes); one outside that range is refused with a `NOTICE` once registration
|
||||
completes, as `PASS` after registration is. Registering creates a session
|
||||
without a hashcash stamp; closing the connection ends the session, as `QUIT`
|
||||
does.
|
||||
- **PING**: a connection that sends nothing for 90 seconds is sent a `PING`, and
|
||||
is closed if it sends nothing in the 30 seconds after that; any line, such as
|
||||
the client's `PONG`, starts both waits again.
|
||||
|
||||
Reference in New Issue
Block a user