Skip to content

v0.78.1: Security fixes - #290

Merged
AngeloSha merged 33 commits into
mainfrom
fix/v0781-signin-hardening
Oct 17, 2026
Merged

AngeloSha merged 33 commits into
mainfrom
fix/v0781-signin-hardening

Conversation

@AngeloSha

@AngeloSha AngeloSha commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

v0.78.1: Security fixes

Hardening for sessions, API tokens, sign-in and the public fetch path, from @globalteddy's fixes, merged with his own commits. Also one Health fix for v0.78.0's finishing downloads.

What changes

  • Sessions follow their account. authenticate reads the account on every JWT request. A disabled or deleted account gets 401, and the role is the account's current one. Image cookies already did this (accountActive).
  • Admin exceptions outside /api/admin use actsAsAdmin. That is the account role together with the token's scope: run and job cards, archive actions, an admin's series details, the canDownload exemption, and Discover's recommendations.
  • Public fetches connect only where the lookup said. lib/publicConnection.ts checks the addresses the socket actually connects to and hands only those to it. It serves covers, icons and every page download past the engine's first hop.
  • Sign-in budget: five failed passwords per (address, name) in 15 minutes, then 429 with Retry-After.
    • A public wrong password no longer touches the account lock.
    • Wrong second-step codes and wrong current passwords behind a session still lock it.
  • Uniform refusals before a password is accepted: one 401 invalid_credentials, after one verification each (lib/loginPassword.ts, a dummy hash at the app's parameters).
    • Disabled and locked accounts are verified against their own hash. Only the right password learns 403 disabled or 423 locked.
  • The web says a rate-limited sign-in in the reader's language. The string is one all 8 languages already have.
  • Health "Chapters that would not download" counts a refused chapter as left alone by the sweep's own cap (retryCapFor). Its note says the refusal cap while "Finish downloads on their own" is on, in all 8 languages.
  • Health notes join sentences as sentences. v0.78.0's Chapter gaps note read "…what it found.; Numbers none of…" on the live server (338d3fc).
  • Docs: the session, token-scope and sign-in rules in docs/api.md and docs/USAGE.md, and when to narrow TRUST_PROXY to the proxy's own address. The default is unchanged.

Tests

His focused tests: currentJwtAuthority.int, inlineAdminScope.int, publicConnection, coverUrlGuard.int (a no-private-socket assertion), sourcePasswordThrottle.int, uniformPasswordRefusal.int.

Reintroductions, after an unmodified baseline through the same command. Each fails its own test:

Reintroduced Fails
no account read in authenticate currentJwtAuthority
roleOf on run cancel inlineAdminScope
plain fetch for the cover hop coverUrlGuard
public wrong password recorded on the lock sourcePasswordThrottle
no verification for an unknown name uniformPasswordRefusal
disabled answered before its password uniformPasswordRefusal
states folded into the 401 accountLock (the right password told it is wrong)
every status capped at three on Health finishDownloads.int "Health says a refused chapter is still being tried"

Tests that changed meaning:

  • Two accountLock assertions go back to 423 for the right password while locked.
  • findSources.int demoted its admin with a token claiming member, and healthSummary.int signed user for an admin. Both now use the database, since a token's role claim no longer counts.
  • sourceAccess.int: a deleted account's token is 401 at authenticate.

Full sharded bff suite on this tree: 3519/3530 before those three test files were updated.

  • The failures were those three files, 32/32, 15/15 and 3/3 once updated, plus releasePipeline's Umbrel pin, which moves to v0.78.0 here.
  • The 6 skips are the container's own (compose, pg_dump, openssl, live engine, git).

Web suite: 1494/1494 (TZ=UTC). Both typechecks are clean.

🤖 Generated with Claude Code

globalteddy and others added 30 commits October 17, 2026 09:55
Co-authored-by: Codex <noreply@openai.com>
…rottling

Co-authored-by: Codex <noreply@openai.com>
… work

Co-authored-by: Codex <noreply@openai.com>
…rce budgets

Co-authored-by: Codex <noreply@openai.com>
…ions

Co-authored-by: Codex <noreply@openai.com>
# Conflicts:
#	bff/src/routes/auth.ts
#	bff/test/accountLock.int.test.ts
#	docs/api.md
Before a password is accepted every refusal stays one answer after one verification. A disabled or locked
account is now checked against its own password, and the right one is told why it cannot sign in (403
disabled, 423 locked) instead of "wrong password". Also: the public-fetch dispatcher speaks HTTP/1.1 only
(undici 8 offers HTTP/2, whose answers reached Node's fetch undecoded in 8.11.0), a rate-limited sign-in
is said in the reader's language, and Discover's recommendations take the token-scope rule too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ver now does them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign-in and account hardening from @globalteddy's report and fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l being tried

With "Finish downloads on their own" on, a refusal is tried until REFUSAL_RETRY_CAP, but "Chapters that would not
download" counted it left alone after three. It counts by the sweep's own rule now, and its note says how many tries
a refused chapter gets while the switch is on (in all 8 languages).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The default trusts the private networks a home server's proxy lives on, which also trusts any device or container
there. Said plainly, with what to set instead, now that sign-in counts wrong passwords per address and name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ne in the database

findSources.int demoted its admin by signing a token that claimed 'member'; since sessions take the account's role as
it is now, that token is still an admin's, and the test demotes the account instead (which also catches the old rule
coming back). sourceAccess.int's token for a deleted account is now refused by authenticate itself, 401, before the
add route's own permission check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AngeloSha and others added 2 commits October 17, 2026 20:39
It signed a token claiming 'user' for its admin; a session takes its account's role as it is now, so that token is
still the admin's. A member account of its own is refused, as the check means.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread bff/src/lib/publicConnection.ts Dismissed
v0.78.0's Chapter gaps note read "...greyed with what it found.; Numbers none of..." on the live server: a part joins
the one before it as a clause unless told otherwise. Both notes added since (gaps.notListedNote, failures.noteRefusals)
join as sentences, and finishDownloads.int.test.ts refuses ".;" in either note.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AngeloSha
AngeloSha merged commit 338d3fc into main Oct 17, 2026
12 checks passed
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.

3 participants