crossplane-contrib / crossplane-contrib/function-kcl

Possible fix(deps): 3 vulnerable dependencies in go.mod

Open Beginner friendly
#445 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
87
Forks
44
Avg merge
13h 15m
Merged PRs (30d)
14

Description

Came across something in `go.mod` around line 1 that looked worth flagging.

VULNERABILITY: The project uses github.com/buger/jsonparser v1.1.1, affected by CVE-2026-32285 (HIGH severity). The Delete() function fails to validate offsets when processing malformed JSON, causing a computed slice index to become negative and triggering an unrecovered runtime panic ('slice bounds out of range'). IMPACT: jsonparser is typically used to parse untrusted input (API request bodies, webhooks, message queues). An attacker can crash the entire Go process with a single crafted payload, resulting in a trivially exploitable denial-of-service. Since Go's http.Server does not recover panics per-connection in all middleware configurations, repeated requests can take the service down entirely. RISK: HIGH — remote, unauthenticated DoS if any endpoint feeds attacker-controlled JSON into jsonparser.Delete(). REMEDIATION: Upgrade to v1.1.2, which adds proper offset validation. As defense-in-depth, wrap jsonparser.Delete() calls in a recover() guard for untrusted input paths.

Something like this might fix it:

```diff
diff --git a/go.mod b/go.mod
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module example.com/yourapp

require (
- github.com/buger/jsonparser v1.1.1
+ github.com/buger/jsonparser v1.1.2
)

# Regenerate go.sum and verify:
# go mod tidy && go build ./... && go test ./...

// Optional defense-in-depth (wrap untrusted-input call sites):
// helper.go
+import (
+ "fmt"
+ jsonparser "github.com/buger/jsonparser"
+)
+
+func SafeDelete(data []byte, keys ...string) (out []byte, err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ err = fmt.Errorf("jsonparser: rejected malformed input")
+ out = data
+ }
+ }()
+ return jsonparser.Delete(data, keys...)
+}
```

For reference: rule `CVE-2026-32285`. Rated high.

I do not maintain this project, so I may well be missing context — if this is intentional or already handled elsewhere, please just close it.

---
*Found with automated scanning ([RedGem](https://code.redgem.net)) and reviewed before opening. If it is not useful, closing it is completely fine.*

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with go.mod around the dependency declaration for github.com/buger/jsonparser. Run go mod tidy, then go build ./... and go test ./... as requested in the issue. Done means the dependency and go.sum reflect the remediated version and the build and tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
security
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.