Repository navigation
Conversation
The demo feature made GET /api/admin/v1/me/roles assign the admin role to any authenticated key that had none. The feature is non-default but ships in-tree, so a release build that accidentally enabled it handed admin to whoever knocked. The grant now additionally requires LNVPS_DEMO_OPEN_ADMIN=1 in the environment, and the binary warns at startup when the feature is compiled in. Demo deployments set the variable and keep working; everything else fails closed. Found by the 2026-11-01 security audit (LNVM-006).
mptfire
force-pushed
the
audit/demo-admin-guard
branch
from
November 2, 2026 06:35
a6adf99 to
c224287
Compare
v0l
marked this pull request as ready for review
November 2, 2026 10:32
v0l
enabled auto-merge
November 2, 2026 10:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by the same independent audit (2026-11-01).
What
GET /api/admin/v1/me/rolesunder thedemofeature auto-assigned the admin role to any authenticated key that had none — one request, self-service admin. The feature is non-default, but it ships in-tree and a release build that accidentally enables it (or a demo deployment facing the internet) is trivially compromised, since any Nostr key can authenticate to the admin surface.The grant now requires two conditions: the
demofeature compiled in andLNVPS_DEMO_OPEN_ADMIN=1in the process environment. The binary also warns at startup when the feature is compiled in.Behavior
LNVPS_DEMO_OPEN_ADMIN=1in the environment and the old behavior is back.--features demowithout the variable): the endpoint reports the key's (empty) roles and promotes nothing — fails closed.Validation
lnvps_api_adminsuite green (258 tests).API_CHANGELOG.mddocuments the change and the opt-in variable.Alternative considered
Deleting the block entirely. Kept (gated) instead because a demo deployment presumably wants the no-bootstrap flow; the env var preserves that while making accidental exposure require two independent mistakes.