Skip to content

Fix panic in manifest diff when env value is not a map - #3904

Open
jochenehret wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:main_fix_manifest_redacted_diff
Open

jochenehret wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:main_fix_manifest_redacted_diff

Conversation

@jochenehret

Copy link
Copy Markdown
Contributor

This PR has been created with Claude Code.

Description of the Change

Caused by cloudfoundry/cloud_controller_ng#5712

redactDiff and redactEnvVarsInRawManifest asserted env values to be maps unconditionally, crashing with "interface conversion: interface {} is string, not map[string]interface {}" on cf push --redact-env when a diff path ending in "env" (or a raw manifest's env key) carried a non-map value. Use comma-ok assertions and redact the value directly in that case. Adds regression tests for both paths.

Why Is This PR Valuable?

Fixes possible go panics when pushing with --redact-env.

Applicable Issues

How Urgent Is The Change?

Issue blocks the cf-deployment validation:
https://concourse.wg-ard.ci.cloudfoundry.org/teams/main/pipelines/cf-deployment/jobs/fresh-deploy/builds/2490

But we'll apply a workaround for now.

CAPI 1.253.0 (cloud_controller_ng PR #5712) redacts sensitive manifest
values server-side, sending the env map in the manifest diff as the
string "[PRIVATE DATA HIDDEN]". redactDiff assumed any diff whose path
ends in "env" carried a map and asserted diff.Value.(map[string]interface{})
unconditionally, so `cf push --redact-env` crashed with "interface
conversion: interface {} is string, not map[string]interface {}".

Use comma-ok assertions in redactDiff and redactEnvVarsInRawManifest and
redact the value directly when it is not a map. Adds regression tests for
both paths.

cloudfoundry/cloud_controller_ng#5712

This branch has not been deployed

No deployments
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