Repository navigation
Conversation
github.com/disintegration/imaging v1.6.2 was required for a single call, imaging.Resize in gvc/image_renderer.go. The module is unmaintained (last release in 2019) and carries CVE-2023-36308 with no fixed version, so every binary that imports go-graphviz is flagged by Trivy, Grype and govulncheck. Resize with draw.CatmullRom.Scale from golang.org/x/image/draw instead, which is already a dependency through golang.org/x/image, and drop imaging from go.mod. resizeImage keeps imaging.Resize's behaviour for a zero width or height (the missing side follows the aspect ratio; both zero returns the image unchanged). No public API changes, no new dependency.
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.
Fixes #129.
github.com/disintegration/imagingv1.6.2 was required for one call,imaging.Resizeingvc/image_renderer.go. The module is unmaintained (last release 2019) and carries CVE-2023-36308 with no fixed version, so every binary importing go-graphviz gets flagged by Trivy, Grype and govulncheck.This replaces that call with
golang.org/x/image/draw(draw.CatmullRom.Scale), which is already a dependency throughgolang.org/x/image, and removesimagingfromgo.mod/go.sum.resizeImagekeepsimaging.Resize's semantics for a zero width or height: the missing side is derived from the aspect ratio, and both zero returns the image unchanged. Catmull-Rom is the highest-quality kernel inx/image/draw.gvc/image_renderer_test.gocovering the three size cases and the zero-size passthrough.cmd/dot/go.modis left untouched: it builds against the publishedgo-graphvizversion and will pick the change up on its next bump.