fix(security): remediate Dependabot alerts #93, #94, #86 - #29
Merged
Conversation
…j46f-795x) Dependabot alerts #93 (HIGH) and #94 (MEDIUM): DNS-rebinding bypass via the dashboard WebSocket endpoints. FastAPI's @app.middleware("http") host-header guard does not run on WebSocket routes, so /api/pty, /api/ws, /api/pub, and /api/events accepted upgrades from any Host/Origin as long as the connection peer was loopback — which a TTL-flipped attacker hostname satisfies. Port the upstream fix (NousResearch/hermes-agent, patched in v2026.6.5): add _ws_host_origin_is_allowed() reusing the existing _is_accepted_host HTTP-layer defence, and call it in all four WS handlers before accept(). Non-browser clients (no Origin) and native app:// / file:// origins remain allowed — the session token stays their auth boundary. Adds regression coverage in TestWebSocketHostOriginGuard and sends a loopback Host header in the sidecar-url WS test (now required by the guard). Refs: GHSA-4pqm-j46f-795x, CVE-2026-53869 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-rp68) Dependabot alert #86 (MEDIUM): quadratic-complexity DoS in js-yaml merge-key handling, fixed in 4.2.0. The flagged copy was gray-matter's hard dependency (Docusaurus -> @docusaurus/utils -> gray-matter -> js-yaml ^3, resolving to 3.14.2); js-yaml 3.x has no patched release. gray-matter 4.0.3 is the latest release and calls yaml.safeLoad/safeDump, both removed in js-yaml 4 — so an `overrides` bump alone breaks the docs build. Force js-yaml to 4.2.0 via overrides AND patch gray-matter's default engine to use yaml.load/yaml.dump (load is safe-by-default in v4, equivalent to the removed safeLoad). Applied at install time via patch-package. Verified: only js-yaml 4.2.0 remains in the lockfile, `npm audit` reports 0 vulnerabilities, and `npm run build` succeeds for all locales. Refs: GHSA-h67p-54hq-rp68 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🔎 Lint report:
|
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.
Remediates three open Dependabot security alerts that Dependabot's auto-fix did not raise PRs for.
Alerts addressed
hermes-agent(WebSocket endpoints)hermes-agent(same root cause)js-yaml(npm, website)#93 / #94 — DNS rebinding via WebSocket endpoints (code fix, not a lockfile bump)
The advisory's "patched in 0.16.0" refers to the upstream PyPI
hermes-agentsemver. This repo is a fork ofNousResearch/hermes-agentthat pins its own version (0.14.0,source = editable ".") and uses CalVer tags — there is no0.16.0to regenerateuv.lockagainst, and the fork is ~1400 commits behind the upstream patched line (v2026.6.5), so it never received the fix. Regenerating the lock cannot resolve this — the actual remediation is porting the upstream code fix.Root cause: FastAPI's
@app.middleware("http")Host-header guard (already present in this fork forGHSA-ppp5-vxwm-4cf7) does not run on WebSocket routes. The four WS endpoints (/api/pty,/api/ws,/api/pub,/api/events) validated only the session token and the peer IP (loopback) — both of which a DNS-rebinding attacker satisfies (the browser's connection peer is127.0.0.1after the TTL flip).Fix: ported the upstream guard as
_ws_host_origin_is_allowed(), reusing this fork's existing_is_accepted_host()HTTP-layer helper, and call it in all four handlers beforeaccept(). Non-browser clients (no Origin) and nativeapp:///file://origins stay allowed — the session token remains their auth boundary. AddedTestWebSocketHostOriginGuardregression coverage.#86 — js-yaml quadratic DoS (website)
The flagged
js-yaml@3.14.2is gray-matter's transitive dependency (@docusaurus/utils → gray-matter → js-yaml ^3). js-yaml 3.x has no patched release, and gray-matter 4.0.3 (latest) callsyaml.safeLoad/safeDump, both removed in js-yaml 4 — so anoverridesbump alone breaks the Docusaurus build (verified).Fix: force
js-yaml@4.2.0viaoverridesand patch gray-matter's default engine toyaml.load/yaml.dump(safe-by-default in v4, equivalent to the removedsafeLoad) viapatch-package(website/patches/gray-matter+4.0.3.patch, applied by apostinstallhook).Verification
pytest tests/hermes_cli/test_web_server_host_header.py tests/hermes_cli/test_web_server.py→ 157 passed, including 5 new WS-guard tests. (3 pre-existingTestPtyWebSocketPTY-streaming failures are unrelated and also fail onmainin this environment.)package-lock.jsoncontains onlyjs-yaml@4.2.0(no 3.x);npm audit→ 0 vulnerabilities;npm run build→[SUCCESS] Generated static filesfor all locales.-S).🤖 Generated with Claude Code