Skip to content

fix(mcp): harden HackerOne MCP server + tests (follow-up to #162) - #163

Merged
elementalsouls merged 1 commit into
mainfrom
harden/hackerone-mcp
Nov 18, 2026
Merged

elementalsouls merged 1 commit into
mainfrom
harden/hackerone-mcp

Conversation

@elementalsouls

Copy link
Copy Markdown
Owner

Follow-up hardening on #162, from a three-dimension audit (security/supply-chain, MCP 2025-06-18 conformance, HackerOne API correctness). No behavior change to the public tools; closes the gaps the audit surfaced.

Fixes

  • DoS (MED): _hacker_pages now has a hard page cap + stops on a zero-row page — an empty data with a non-null links.next can no longer hang the MCP process.
  • Protocol: protocolVersion negotiated against a supported set instead of echoed verbatim; unknown tool → -32602 (was -32601); non-dict JSON ignored.
  • API bug: dropped the phantom substate field from list_my_reports (not on the REST report resource — always null).
  • Import hardening: load h1_reference by explicit importlib path, no sys.path[0] insert.
  • Robustness: auth-tool limit parsing routed through _limit (clean ToolError).

Tests

Adds tests/test_hackerone_mcp.py — 16 tests, mocked HTTP, covering lifecycle, credential gating, error codes, GraphQL escaping, and the authenticated path (incl. the pagination-loop fix and substate removal).

Public tools live-smoke-tested against hackerone.com; full repo suite green.

🤖 Generated with Claude Code

…iation, API field) + tests

Follow-up hardening on #162 from a three-dimension audit (security/supply-chain,
MCP 2025-06-18 conformance, HackerOne API correctness):

- Bound _hacker_pages: hard page cap + stop on a zero-row page, so an empty
  `data` with a non-null `links.next` can no longer spin the server forever.
- Negotiate protocolVersion against a supported set instead of echoing the
  client's requested value verbatim.
- Return -32602 (not -32601) for an unknown tool name; ignore non-dict JSON so
  a bare scalar cannot crash the read loop.
- Drop the phantom `substate` field from list_my_reports (absent on the REST
  report resource, always null; `state` already carries resolution status).
- Load h1_reference by explicit importlib path (no sys.path[0] insert that
  could shadow a stdlib import).
- Route auth-tool limit parsing through _limit for a clean ToolError.
- Add tests/test_hackerone_mcp.py (16 tests, mocked HTTP) covering the
  lifecycle, credential gating, error codes, GraphQL escaping, and the
  authenticated path that cannot be reached live without a token.

Co-Authored-By: ItsRenji <ItsRenjiii@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@elementalsouls
elementalsouls merged commit 52d0863 into main Nov 18, 2026
3 checks passed
@elementalsouls
elementalsouls deleted the harden/hackerone-mcp branch November 18, 2026 10:21
@CS50ILYAR066

Copy link
Copy Markdown

ilyar[=@g28eui g uvcm z @codex[agent]

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.

3 participants