Repository navigation
Replies: 1 comment
|
I am def interested in (B). I made a PR here #12 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Thanks for adopting the badge delivery and issuer presentation changes in 3de8898 so quickly. Here's one more idea from running two self-hosted instances, before we write any code: would you be interested in protecting the public PDF download better than a plain rate limit can?
What we see
The public PDF is rendered on every request (
buildPdfResponseinapps/api-worker/src/routes/credential-routes.ts) and served withCache-Control: no-store. We measured one badge withcurlon our deployment, which runs the Node runtime in Docker on a 2-vCPU VM:/badges/:id,/verification,/jsonld/badges/:id/download.pdf(warm)pdf-libalone takes 0.1–0.2 s on one CPU to embed our real 800×800 PNG and save the document. Most of the time goes elsewhere; we haven't profiled further.Today we cap the PDF at the reverse proxy: after 5 downloads per 10 minutes from one IP, it returns 429. That works, but a rate limit can't tell a person from a script. A legitimate burst from one IP, such as staff printing certificates at an event, also hits it.
Ideas
A. Optional Turnstile challenge on PDF downloads. The magic-link flow already has the pieces:
TurnstileVerifier(auth/turnstile.ts), per-IP attempt counting, and the 428 handshake inauth-login.js./badges/:id/download.pdfand/credentials/v1/:id/download.pdf.TURNSTILE_PATHSinhttp/security-headers.tswould allow Cloudflare only on that page.B. Reuse rendered PDFs. Store each PDF keyed by assertion, lifecycle state and template version. Invalidate it on revocation, expiry or template edits. This removes the cost for everyone, not only under abuse, and it pairs well with A.
Not proposing: a challenge on the badge page or on the verification documents. In our logs, LinkedInBot accounts for 6 of 53 badge-page visits, and it builds the share preview from that page. Verifiers and wallets fetch the JSON-LD, DID documents and status lists with no human present.
Would either idea fit your plans? If so, we're happy to send a PR in the style of #6, with tests.
All reactions