Skip to content

auth: enforce scoped personal-library access - #9

Open
mulatta wants to merge 8 commits into
support-multi-user-oidcfrom
auth-scoped-library-access
Open

auth: enforce scoped personal-library access#9
mulatta wants to merge 8 commits into
support-multi-user-oidcfrom
auth-scoped-library-access

Conversation

@mulatta

@mulatta mulatta commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • introduce typed user/library request context and require an explicit library scope throughout persistence operations
  • migrate the legacy personal library to a bootstrap owner and add hashed, revocable, permission-scoped database API keys
  • enforce note/write/file access, isolate attachment blob registration by library, and redact secrets from request logging

Scope

This establishes the personal-library authorization boundary for later OIDC and group work. User/key provisioning remains an administrative database operation; durable OIDC login and group libraries are intentionally handled by follow-up branches.

Review focus

  • populated-v7 migration and bootstrap ownership invariants
  • completeness of library_id predicates and URL-user/principal matching
  • live disabled/revoked key and library/notes/write/files permission enforcement
  • attachment upload registration and concurrent replacement behavior
  • request-journal secret redaction

Verification

  • cargo test --manifest-path server/Cargo.toml (10 passed)
  • nix flake check --no-build

Pass configuration, PostgreSQL, and object storage explicitly through AppState. This removes process-wide dependency singletons so authorization and library contexts can be tested and resolved per application instance.
Pass a positive LibraryId through every PostgreSQL operation. This makes missing library context a compile-time error before user and group route resolution begins.
Replace blanket denial for keys without note access with Zotero-compatible item filtering. Carry permissions through request scope so sync maps, batch reads, listings, keys, trash, and collection views hide note items while annotations and library metadata retain upstream behavior.
Upload replacement bytes to immutable candidate objects and switch the durable blob pointer only when registration commits. Compare the authorization-time MD5 under the library lock so stale registrations cannot overwrite newer files or bump versions, and consume upload capabilities after terminal outcomes.
Keep request diagnostics limited to method, redacted route, protocol headers, body size, and status. Capability tokens, query strings, forms, attachment bytes, JSON content, API keys, and content fingerprints must not enter the service journal.
@mulatta
mulatta force-pushed the auth-scoped-library-access branch from 0ef377a to 9b8a2c8 Compare August 26, 2026 13:25
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.

1 participant