Repository navigation
Harden the HTTP client, update dependencies and add CI - #23
Open
akselkvitberg wants to merge 1 commit into
Open
akselkvitberg wants to merge 1 commit into
akselkvitberg wants to merge 1 commit into
Conversation
New no longer mutates http.DefaultClient or the caller's client, applies a 30s default timeout, sends the token only to the API host over HTTPS (loopback http allowed), caps response bodies at 10 MiB, and fixes NullableString.Set(nil). Updates x/oauth2 and samber/lo, and adds a GitHub Actions workflow and Dependabot config. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 tasks
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.
Summary
Fixes from a security review of the SDK, current module versions, and the repository's first CI.
Changes
Newset itsTransportonhttp.DefaultClient(or on the client passed toWithClient), which changed the User-Agent and transport for every other HTTP call in the program. It now works on a copy.WithClientkeeps its own timeout.Authorizationheader is added.httpis only allowed for loopback hosts, for local testing.NullableString.Set(nil)no longer panics; it unsets the value.golang.org/x/oauth2v0.12.0 → v0.37.0,github.com/samber/lov1.38.1 → v1.53.0.x/net,x/exp,appengineandprotobufare no longer needed. Thegodirective is now 1.26.0, required by the updated modules (Core API uses Go 1.27). This replaces Bump golang.org/x/net from 0.15.0 to 0.17.0 #1 and resolves the 8 open Dependabot alerts (x/net, x/oauth2, protobuf)..github/workflows/test.ymlbuilds, vets and runsgo test -raceon pull requests and pushes tomain, and runs govulncheck against the latest stable Go..github/dependabot.ymlupdates Go modules and actions weekly.Not included
Error responses still lose their body; #16 replaces that with ProblemDetails errors. That PR and the rest of its stack (#17–#20) touch
client_request.goandnullable_string.go, so whichever merges second needs a small rebase.Verification
go build ./...,go vet ./...andgo test ./...pass locally (Windows has no cgo here, so-raceruns only in CI). New tests cover:http.DefaultClientand a caller's client are left unchanged, User-Agent, token sent to the API host, refused for another host, a redirect and non-loopback http, an invalid API URL, no restriction without a token, the body limit, andSet(nil).🤖 Generated with Claude Code