Skip to content

fix(operations): classify file refs by scheme to support absolute paths#2739

Open
AruneshDwivedi wants to merge 1 commit into
kyverno:mainfrom
AruneshDwivedi:fix/absolute-file-path
Open

fix(operations): classify file refs by scheme to support absolute paths#2739
AruneshDwivedi wants to merge 1 commit into
kyverno:mainfrom
AruneshDwivedi:fix/absolute-file-path

Conversation

@AruneshDwivedi

@AruneshDwivedi AruneshDwivedi commented Jun 13, 2026

Copy link
Copy Markdown

fileRefOrResource and fileRefOrCheck use url.ParseRequestURI(ref) to distinguish URLs from local file paths. But ParseRequestURI treats absolute local paths like /home/user/file.yaml as valid URIs (they have no scheme but ParseRequestURI accepts them).

The fix checks for a non-empty scheme instead. If the parsed URI has no scheme, it's a local file path. This lets chainsaw load test files from absolute paths without treating them as URLs.

Fixes #2739

url.ParseRequestURI treats absolute local paths (e.g. /tmp/cm.yaml)
as valid URIs, routing them through go-getter (LoadFromURI) instead
of reading from disk (Load). This caused apply/assert with absolute
file: paths to fail with 'found no test in <path>'.

Fix: check for a non-empty scheme to distinguish real URLs from
local paths. Also handle absolute paths explicitly (no basePath
prefix) before falling back to relative paths.

Fixes kyverno#2735

Signed-off-by: Arunesh Dwivedi <arunesh.devops@gmail.com>
@AruneshDwivedi AruneshDwivedi requested a review from a team as a code owner June 13, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant