Skip to content

fix(api): make POST /library/scan admin only - #4095

Merged
vavallee merged 2 commits into
mainfrom
fix/library-scan-admin-only
Nov 20, 2026
Merged

vavallee merged 2 commits into
mainfrom
fix/library-scan-admin-only

Conversation

@vavallee

Copy link
Copy Markdown
Owner

POST /library/scan was registered without RequireAdmin while GET /library/scan/status is admin gated. The scan walks the global library with no owner filter, so under multi user enforcement any signed in user could start a full walk and its reconciliation side effects.

Now in the same admin group as the status route. Callers checked: Settings scan button (inside the isAdmin block), adoption view (ImportPage renders it for admins only; its other routes are admin only), scheduler (calls the scanner directly, not HTTP). Disabled, local-only and API key modes carry the admin role, so they are unchanged. OPDS does not use the route. Docs updated.

Test: non admin and no role get 403 without starting a scan, admin gets 202. Fails with the route ungated (202 and a scan started for user and no role).

🤖 Generated with Claude Code

The scan walks the global library with no owner filter, so under multi user
enforcement any signed in user could trigger it. Put it in the same admin
group as GET /library/scan/status. The scheduler calls the scanner directly,
and the only web callers (Settings scan panel, adoption view) are admin only.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: vavallee <vavallee@protonmail.com>
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@vavallee
vavallee merged commit 5a61510 into main Nov 20, 2026
42 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