Skip to content

fix(cloudrun): guard against nil panics in manifest parsing, client options, and cache type assertion#6562

Open
mihir-dixit2k27 wants to merge 2 commits intopipe-cd:masterfrom
mihir-dixit2k27:fix/cloudrun-provider-panics
Open

fix(cloudrun): guard against nil panics in manifest parsing, client options, and cache type assertion#6562
mihir-dixit2k27 wants to merge 2 commits intopipe-cd:masterfrom
mihir-dixit2k27:fix/cloudrun-provider-panics

Conversation

@mihir-dixit2k27
Copy link

What this PR does

Fixes four nil-panic risks in pkg/app/piped/platformprovider/cloudrun/:

  • servicemanifest.go: ParseServiceManifestsigs.k8s.io/yaml
    unmarshals empty input without error but leaves obj.Object nil,
    panicking on any subsequent field access. Added nil Object guard.
  • revisionmanifest.go: ParseRevisionManifest — same issue, same fix.
  • client.go: List/ListRevisions dereference options.Limit
    immediately — nil options panics. Default to empty struct instead.
  • cache.go: Bare item.(ServiceManifest) assertion panics on type
    mismatch. Replaced with comma-ok pattern + structured error log.

Why we need it

All four are silent — only surface in production under specific inputs
(empty config file, nil options, cache collision). Fixes are minimal
and non-breaking; valid inputs follow identical code paths as before.

Does this PR introduce a user-facing change?

  • How are users affected: Empty service.yaml now returns a clear
    error instead of panicking. All other behavior unchanged.
  • Is this a breaking change: No.
  • How to migrate: No migration needed.

@mihir-dixit2k27 mihir-dixit2k27 requested a review from a team as a code owner March 7, 2026 17:06
…ptions, and cache type assertion

- ParseServiceManifest: return error when YAML unmarshal produces nil Object map (empty/nil input)
- ParseRevisionManifest: same nil Object guard
- client.List/ListRevisions: default to empty options struct when nil is passed
- ServiceManifestCache.Get: use comma-ok type assertion to prevent panic on cache type mismatch

Signed-off-by: Mihir Dixit <dixitmihir1@gmail.com>
@mihir-dixit2k27 mihir-dixit2k27 force-pushed the fix/cloudrun-provider-panics branch from 3ca77f3 to 1eb5edf Compare March 7, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant