{
 "number": 35964,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/35964",
 "title": "fuzz: add coverage for GetQueryParameterFromUri",
 "author": "laxmanacharya8",
 "author_association": "CONTRIBUTOR",
 "created_at": "2026-08-13T16:46:55Z",
 "updated_at": "2026-09-01T20:10:38Z",
 "age_days": 34,
 "draft": false,
 "labels": [
  "Fuzzing"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "a7ecf9c83c60622b6af9b3c992099170dd15033a",
 "head_ref": "fuzz-query-parameter",
 "head_repo": "laxmanacharya8/bitcoin",
 "head_history": [
  {
   "t": "2026-08-15T05:03:36Z",
   "sha": "a7ecf9c83c60622b6af9b3c992099170dd15033a"
  }
 ],
 "additions": 27,
 "deletions": 0,
 "changed_files": 1,
 "commit_count": 1,
 "size_bucket": "S",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "nervana21",
      "url": "https://github.com/bitcoin/bitcoin/pull/35964#pullrequestreview-4944876724"
     }
    ]
   },
   "conflicts": [
    {
     "number": 36135,
     "title": "fuzz: test HTTPRequest state machine in http_request",
     "author": "frankomosh"
    }
   ]
  }
 },
 "acks_parsed": {
  "nervana21": {
   "kind": "concept_ack",
   "hash": null,
   "t": "2026-08-14T18:42:33Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 1,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "nervana21"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-08-15T05:03:36Z",
  "last_reviewer_activity": "2026-08-15T22:46:25Z",
  "last_reviewer": "nervana21",
  "author_silent_days": 33,
  "waiting_on_author_days": 32,
  "days_since_update": 15
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": [
   36135
  ]
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "src/test/fuzz/http_request.cpp"
 ],
 "body": "`GetQueryParameterFromUri()` parses the query string of a request target\nsupplied by a remote client. It is reached from the REST interface for the\n`count`, `offset`, `size`, `verbose` and `mempool_sequence` parameters, but had\nno fuzz coverage.\n\nThis adds an `http_query_parameter` target. Besides running the parser on\narbitrary input, it round-trips a URL-encoded key/value pair back through it and\nchecks the cases that are easy to get wrong:\n\n- a parameter with no `=`, which is an empty value rather than a missing one\n- a repeated key, where the first occurrence wins\n- a key that occurs both before and after a `#`, where the parser must return\n  the value found before the `#` and ignore the later occurrence, since\n  everything from the fragment separator onwards is not part of the query\n  string\n\n## Testing\n\nBuilt the fuzz binary and ran the new target against a temporary corpus\ndirectory, capped at 10,000 executions:\n\n    FUZZ=http_query_parameter build_fuzz/bin/fuzz /tmp/corpus_http_query_parameter -runs=10000",
 "commits": [
  {
   "sha": "a7ecf9c83c60622b6af9b3c992099170dd15033a",
   "date": "2026-08-15T05:03:09Z",
   "message": "fuzz: add coverage for GetQueryParameterFromUri\n\nGetQueryParameterFromUri() parses the query string of a request target\nsupplied by a remote client. It is reached from the REST interface for\nthe \"count\", \"offset\", \"size\", \"verbose\" and \"mempool_sequence\"\nparameters, but had no fuzz coverage."
  }
 ],
 "timeline": [
  {
   "t": "2026-08-14T18:26:49Z",
   "kind": "review_comment",
   "who": "nervana21",
   "assoc": "CONTRIBUTOR",
   "path": "src/test/fuzz/http_request.cpp",
   "commit": "a7ecf9c83c60622b6af9b3c992099170dd15033a",
   "in_reply_to": null,
   "text": "ec1f8dca31238b7a5c97afc88332b27f026ab588: fuzz: add coverage for GetQueryParameterFromUri\n\nnit: Prefer matching the style of the above and using the shortened path names.\n\n```suggestion\n{\n   using http_bitcoin::GetQueryParameterFromUri;\n```"
  },
  {
   "t": "2026-08-14T18:40:59Z",
   "kind": "review_comment",
   "who": "nervana21",
   "assoc": "CONTRIBUTOR",
   "path": "src/test/fuzz/http_request.cpp",
   "commit": "ec1f8dca31238b7a5c97afc88332b27f026ab588",
   "in_reply_to": null,
   "text": "ec1f8dca31238b7a5c97afc88332b27f026ab588: fuzz: add coverage for GetQueryParameterFromUri\n\nThe PR text states that this proves we \"ignore the later occurrence\" after `#`. However, because an identical key name sits before `#`, the first match wins and treating `#` like `&` still passes. In order to prove that statement, I think we need a lookup whose `key` exists only after `#`.\n\nThe `?` character must precede `#` and the `dummy` name cannot match `key` name.\n\n```suggestion\n    assert(http_bitcoin::GetQueryParameterFromUri(query_uri + \"#?\" + encoded_key + \"=ignored\", key) == value);\n    // First '?' must precede '#', and this name must not be key.\n    const std::string dummy{key == \"n\" ? \"m\" : \"n\"};\n    assert(!GetQueryParameterFromUri(\"/endpoint?\" + dummy + \"=1#?\" + encoded_key + \"=\" + encoded_value, key));\n```"
  },
  {
   "t": "2026-08-14T18:42:33Z",
   "kind": "review",
   "who": "nervana21",
   "assoc": "CONTRIBUTOR",
   "state": "COMMENTED",
   "commit": "ec1f8dca31238b7a5c97afc88332b27f026ab588",
   "text": "Concept ACK\n\nLeft a few minor suggestions. Please let me know what you think"
  },
  {
   "t": "2026-08-15T05:03:36Z",
   "kind": "force_push",
   "who": "laxmanacharya8",
   "commit": "a7ecf9c83c60622b6af9b3c992099170dd15033a"
  },
  {
   "t": "2026-08-15T22:46:25Z",
   "kind": "review",
   "who": "nervana21",
   "assoc": "CONTRIBUTOR",
   "state": "COMMENTED",
   "commit": "a7ecf9c83c60622b6af9b3c992099170dd15033a",
   "text": "tACK a7ecf9c83c60622b6af9b3c992099170dd15033a"
  }
 ],
 "labels_log": [
  {
   "t": "2026-08-13T16:46:58Z",
   "action": "labeled",
   "label": "Fuzzing",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-17T09:12:05Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-17T13:03:52Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 2557,
 "text_tokens_estimate": 639,
 "changed_paths": [
  "src/test/fuzz/http_request.cpp"
 ],
 "files": [
  {
   "path": "src/test/fuzz/http_request.cpp",
   "add": 27,
   "del": 0
  }
 ],
 "test_lines": 27,
 "git": {
  "head": "a7ecf9c83c60622b6af9b3c992099170dd15033a",
  "head_matches_backup": true,
  "base": "11090c8bb359f894ef7d97b65aff52fe8191aec1",
  "commits": [
   {
    "sha": "a7ecf9c83c",
    "subject": "fuzz: add coverage for GetQueryParameterFromUri",
    "files": 1,
    "add": 27,
    "del": 0
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "ad7ce14af3e2f3fa",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}