You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(security): validate AST link schemes, guard local POST CSRF, fix volume & DOM leaks #81
Security, efficiency, and cleanup defects verified across backend and UI:
Unvalidated href scheme: ast_to_html() (app/news.py:189-192) emits <a href="{url}"> without checking http:// or https://, allowing javascript: URIs in story HTML rendered via innerHTML.
Local HTTP CSRF surface: Mutating POST routes in app/server.py (such as /api/clear_tape, /api/pop_tape, /api/refresh) lack Origin/Referer localhost checks, allowing cross-site simple POST requests from external web pages.
Redundant volume writes: setVolume(vol, true) (web/js/app.js:187-190) fires both POST /api/set_volume and POST /api/config back-to-back.
DOM/listener leaks: U.pop() (web/js/util.js:234-239) leaks documentmousedown listeners when closed via U.closePops(), and Settings.readJsonFile() (web/js/settings.js:876-906) leaks hidden <input type="file"> elements on dialog cancel.
Click #vol-bar-track in the UI and inspect Network -> fires both POST /api/set_volume and POST /api/config.
Open a popover and call U.closePops(), or open file import and cancel -> listener / hidden <input> persists.
Expected Behavior
Allow only http:// and https:// URLs in ast_to_html(), reject non-localhost Origin headers on mutating /api/*POST routes, stop calling redundant App.saveConfig(true) in setVolume(), track/remove U.pop() listeners in U.closePops(), and clean up file inputs on cancel.
Operating System & Version
OS: Windows 11 x64 / macOS arm64 / Linux x86_64
Version: v2.12.0
Display / Scale: Verified via live Chrome CDP (1600x960) & local unit/backend suite
Logs & Additional Context
Live Chrome CDP verified duplicate POST /api/set_volume + POST /api/config; backend test verified <a href="javascript:alert(1)" data-ext="1">Click</a>.
Summary of Changes: Restricted ast_to_html() links and open_url() to http:///https://, added localhost Origin/Referer CSRF protection on mutating /api/*POST routes (app/server.py), removed duplicate POST /api/config on volume drag (web/js/app.js), and cleaned up U.pop() listeners & cancelled file inputs. Verified via unit tests and live Chrome CDP.
Verification: compileall clean, 84/84 unit tests passing (including tests/test_audit_fixes.py), and live Chrome CDP verification passed.
This issue will automatically close upon PR #82 review and merge into main.
Activity
github-actions commentedon Dec 2, 2026
✅ Issue Validation Passed
fix(security))This issue is well-structured and ready for work according to the Issue-First Protocol.
mlgitdev commentedon Dec 2, 2026
🚀 Resolution In Progress
A fix for this issue has been implemented and submitted in Pull Request #82 (
v2.12.1).fix/audit-remediation-67ast_to_html()links andopen_url()tohttp:///https://, added localhostOrigin/RefererCSRF protection on mutating/api/*POSTroutes (app/server.py), removed duplicatePOST /api/configon volume drag (web/js/app.js), and cleaned upU.pop()listeners & cancelled file inputs. Verified via unit tests and live Chrome CDP.compileallclean, 84/84 unit tests passing (includingtests/test_audit_fixes.py), and live Chrome CDP verification passed.This issue will automatically close upon PR #82 review and merge into
main.