Skip to content

Add fuzz tests and fix parseRetryAfter overflow - #94

Merged
jeremy merged 3 commits into
masterfrom
add-fuzz-tests
Mar 10, 2026
Merged

Add fuzz tests and fix parseRetryAfter overflow#94
jeremy merged 3 commits into
masterfrom
add-fuzz-tests

Conversation

@jeremy

@jeremy jeremy commented Mar 10, 2026

Copy link
Copy Markdown
Member

Summary

  • Fix time.Duration overflow in parseRetryAfter — large Retry-After header values (e.g. "9227000000") cause negative durations. Capped at 300 seconds.
  • Add Go native fuzz tests for 6 parser functions across internal/client and internal/commands, satisfying the OpenSSF Scorecard Fuzzing check.
  • Includes regression corpus entry for the overflow case, caught during initial fuzzing.

Test plan

  • FuzzParseRetryAfter regression corpus passes (previously overflowed)
  • All 6 fuzz test seed corpora pass as regular tests
  • make build succeeds
  • make test-unit passes

Summary by cubic

Fixes parseRetryAfter overflow by capping numeric and HTTP-date Retry-After at 300s to prevent negative durations. Adds fuzz tests for six parser helpers with a regression seed, adds unit tests for the cap (meets OpenSSF Scorecard Fuzzing), and hoists the parseLinkNext regexp to a package var.

Written for commit 265537b. Summary will update on new commits.

jeremy added 2 commits March 9, 2026 17:36
Large Retry-After values (e.g. "9227000000") overflow time.Duration
when multiplied by time.Second, producing negative durations. Cap at
300 seconds — any server asking for more than 5 minutes is bogus.
Cover parseLinkNext, parseRetryAfter, ParsePage (client) and
parsePseudoColumnID, normalizeSkillPath, expandPath (commands).

Includes regression corpus entry for the parseRetryAfter overflow
found during initial fuzzing.
@jeremy
jeremy requested a review from a team as a code owner March 10, 2026 00:37
Copilot AI review requested due to automatic review settings March 10, 2026 00:37

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eddb89a17b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/client/client.go Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the HTTP client’s retry/backoff handling by preventing Retry-After-derived time.Duration overflow, and adds Go native fuzz tests for several parsing helpers to support ongoing robustness checks.

Changes:

  • Cap numeric Retry-After values in parseRetryAfter to avoid time.Duration overflow (e.g., very large seconds values wrapping negative).
  • Add 6 Go fuzzers across internal/client and internal/commands to ensure parser helpers don’t panic.
  • Add a fuzz regression corpus entry for the previously-overflowing Retry-After value.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
internal/client/client.go Caps integer Retry-After seconds to prevent time.Duration overflow.
internal/client/fuzz_test.go Adds fuzzers for parseLinkNext, parseRetryAfter, and ParsePage.
internal/client/testdata/fuzz/FuzzParseRetryAfter/2f261fc7602f5d07 Adds corpus input reproducing the overflow case.
internal/commands/fuzz_test.go Adds fuzzers for parsePseudoColumnID, normalizeSkillPath, and expandPath.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/client/client.go Outdated
Comment thread internal/client/fuzz_test.go
Comment thread internal/client/client.go Outdated
- Hoist parseLinkNext regexp to package-level var (Copilot)
- Cap HTTP-date Retry-After branch at 300s too (Copilot)
- Add unit test cases for cap/overflow behavior (Copilot)
@jeremy
jeremy merged commit 56a8d07 into master Mar 10, 2026
19 checks passed
@jeremy
jeremy deleted the add-fuzz-tests branch March 10, 2026 01:07
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.

2 participants