Skip to content

fix(security): harden ownership, authentication, and page requests - #1200

Merged
qwqcode merged 6 commits into
masterfrom
security-audit-boundaries
Oct 25, 2026
Merged

qwqcode merged 6 commits into
masterfrom
security-audit-boundaries

Conversation

@qwqcode

@qwqcode qwqcode commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

This PR tightens access to pending comments and notifications, bounds page creation and title fetching, and keeps sidebar login credentials out of request URLs while preserving normal anonymous commenting and PV counting.

Changes

  • Require authenticated ownership or a browser-held guest credential for private comment and notification operations. Bind guest credentials to comments, store only their hashes, and preserve access after refresh. Reject unsupported comment query scopes and strengthen notification read tokens.
  • Limit email verification attempts with atomic consumption and persistent cooldowns, avoid logging verification codes, and validate OAuth callback origins and message sources.
  • Restrict title fetching and redirects to administrator-trusted origins, with timeout, response-size, and concurrency limits. Add page_title_auto_fetch, disabled by default; manual fetching remains available.
  • Rate-limit creation of previously unknown pages while preserving PV updates for existing pages. Hide pages without comments in the sidebar by default and use partial/atomic updates to avoid overwriting concurrent changes.
  • Transfer sidebar JWTs and guest credentials through URL fragments, then remove credentials from the sidebar address. Keep support for receiving older query-based login links.

Upgrade behavior

Deploy the backend, comment frontend, and sidebar assets together. An old frontend still puts its JWT in the initial request URL; accepting that format only preserves compatibility and cannot undo the initial exposure.

Guest access follows possession of the browser credential, not a supplied name or email. Existing comments without a credential hash cannot acquire anonymous ownership merely by matching those fields. Clearing browser storage loses the guest proof; blocked storage supports the current page session only. Public comments and administrator access remain available.

Database migration adds the ownership hash and verification-attempt fields, preserves the earlier security-branch hash column on rename, and stops startup on migration failure. Automatic title fetching now requires explicit opt-in.

Validation

  • Latest head 1be600da: PR browser end-to-end CI, Go and database CI, documentation CI, and workflow syntax/security checks and frontend CI all passed.
  • Backend coverage includes Linux AMD64/ARM64, macOS, and real PostgreSQL 17, MySQL 8.4, and SQL Server 2022 services, alongside SQLite tests.
  • The ui/artalk ESLint check passes with --max-warnings 0; all 7 guest-identity regression tests passed locally.
  • Local browser testing verified administrator login and refresh, credential-free request queries and API Referer headers, older query-link compatibility on a fresh origin, anonymous pending-comment visibility after refresh, notification API access, and PV increments.

All applicable PR checks must complete before merging.

@qwqcode
qwqcode force-pushed the security-audit-boundaries branch from cdbb023 to 1be600d Compare October 25, 2026 12:15
@qwqcode
qwqcode merged commit 1be600d into master Oct 25, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant