Repository navigation
Description
chainsaw version Version
v0.2.15
Description
Disclosure, I did have Claude write this issue since it found the problem for me when i encountered this issue after updating kyverno chainsaw locally. I verified myself that ParseRequestURI works as Claude asserts, in terms of how it parses absolute paths.
On chainsaw v0.2.15 (works on v0.2.14 and earlier), referencing a manifest by an absolute path fails to load it and reports found no test in <path>, even though the file is a valid, non-empty manifest. The same file via a relative path loads fine. This is easy to hit because file: is an expression that resolves to an absolute path at runtime (e.g. file: ($values.gwc) → /tmp/tmp.XXXXXX/gwc.yaml).
Root cause: pkg/runner/operations/helpers.go classifies local-file vs URL with url.ParseRequestURI:
url, err := url.ParseRequestURI(ref)
if err != nil {
return resource.Load(filepath.Join(basePath, ref), true) // local
} else {
return resource.LoadFromURI(url, true) // go-getter
}url.ParseRequestURI interprets its input "only as an absolute URI or an absolute path", so /tmp/x.yaml parses without error and is wrongly routed through LoadFromURI (go-getter) instead of being read off disk — which then fails, hence the misleading found no test for a plainly local file.
Proposed fix: classify by scheme instead, in both fileRefOrResource and fileRefOrCheck (go-getter already provides getter.Detect for this):
if u, err := url.ParseRequestURI(ref); err == nil && u.Scheme != "" {
return resource.LoadFromURI(u, manifest) // genuine URL (http/https/file/git/s3/…)
}
if filepath.IsAbs(ref) {
return resource.Load(ref, manifest) // absolute local path — don't prepend basePath
}
return resource.Load(filepath.Join(basePath, ref), manifest)Steps to reproduce
- Create a valid manifest at an absolute path, e.g.
/tmp/cm.yaml(a ConfigMap). - Run a
Testwhose step doesapply: { file: /tmp/cm.yaml }(orfile: ($values.x)bound to that absolute path).
Result: found no test in /tmp/cm.yaml. The same file referenced relatively (file: cm.yaml) applies successfully.
Expected behavior
An absolute path to a local file is loaded from disk (like a relative path is), and the resource is applied. Only refs with an actual URL scheme should go through the go-getter loader.
Screenshots
No response
Logs
Slack discussion
No response
Troubleshooting
- I have searched other issues in this repository and mine is not recorded.
Activity
LoveChauhan-18 commentedon Jun 6, 2026
Hi, I would like to work on this issue. Can you please assign it to me!
senutpal commentedon Jun 6, 2026
/assign