Security: local HTTP API is unauthenticated with wildcard CORS — any webpage can load configs, launch or delete files and read disk
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
- 领域
- api, authentication, backend, security
调研方向
Begin at src/profiles/server/app.py:40-46 to replace wildcard CORS with the UI origin and add Host-header validation. Reuse the instance_token from routes/instance.py:29-39 as a bearer on all /api routes, including routes/config.py and routes/actions.py. Done means every non-instance API requires the token, CORS denies foreign origins, and server binds loopback by default.
由索引模型根据 Issue 内容生成。
描述
Summary
Everything except /api/instance/* is served with no authentication, and CORSMiddleware is configured with allow_origins=["*"] and allow_credentials=True (src/profiles/server/app.py:40-46). With that combination Starlette echoes any requesting origin back with Access-Control-Allow-Credentials: true, so any page open in any browser on the user's machine can send POSTs to http://127.0.0.1:8088/api/... and read the responses. There is no CSRF token, no same-origin check, and no Host header validation anywhere (the only header check in the codebase is the handoff token in routes/instance.py:29-39).
Drive-by chain (no user interaction beyond visiting a webpage while ProFiles runs)
POST /api/config/load-content(src/profiles/server/routes/config.py:160-188) uploads raw YAML content that becomes the live config after schema validation only. Confighooks:entries are arbitrary shell commands (see the companion shell=True issue).POST /api/actions/launch(src/profiles/server/routes/actions.py:113-134) accepts any directory/filename pair and runs the matching workflow.POST /api/actions/delete(routes/actions.py:164-176→src/profiles/core/actions.py:357-406) deletes any file on disk — "confirmation" is client-side only; a drive-by client simply lies.POST /api/actions/launch-with-args,/open-folder,/open-terminal,/reveal,/hash,/metadataaccept absolute paths with no scoping;GET /api/fs/browse(routes/fs.py:33-67) lists any directory on any drive;GET /api/configandGET /api/systemleak scan directories, username, hostname and IP.- On
--server-onlythe server binds0.0.0.0(src/profiles/app.py:262) — everything above is then reachable by any LAN device with zero auth.
Additionally there is no Host-header check, so DNS rebinding bypasses any CORS-only fix.
Suggested fix
- Require the existing
instance_token(already generated per-instance and used by/api/instance/*) as a bearer token on all/apiroutes; the web client is served by the same server and can receive it at bootstrap. - Set
allow_originsto the actual UI origin instead of["*"]+ credentials. - Validate the
Hostheader (accept only127.0.0.1:<port>/localhost:<port>) — this also closes DNS rebinding. - Keep the default bind on loopback; if LAN sharing via
--server-onlystays a feature, gate it behind the token or an explicit opt-in flag.
Severity: HIGH. Compounding factor: a forced config load turns into command execution via the workflow shell=True issue.
- 主要语言
- Python
- 星标
- 1
- 派生
- 1
- 平均合并
- 4 小时 46 分钟
- 30 天内合并 PR
- 55
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
falbany/ProFiles 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
falbany/ProFiles#187 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
bug frontend
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
相似的 Issue
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 86/100
aws-samples/sample-spec-driven-presentation-maker#648 ·
维护者通常 1 天内回复
-
firestore: enable live window.yaml pipeline system tests once add_window_fields is in production未关闭
难度 1/5 1 小时以内 新手友好度 64/100
googleapis/google-cloud-python#19115 ·
维护者通常 2 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复