Commit Graph

5 Commits

Author SHA1 Message Date
bluedbird eab07d8081 refactor(export): rename Memo Archive to Memos Export Format
Avoid confusion with archived memos while preserving legacy ZIP imports. Move Export & Import to the end of basic settings.
2026-09-20 00:37:50 +08:00
boojack 4f46523758 chore: unify user permissions
An active application ADMIN now passes every memo-local authorization
check on named operations: authorship, audience, Space membership and
participation, attachment and reaction ownership. Structural validity
still applies, an archived admin holds no privilege, and collection
listings keep the audience predicate so feeds never surface other users'
private memos.

- core/access: admin bypass in the read policy; CanManageMemo and
  CanManageAttachment as the shared author-level predicates.
- store: drivers read the actor's role alongside its lifecycle state in
  the mutation transaction; validators accept an admin where they
  required the author or a member; shared attachment binding and
  removal predicates.
- api: handlers use the shared predicates; admins may place memos in
  any existing Space and see a memo's Space by name.
- web: one canManageMemo helper replaces the ad hoc creator checks.
- docs: multi-spaces design revised in place; share RPC comments
  updated.
2026-09-17 23:28:19 +08:00
bluedbird 471745b431 fix: harden attachment, auth, and import paths for public deployment
Bound work an anonymous or low-privilege caller can force:

- Bound thumbnail decoding by declared pixel count before decoding and
  remember images that cannot be thumbnailed (over the bound or not
  decodable), so a small image declaring billions of pixels is served
  as-is instead of decoded on every request. Transient storage read
  errors are not remembered. The bound lives in internal/imagelimit and
  is shared with EXIF stripping.
- Cap request bodies at 16 MiB for procedures that carry no file bytes;
  only inline attachment creation, transcription, and chunked uploads
  keep their larger caps.
- Digest over-long submitted usernames before using them as sign-in
  limiter keys, add header and idle timeouts to the HTTP server, limit
  filter expression size, and cap the SQLite regexp cache.

Close correctness gaps:

- Delete the thumbnail the file server actually writes (.v2.jpeg), its
  failure marker, and the legacy name when an attachment is removed.
- Decide EXIF stripping from the sniffed content as well as the declared
  type, so a mislabeled JPEG keeps no metadata.
- Revoke every other session when a password changes; an admin reset
  revokes all of the target's sessions. Prune expired refresh tokens.
- Enforce the 2 MiB avatar limit the web client already applies.
- Keep S3 object keys unique when the path template has no {uuid}.
- Reject negative attachment page tokens.
- Charge memo archive imports against the write and upload budgets,
  charge repeated validate-only plans, discard only attachments an
  import actually stored, and refuse archives that declare far more
  bytes than they hold.
- Load database-stored attachment bytes only after authorization.
- Remove the unused, unguarded linkmeta.GetImage fetcher.

Frontend: send no referrer when loading external images in memos and
link previews, and drop picture/source from the sanitizer so every
remote image goes through the https-only src rule.

Dependencies: grpc 1.83.1 and x/crypto 0.56.0 for reported advisories.
2026-09-17 08:47:44 +08:00
ABird 019ca26bd3 feat: export and import memos as a Memo Archive (#6334) 2026-09-16 22:23:38 +08:00
ABird 45519accd3 refactor: name packages by role and enforce import direction (#6317) 2026-09-13 18:22:54 +08:00