Skip to content

Tech-debt batch 2: revoke sessions on disable/role change, enforce quota on plain uploads (#581 #586) - #604

Merged
antosubash merged 7 commits into
mainfrom
fix/debt-batch-2
Oct 22, 2026
Merged

antosubash merged 7 commits into
mainfrom
fix/debt-batch-2

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Summary

  • users: disabling a user or changing their roles does not revoke existing sessions #581 (security): UserService.disable(), enable() and set_roles() now bump User.session_version atomically in SQL (bump_session_version, shared with the self-service sign-out paths) and publish the revocation on commit, so other workers forget the cached counter. Existing cookie sessions and bearer access tokens are refused on their next request. Disabling also revokes the account's refresh tokens. Behaviour change: a role change signs that user out of their existing sessions; a remembered sign-in re-authenticates with the new roles. Role→permission mappings were already resolved live, so editing a role's permissions needs no revocation.
  • file_storage: quota is enforced for resumable uploads but not plain uploads #586: quota_bytes is enforced for plain uploads as well as resumable ones, through a shared StorageQuota (stored bytes plus active reservations, serialised per tenant with a Postgres advisory lock). An over-quota upload answers 413 and its object is removed. Branding maps the same refusal to 413 instead of a 500. Behaviour change for installs that set quota_bytes while it was only reported.

Verification

  • Browser-verified at /admin/users and /file-storage/ on port 8212; no unexpected console errors
  • Local CI: make lint, make test-py (5641 passed), make test-js (748 passed), full e2e suite (49 passed); revocation and quota Postgres tests run against local Postgres
  • Verification report: https://claude.ai/artifact/LRegQxapMy2Est9wW8S5ZQ

QA Report

  • Full QA cycle completed (1 iteration)
  • 0 bugs found, 0 fixed (P3 notes: disabled login shows the generic message; platform and tenant files are separate quota buckets; binary units in the quota display)
  • Categories tested: Happy Path (revocation in two browsers), Error States (quota limits, branding upload)
  • Full QA report: https://claude.ai/artifact/RX3egipo9vucMWggD6ZG7M

Report links are Claude Artifacts and start private; the author can share them from claude.ai/code/artifacts if reviewers need access.

Test plan

  • Sign in as user B in a second browser, disable B as admin: B's next page load is signed out
  • Set quota_bytes small, upload past it on /file-storage/: 413 with a clear message, no row
  • CI is green

Closes #581
Closes #586

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0824031
Status: ✅  Deploy successful!
Preview URL: https://ddd69b86.simple-module-python.pages.dev
Branch Preview URL: https://fix-debt-batch-2.simple-module-python.pages.dev

View logs

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-22T19:45:53.853355Z 0824031 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@antosubash
antosubash merged commit 58d221a into main Oct 22, 2026
16 checks passed
@antosubash
antosubash deleted the fix/debt-batch-2 branch October 22, 2026 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant