webapi: add a Host allowlist and Origin/Sec-Fetch-Site checks to the loopback server
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start in argus_skill/webapi/server.py at serve() around L712-714 and create_app’s CORS setup around L631-641; compare the desktop token handling in desktop-tauri/src-tauri/src/backend.rs around L920 and the loopback documentation in docs/mobile.md around L112. Define the accepted Host values and non-GET Origin/Sec-Fetch-Site behavior, then verify that unauthorized loopback requests are rejected while allowed requests continue to work.
Written by the indexing model from the issue text.
Description
The webapi binds loopback by default (argus_skill/webapi/server.py, serve() at L712-714: host 127.0.0.1, port 8799), and the docs note that this default "needs no token" (docs/mobile.md ~L112). Two standard loopback-server guards are currently absent:
- No Host-header allowlist —
create_appinstalls noTrustedHostMiddlewareor equivalent, so the server answers requests regardless of theHostheader they carry. - No Origin /
Sec-Fetch-Sitevalidation — the CORS middleware (L631-641) only governs preflights and response headers; nothing checks theOriginorSec-Fetch-Siteof the requests themselves.
Loopback services without these checks are the classic target of DNS rebinding (a page served from a rebound hostname becomes same-origin to the port) and are reachable by any other local user on multi-user machines, since a loopback bind is machine-global. The desktop host already models the stronger posture — it always sets ARGUS_SKILL_WEB_TOKEN for the web UI it launches (desktop-tauri/src-tauri/src/backend.rs ~L920).
Suggested hardening:
- Reject requests whose
Hostis not127.0.0.1[:8799]/localhost[:8799]. - Require
Sec-Fetch-Site: same-origin(or a matchingOrigin) on non-GET requests. - Optionally, mint a per-run random token for the tokenless loopback mode, as the desktop host already does — this also covers the multi-user-machine case.
- Dominant language
- Python
- Stars
- 132
- Forks
- 19
- Avg merge
- 11h 5m
- Merged PRs (30d)
- 2
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/ArgusAgent
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
microsoft/ArgusAgent#31 · 1 comment ·
Maintainers usually reply within 4 days
All issues in microsoft/ArgusAgent
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
gradio-app/gradio#13895 ·
Maintainers usually reply within 1 day
-
build-error
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
spack/spack-packages#6713 ·
Maintainers usually reply within 1 day
-
Use issue templatesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ActivityWatch/activitywatch#1464 · 1 reaction ·
Maintainers usually reply within 1 day
-
[Bug]: The ckg tool drops the return type of every decorated Python method in class search resultsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
bytedance/trae-agent#483 ·
Maintainers usually reply within 1 day