AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 48 Bitcoin

Add `File Download` paywall support (#3)

Public commit record

What the developer wrote

Authored by Vlad Stan

76/100 · Adequate
Add `File Download` paywall support (#3)

* feat: introduce file options

* feat: add file download fields

* feat: save file download configs

* feat: show edit dialog

* feat: add support for `Paywall` update

* fix: paywall update

* feat: add mockup download

* feat: check paywall type

* chore: code format 1

* chore: code format 2

* chore: code format 3

* feat: download private files

* fix: permissions

* chore: code format

* feat: check for payment before allowing download

* feat: use shorter link

* chore: code clean-up

* chore: improve log messages

* chore: ruff stuff

* chore: extra logging

* chore: better error handling

* chore: code format

* feat: add `GET` endpoint for creating an invoice

* feat: add `head` operation for download

* feat: add websocket endpoint for invoice check

* feat: watch for paid invoices

* fix: add `paywall_id` in the path for the websocket

* chore: extra logging
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This commit adds a new 'File Download' paywall feature to the LNbits Paywall extension. It lets sellers charge for access to files hosted elsewhere, with the server fetching the file on behalf of paying customers. The change also introduces paywall editing, switches some endpoints to require admin keys, and adds a WebSocket for real-time payment confirmation. There are some security-relevant design choices, but no clear vulnerability is directly introduced by the patch itself.

Recommended action

Review the file-download feature for SSRF and header-injection risks before deploying. Restrict allowed URL schemes (e.g., http/https only), validate or block internal/reserved hosts and IP ranges, and sanitize or restrict custom HTTP headers. Consider adding per-paywall download limits and logging of outbound fetches. Verify that the WebSocket queue lifecycle does not leak entries on errors or disconnects. No immediate emergency patch is indicated by the diff alone, but a security-focused code review of the new download path is warranted.

Security signals we found

01

Server-Side Request Forgery (SSRF) risk: `_file_streamer` fetches user-controlled `file_config.url` with user-controlled `file_config.headers` from the server, potentially allowing internal network probing or credential exfiltration if headers/URL are attacker-controlled.

02

Payment-hash reuse across paywalls is mitigated: `_is_payment_made` now checks `payment.extra.get('id')` matches the requested paywall ID.

03

Authorization elevation: create/update/delete now require admin key instead of any wallet key.

04

WebSocket listener stores queues in a global `paid_invoices` dict keyed by `payment_hash`; no cleanup on disconnect before queue creation could leak entries, though `finally` closes the socket.

05

No input validation on `file_config.url` scheme, host, or header names/values.

06

No rate limiting or download-count cap on paid file downloads.

07

Version placeholder `{version}` is interpolated into the URL via `str.format`, which could be abused if the URL contains other braces, but this is a minor formatting issue rather than a clear exploit.

Risk score

Why this scored 48/100

Our methodology →
Potential impact 12/30
Exploitability 10/25
Stealth signal 8/15
Affected reach 9/15
Confidence 6/10
Evidence quality 3/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.