fix: switch REST client auth to x-api-key header - #79
Merged
Conversation
QuickNode's API no longer accepts Authorization: Bearer tokens; it now requires the API key via the x-api-key header. The streams client already used this header correctly; align the main REST client to match. Also update ErrorResponse.Error from *string to json.RawMessage so non-200 error bodies (where "error" is an object, not a string) unmarshal cleanly and surface the real API message in diagnostics.
Upgrade dependencies to address CVEs surfaced by Trivy: - golang.org/x/net v0.55.0 → v0.56.0 (CVE-2026-46600) - golang.org/x/text v0.37.0 → v0.40.0 (CVE-2026-56852) - golang.org/x/crypto v0.52.0 → v0.54.0 (latest) - google.golang.org/grpc v1.79.3 → v1.82.1 (GHSA-hrxh-6v49-42gf) - github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 → v2.7.1 (GHSA-rjwr-m7qx-3fjr) Add .trivyignore for GO-2026-5932 (golang.org/x/crypto/openpgp is unmaintained by design, no fixed version exists, and no package in our dependency tree imports it — it is flagged at the module level).
oapi-codegen/runtime v1.1.1 is missing StyleParamWithOptions and StyleParamOptions introduced in newer codegen output. Bump to v1.6.0 to match the v2.7.1 codegen upgrade. Regenerated api/quicknode/quicknode.gen.go and api/streams/streams.gen.go via make generate. Changes are additive: typed context keys for auth scopes and Valid() methods on all enum types.
Dependency ReviewThe following issues were found:
License Issuesgo.mod
Allowed Licenses: BSD-1-Clause, BSD-2-Clause, BSD-3-Clause, MIT, MIT-0, Apache-1.1, Apache-2.0, Artistic-1.0, Artistic-2.0, PHP-3.0, PHP-3.01, PSF-2.0, Zlib, zlib-acknowledgement, BSL-1.0, OpenSSL, WTFPL, CC0-1.0, CC-PDDC, CC-BY-1.0, CC-BY-2.0, CC-BY-2.5, CC-BY-3.0, CC-BY-4.0, Unlicense, ISC, BlueOak-1.0.0, BSD-2-Clause-Patent, ADSL, Apache-2.0, APAFML, BSD-1-Clause, BSD-2-Clause, BSD-2-Clause-FreeBSD, BSD-2-Clause-NetBSD, BSD-2-Clause-Views, BSL-1.0, DSDP, ECL-1.0, ECL-2.0, ImageMagick, ISC, Linux-OpenIB, MIT, MIT-Modern-Variant, MS-PL, MulanPSL-1.0, Mup, PostgreSQL, Spencer-99, UPL-1.0, Xerox, 0BSD, AFL-1.1, AFL-1.2, AFL-2.0, AFL-2.1, AFL-3.0, AMDPLPA, AML, AMPAS, ANTLR-PD, ANTLR-PD-fallback, Apache-1.0, Apache-1.1, Artistic-2.0, Bahyph, Barr, BSD-3-Clause, BSD-3-Clause-Attribution, BSD-3-Clause-Clear, BSD-3-Clause-LBNL, BSD-3-Clause-Modification, BSD-3-Clause-No-Nuclear-License-2014, BSD-3-Clause-No-Nuclear-Warranty, BSD-3-Clause-Open-MPI, BSD-4-Clause, BSD-4-Clause-Shortened, BSD-4-Clause-UC, BSD-Source-Code, bzip2-1.0.5, bzip2-1.0.6, CC0-1.0, CNRI-Jython, CNRI-Python, CNRI-Python-GPL-Compatible, Cube, curl, eGenix, Entessa, FTL, HTMLTIDY, IBM-pibs, ICU, Info-ZIP, Intel, JasPer-2.0, Libpng, libpng-2.0, libtiff, LPPL-1.3c, MIT-0, MIT-advertising, MIT-open-group, MIT-CMU, MIT-enna, MIT-feh, MITNFA, MTLL, MulanPSL-2.0, Multics, Naumen, NCSA, Net-SNMP, NetCDF, NTP, OLDAP-2.0, OLDAP-2.0.1, OLDAP-2.1, OLDAP-2.2, OLDAP-2.2.1, OLDAP-2.2.2, OLDAP-2.3, OLDAP-2.4, OLDAP-2.5, OLDAP-2.6, OLDAP-2.7, OLDAP-2.8, OML, OpenSSL, PHP-3.0, PHP-3.01, Plexus, PSF-2.0, Python-2.0, Ruby, Saxpath, SGI-B-2.0, SMLNJ, SWL, TCL, TCP-wrappers, Unicode-DFS-2015, Unicode-DFS-2016, Unlicense, VSL-1.0, W3C, X11, XFree86-1.1, Xnet, xpp, Zlib, zlib-acknowledgement, ZPL-2.0, ZPL-2.1, AAL, Adobe-2006, Afmparse, Artistic-1.0, Artistic-1.0-cl8, Artistic-1.0-Perl, Beerware, blessing, Borceux, CECILL-B, ClArtistic, Condor-1.1, Crossword, CrystalStacker, diffmark, DOC, EFL-1.0, EFL-2.0, Fair, FSFUL, FSFULLR, Giftware, HPND, IJG, Leptonica, LPL-1.0, LPL-1.02, MirOS, mpich2, NASA-1.3, NBPL-1.0, Newsletr, NLPL, NRL, OGTSL, OLDAP-1.1, OLDAP-1.2, OLDAP-1.3, OLDAP-1.4, psutils, Qhull, Rdisc, RSA-MD, Spencer-86, Spencer-94, TU-Berlin-1.0, TU-Berlin-2.0, Vim, W3C-19980720, W3C-20150513, Wsuipa, WTFPL, xinetd, Zed, Zend-2.0, ZPL-1.1 Excluded from license check: pkg:golang/github.com/hashicorp/terraform-plugin-framework@v1.15.0, pkg:golang/github.com/hashicorp/terraform-plugin-go@v0.27.0, pkg:golang/github.com/hashicorp/terraform-registry-address@v0.2.5, pkg:golang/google.golang.org/protobuf, pkg:golang/golang.org/x/crypto, pkg:golang/golang.org/x/mod, pkg:golang/golang.org/x/net, pkg:golang/golang.org/x/sync, pkg:golang/golang.org/x/sys, pkg:golang/golang.org/x/text, pkg:golang/golang.org/x/time, pkg:golang/golang.org/x/tools, pkg:golang/honnef.co/go/tools, pkg:golang/go.yaml.in/yaml/v3 OpenSSF ScorecardScorecard details
Scanned Files
|
s2tu-circle
approved these changes
Jul 22, 2026
jscaltreto
pushed a commit
that referenced
this pull request
Jul 22, 2026
🤖 I have created a release *beep* *boop* --- ## [0.9.1](v0.9.0...v0.9.1) (2026-07-22) ### Bug Fixes * switch REST client auth to x-api-key header ([#79](#79)) ([662bf4b](662bf4b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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
QuickNode's REST API no longer accepts
Authorization: Bearertokens — it now requires the API key via thex-api-keyheader. This causedterraform planto fail with a401 Unauthorizedduring provider configuration even when supplying a valid API key. This PR aligns the main REST client with the streams client, which was already usingx-api-keycorrectly.Also bumps several dependencies to address CVEs surfaced by the Trivy scan, and updates the generated API clients to match.
Detail
Auth fix:
internal/provider/provider.go: Replacedsecurityprovider.NewSecurityProviderBearerTokenwith an inlineRequestEditorFnthat setsx-api-key: <apiKey>on each request, matching the pattern already used for the streams client. Removed the now-unusedsecurityproviderimport.internal/utils/error.go: ChangedErrorResponse.Errorfrom*stringtojson.RawMessage. QuickNode returnserroras a JSON object (not a string) in non-200 responses, causing a silent unmarshal failure that swallowed the real API error message and replaced it with a misleading internal warning.Dependency upgrades:
golang.org/x/netv0.55.0 → v0.56.0 (CVE-2026-46600)golang.org/x/textv0.37.0 → v0.40.0 (CVE-2026-56852)golang.org/x/cryptov0.52.0 → v0.54.0 (latest)google.golang.org/grpcv1.79.3 → v1.82.1 (GHSA-hrxh-6v49-42gf)github.com/oapi-codegen/oapi-codegen/v2v2.4.1 → v2.7.1 (GHSA-rjwr-m7qx-3fjr)github.com/oapi-codegen/runtimev1.1.1 → v1.6.0 (required by regenerated code from v2.7.1 codegen).trivyignorefor GO-2026-5932 (golang.org/x/crypto/openpgpis unmaintained by design, has no fixed version, and is not imported by any package in our dependency tree — Trivy flags it at the module level)..licenseignoreentry forgo.yaml.in/yaml/v3(Apache-2.0 AND MIT dual-license; both are acceptable).Regenerated API clients (
api/quicknode/quicknode.gen.go,api/streams/streams.gen.go): changes are additive only — typed context keys for auth scopes andValid()methods on all enum types.Testing
Verified locally using
dev_overrideswith a valid QuickNode API key. Prior to this change,terraform planfailed with401 Unauthorizedand a JSON unmarshal warning. After this change, the provider configures successfully and plans complete.Trivy scan passes locally with 0 findings after the dependency upgrades. All unit tests pass.
Documentation
No documentation changes required.