GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: hash the full source spec for the cache key by gangadhar-res · Pull Request #9970 · updatecli/updatecli

Conversation

@gangadhar-res

@gangadhar-res gangadhar-res commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What

The source cache key (pkg/core/cache/source.go) now hashes the full user-provided spec from ResourceConfig instead of resource.ReportConfig().

Why

ReportConfig() exists to redact resource configuration for reports and predates the cache (#4898). Eleven plugins omit result-affecting spec fields from it (e.g. shell omits workdir, yaml omits documentindex), so two distinct sources could silently share a cache entry and the second received the first one's value — no error, no warning, just a wrong value written to the target.

This implements option 2 from the issue discussion: the cache key gets its own complete input, ReportConfig keeps its original reporting purpose, and no per-plugin changes are needed — the whole bug class is removed at the one call site.

Notes:

  • Secret-bearing spec fields are safe to include: only the SHA256 digest is ever stored or logged, so distinct secrets stay distinct without appearing anywhere.
  • Hashing stays deterministic: specs decode via yaml.v3 into map[string]interface{} and encoding/json marshals maps with sorted keys.
  • The resource is still instantiated first, so unknown kinds or malformed specs keep returning the empty-key cache-miss sentinel.

Testing

  • New regression test: two shell sources differing only in workdir (a field ReportConfig omits) get different keys, while identical specs still share one — both as typed specs and as YAML-decoded map specs, plus hash stability across decodes. Both new tests fail on main by construction.
  • go test ./pkg/core/cache/ passes; go build ./..., gofmt, go vet, and golangci-lint introduce no new findings.

Fixes #9849

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

loispostula reacted with hooray emoji
All reactions
  • 🎉 1 reaction
gangadhar-res and others added 3 commits August 14, 2026 15:47
@gangadhar-res
fix: hash the full source spec for the cache key
85711ee
The source cache key hashed resource.ReportConfig(), which exists to
redact resource configuration for reports and predates the cache.
Eleven plugins omit result-affecting spec fields from ReportConfig
(e.g. shell omits workdir, yaml omits documentindex), so two distinct
sources could silently share a cache entry and the second one received
the first one's value.

Hash the full user-provided spec from ResourceConfig instead, keeping
ReportConfig for its original reporting purpose. Secret-bearing fields
are safe to include since only the SHA256 digest is ever stored or
logged, and the encoding stays deterministic: yaml.v3 decodes specs
into map[string]interface{} and encoding/json sorts map keys. The
resource is still instantiated first so unknown kinds or malformed
specs keep returning the empty-key cache-miss sentinel.

Regression tests cover two shell sources differing only in workdir
(a field ReportConfig omits) both as typed specs and as YAML-decoded
map specs, plus identical specs still sharing a key.

Fixes updatecli#9849

Signed-off-by: Gangadhar Chalapaka <[email protected]>
@olblak
Merge branch 'main' into fix/cache-key-full-spec
cb4b803
@gangadhar-res
Merge branch 'main' into fix/cache-key-full-spec
54d8aaf
@gangadhar-res

gangadhar-res commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

@olblak Could I have a review on this pr ? thanks

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olblak

olblak commented Aug 16, 2026

Copy link
Copy Markdown
Member

@olblak Could I have a review on this pr ? thanks

Thanks for the pull request but I can't review it at the moment

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

olblak added 2 commits August 22, 2026 14:22
@olblak
Merge branch 'main' into fix/cache-key-full-spec
b0536e9
@olblak
Merge branch 'main' into fix/cache-key-full-spec
22fad49
olblak
olblak reviewed Aug 24, 2026
View reviewed changes
Comment thread pkg/core/cache/source.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

olblak
olblak reviewed Aug 24, 2026
View reviewed changes
Comment thread pkg/core/cache/source.go Resolved

Uh oh!

There was an error while loading. Please reload this page.

@olblak olblak added bug Something isn't working core All things related to Updatecli core engine labels Aug 24, 2026
@gangadhar-res
chore: trim the Key doc comment to current behaviour
e523e2e
@mergify

mergify Bot commented Aug 25, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@olblak
olblak merged commit c23bfe6 into updatecli:main Aug 25, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@olblak olblak olblak left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working core All things related to Updatecli core engine

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Source cache key is incomplete for 11 plugins whose ReportConfig omits result-affecting spec fields

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gangadhar-res @olblak
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.