Repository navigation
Description
This was generated by AI during triage.
What happened
On thirdshift 0.13.2, thirdshift setup saved this as the Console's sign-in list:
allowed_emails = ["jstephens@[email protected]"]The owner meant to enter [email protected], [email protected]. Seventeen characters from the middle of the line setup read were missing (probably a terminal edit or paste glitch; setup's comma splitting is correct). The mangled value passed validation, so setup didn't ask again. Nobody on the list could sign in, and requesting a code at /set-password/code sent no email. The cause only turned up by reading config.toml.
Reproduced in a pseudo-terminal with a throwaway HOME:
[email protected], [email protected]is saved correctly as two addresses.[email protected] [email protected]is rejected withconsole.allowed_emails must contain email addressesand asked again (correct).- A value with two
@signs, like the one above, is accepted.
Agent Brief
Category: bug
Summary: The Console's sign-in address check accepts strings that aren't email addresses, such as ones with two @ signs.
Current behavior:
ConsoleSettings::validate() accepts an allowed_emails entry if it contains an @ and no whitespace. So jstephens@[email protected], @example.com, owner@ and owner@localhost all pass. The same check runs at Setup's "Allowed emails" question and when the User config is loaded. Its error doesn't say which entry failed.
Desired behavior:
An allowed_emails entry is accepted only if it:
- contains exactly one
@, - has a non-empty local part before the
@, - has a domain after the
@that contains at least one., without a leading or trailing., - contains no whitespace.
The error names the entry that failed, e.g. console.allowed_emails: "jstephens@[email protected]" is not an email address. Setup prints that error and asks again, as it does now. A User config that already holds a bad entry fails to load with the same error, so the Console refuses to start rather than starting with no one able to sign in.
Key interfaces:
ConsoleSettings::validate(): the stricter per-entry rule and the error that names the entry- Setup's Console questions: the "Allowed emails (comma-separated)" question loop, which already asks again on a validation error
- Trailing commas or empty items (
[email protected],): reject them with the same named error, or drop empty items before validating. Pick one, test it and document it.
Acceptance criteria:
-
[email protected], [email protected]still saves two addresses. -
jstephens@[email protected],@example.com,owner@,owner@localhostand[email protected]are each rejected, and the error names that entry. - In Setup, a rejected answer re-asks the "Allowed emails" question. Nothing is written to the User config until a valid answer is given.
- Loading a User config whose
allowed_emailsholds a rejected entry fails with the entry-naming error. - Existing tests that use valid addresses (e.g.
[email protected]) still pass.
Out of scope:
- Full RFC 5322 validation, or checking that a domain resolves or accepts mail
- Case-folding or normalizing addresses for sign-in matching
- Changes to the Console's sign-in or code-sending flow
- Setup echoing back the saved list (worth a separate issue if wanted)
Activity