Skip to content

Allow public GitHub issue reads without token#2774

Open
cybercraftsolutionsllc wants to merge 2 commits into
stakwork:masterfrom
cybercraftsolutionsllc:codex/github-public-issues-without-token
Open

Allow public GitHub issue reads without token#2774
cybercraftsolutionsllc wants to merge 2 commits into
stakwork:masterfrom
cybercraftsolutionsllc:codex/github-public-issues-without-token

Conversation

@cybercraftsolutionsllc
Copy link
Copy Markdown

Fixes #743.

Summary

  • Allow the GitHub API client to fall back to unauthenticated requests when GITHUB_TOKEN is not configured.
  • Keep bearer-token behavior unchanged when a token is configured.
  • Add focused tests for both empty-token public issue reads and configured-token Authorization behavior.

Why

Public GitHub issue reads should not require a configured token. The old client always wrapped requests in OAuth even when GITHUB_TOKEN was empty, which can cause GitHub to reject public issue lookups as bad credentials and surface as "make sure the repo is public" style failures.

Validation

  • go test handlers/github.go handlers/github_test.go
  • git diff --check

Note: go test ./handlers -run 'TestGithubClientWithToken|TestGetGithubIssue' is currently blocked by existing generated mock drift in unrelated handler tests: mocks.Database is missing GetBountyByUnlockCode.

@cybercraftsolutionsllc
Copy link
Copy Markdown
Author

Updated existing PR #2774 with an additional hardening commit: #2774

Follow-up finding while reproducing this issue:

  • The two reported public issues (#425 and #742) currently return body: null from GitHub.
  • The existing mapper dereferenced *iss.Body, so those public issues could fail even after public reads work without a token.

Added:

  • nil-safe GitHub issue mapping for title/state/body/assignee
  • unit coverage for nil body/no assignee and populated assignee/body cases

Validation:

  • go test handlers\github.go handlers\github_test.go -run 'TestGithub' -count=1
  • go test ./routes -run '^TestGithubIssuesRoutes$' -count=1
  • git diff --check HEAD~2..HEAD

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.

Unable to add github issue to bounty

2 participants