Repository navigation
fix(mcp): harden HackerOne MCP server + tests (follow-up to #162) - #163
Merged
Merged
Conversation
…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>
|
ilyar[=@g28eui g uvcm z @codex[agent] |
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.
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
_hacker_pagesnow has a hard page cap + stops on a zero-row page — an emptydatawith a non-nulllinks.nextcan no longer hang the MCP process.protocolVersionnegotiated against a supported set instead of echoed verbatim; unknown tool →-32602(was-32601); non-dict JSON ignored.substatefield fromlist_my_reports(not on the REST report resource — always null).h1_referenceby explicitimportlibpath, nosys.path[0]insert.limitparsing routed through_limit(cleanToolError).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 andsubstateremoval).Public tools live-smoke-tested against hackerone.com; full repo suite green.
🤖 Generated with Claude Code