fix(svelte-netlify): resolve Fiber v2 to the patched release in the module graph - #5300
fix(svelte-netlify): resolve Fiber v2 to the patched release in the module graph#5300ReneWerner87 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Pins the vulnerable github.com/gofiber/fiber/v2 version that appears only in svelte-netlify’s module graph (via aws-lambda-go-api-proxy) to a patched release, so module-graph-based scanners stop reporting Fiber v2 advisories even though the recipe builds against Fiber v3.
Changes:
- Adds a
replacedirective insvelte-netlify/go.modto force Fiber v2 to resolve tov2.52.14. - Documents why Fiber v2 shows up (module graph artifact) and why
replaceis used instead of an indirectrequire.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…odule graph svelte-netlify was the last place in the repository where a vulnerable Fiber v2 version appeared. It reaches the module graph through github.com/awslabs/aws-lambda-go-api-proxy v0.16.2, which pins github.com/gofiber/fiber/v2 v2.52.1 in its own go.mod. v0.16.2 is the latest release of that library, so there is no upstream bump to take. v2.52.1 is affected by eleven advisories, including two rated critical (GHSA-98j2-3j3p-fw2v session middleware token injection, and GHSA-68rr-p4fp-j59v insecure UUID fallback). None of them apply to this recipe: it uses Fiber v3 throughout and imports only the proxy's /core package, which does not pull in Fiber v2. The module is not listed in go.mod, has no entry in go.sum, and `go mod why` reports "main module does not need module github.com/gofiber/fiber/v2" -- the toolchain never downloads or compiles it. It is a module-graph artifact, not a dependency. It is still reported by anything that resolves the graph rather than the build list, so this pins it to the patched v2.52.14. A plain indirect `require` does not work here: `go mod tidy` drops it again, because no package in the main module needs it. A `replace` survives tidy and selects v2.52.14 without changing what is compiled. The other two Fiber v2 users, openapi and v2/aws-sam/app, were already on v2.52.14, which is the latest release and carries no open advisories. All three now resolve to v2.52.14. `go build ./...` and `go mod tidy` are unchanged in behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ea7bWcx58vqScAQoerh2Go
a5291ad to
8a82ffb
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
svelte-netlify/go.mod:34
- The
replacedirective is currently unversioned on the left-hand side, which forces allgithub.com/gofiber/fiber/v2versions in the module graph tov2.52.14. That can unintentionally block future upgrades (e.g., if a dependency later moves to a newer Fiber v2, this would still pin back tov2.52.14). Since the motivating case is specificallyv2.52.1, consider making the replacement version-specific.
replace github.com/gofiber/fiber/v2 => github.com/gofiber/fiber/v2 v2.52.14
Raised by Copilot on review. The replace had no version on the left-hand side, so it rewrote any github.com/gofiber/fiber/v2 to v2.52.14, including a legitimately newer release if some future dependency required one. That would be a silent downgrade. Scoped to v2.52.1, the version aws-lambda-go-api-proxy actually pins. If the proxy changes its pin later, the replace stops applying and the new version shows up in scans again rather than being silently rewritten, which is the behaviour we want. Still resolves to v2.52.14, and `go build ./...` and `go mod tidy` are unchanged.
|
Closing without merging. Investigating the reviewer's point about the unscoped
None of it is compiled. Verified for
So this PR would have pinned one of four equally unreachable entries (fiber v2 with 11 advisories, gomarkdown 4, chi 3, logrus 2), carrying a The accurate resolution is to dismiss these alerts as "vulnerable code is not actually used". The durable fix belongs upstream: splitting The other two Fiber v2 sites in this repository, Generated by Claude Code |
Follow-up to #5290, covering the Fiber v2 advisories specifically.
Where Fiber v2 actually is
I resolved the full module graph of all 91 Go modules (
go list -m all, 899 unique versions) and checked every one against OSV. Fiber v2 appears in exactly three places:v2/aws-sam/appopenapisvelte-netlifyEverything else in the repository is on Fiber v3.4.0, which is also the latest and carries no advisories.
svelte-netlify
v2.52.1 reaches the graph through
github.com/awslabs/aws-lambda-go-api-proxy v0.16.2, which pinsgithub.com/gofiber/fiber/v2 v2.52.1in its owngo.mod. v0.16.2 is the latest release of that library, so there is no upstream bump to take.v2.52.1 is affected by eleven advisories, two of them critical:
utils.UUIDv4()fallback (Critical)None of them apply to this recipe. It uses Fiber v3 throughout and imports only the proxy's
/corepackage, which does not pull in Fiber v2. Concretely:github.com/gofiber/fiber/v2is not listed insvelte-netlify/go.modsvelte-netlify/go.sum, so the toolchain never downloads or compiles itgo mod why -m github.com/gofiber/fiber/v2reports(main module does not need module github.com/gofiber/fiber/v2)It is a module-graph artifact, not a dependency of the build.
The fix
It is still reported by anything that resolves the module graph rather than the build list, so this pins it to the patched v2.52.14.
A plain indirect
requiredoes not work here. I tried it first, andgo mod tidydrops it again because no package in the main module needs it:A
replacesurvivestidyand selects v2.52.14 without changing what is compiled:All three Fiber v2 sites now resolve to v2.52.14.
Verification
go build ./...passes insvelte-netlifygo mod tidyleaves thereplacein place and does not otherwise altergo.modIf you would rather not carry a
replacefor a dependency that is never compiled, the alternative is to dismiss the alert as "vulnerable code is not actually used". Happy to drop this PR in that case.