Skip to content

Add Hack Club privacy hub delete and export endpoints - #255

Merged
3kh0 merged 4 commits into
mainfrom
privacy-hub
Oct 13, 2026
Merged

3kh0 merged 4 commits into
mainfrom
privacy-hub

Conversation

@3kh0

@3kh0 3kh0 commented Oct 13, 2026

Copy link
Copy Markdown
Member

Adds POST /api/privacy/delete and POST /api/privacy/export for the Hack Club privacy hub. Audience is blueprint. Full details of what gets deleted and kept are in docs/privacy.md.

How it works

  • PrivacyToken verifies the bearer token as an ES256 JWT against the hub's JWKS (PRIVACY_JWKS_URL overrides the default). It checks typ, iss, aud, 30s leeway, a lifetime of at most 300s, and that action matches the endpoint. Each jti is stored in the new privacy_token_uses table and repeats get 409 replayed. Old rows are pruned daily.
  • PrivacyDeletion finds people only from the token's subject claims. It runs the real deletion inside a transaction, counts what it removes, and rolls back on dry runs and on every export. External cleanup (R2 files, Gorse, Airtable guild signups) runs before commit, and only on real runs.
  • Records other people depend on are kept as anonymous placeholders and reported in retained: the user row, reviewed, funded or shipped projects, reviews, grants, ticket adjustments, shop orders and packages.
  • Staff accounts, the HCB integration account, and organizers of open guilds get 409 manual_review_required.
  • Logs contain only the request_id, action and outcome. Sentry events are dropped for these endpoints, because Sentry sends request headers and SQL breadcrumbs.

No HCB code is touched.

Known limitations

  • Gorse and Airtable errors are logged and skipped, as in the existing services. Only connection failures return 503, which the hub retries.
  • R2 and Gorse are cleaned up one request at a time, so a very large account could take longer than the hub's 15s timeout.
  • Approved shop orders that haven't shipped keep their state, but their address is wiped.

Deploy

  • Run the migration.
  • Ask Hack Club infra to register Blueprint with audience blueprint and the API base URL.

@socket-security

socket-security Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedbrakeman@​8.0.6 ⏵ 8.1.075 +110010010070

View full report

@3kh0
3kh0 merged commit 93f6138 into main Oct 13, 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.

1 participant