Skip to content

fix(docker): don't send docker credentials in the V3 apply_manifest request. - #1410

Merged
ZPascal merged 3 commits into
cloudfoundry:5.x.xfrom
nico-kn:patch-1
Nov 24, 2026
Merged

ZPascal merged 3 commits into
cloudfoundry:5.x.xfrom
nico-kn:patch-1

Conversation

@nico-kn

@nico-kn nico-kn commented Nov 20, 2026 •

Copy link
Copy Markdown

CAPI records the full manifest YAML verbatim in the audit.app.apply_manifest event and does not redact docker.password. Including credentials in the manifest therefore leaks them into the audit log.

This fix strips docker credentials from the manifest copy sent to applyManifest in pushManifestV3, leaving ApplicationManifestUtilsCommon.toDockerYaml unchanged so V2 manifest serialization is unaffected. Both username and password are stripped together — keeping username without password would violate the @Value.Check invariant on ManifestV3Application.

createPackage still reads credentials from the original request.getManifest(), so the Docker image pull continues to work:

  • Calls cloudFoundryClient.packages().create(...)
  • Builds a DockerData with .username(...) and .password(...)
  • Sends POST /v3/packages with {"data": {"image": "...", "username": "...", "password": "..."}} — CAPI redacts the password in the resulting audit.app.package.create event

@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: nico-kn / name: nico-kn (0c46b68)

@nico-kn
nico-kn changed the base branch from main to 5.x.x November 20, 2026 22:43
CAPI records the full manifest YAML verbatim in the
audit.app.apply_manifest event and does not redact docker.password.
Including the password in the manifest therefore leaks it into the audit
log. Docker credentials must be passed via POST /v3/packages
(createPackage), not embedded in the manifest.
- Rename stripDockerPasswords to stripDockerCredentials (strips both
  username and password since @Value.Check prohibits username without password)
- Restore ApplicationManifestUtilsCommon.toDockerYaml to upstream state
  (password omission moved to V3-only path in DefaultApplications)
- Update comment to reference credentials instead of password
- Add two tests: round-trip and credential stripping

@ZPascal ZPascal left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update; moving the stripping into pushManifestV3 looks good to me. Clearing both username and password is also the right call, since the model doesn't allow a username without a password. A few things need to be adjusted before this can go in. You can find my findings as inline comments below.

PS: The PR title still talks about YAML serialization, which this change doesn't really touch anymore. You can change it to fix(docker): don't send docker credentials in the V3 apply_manifest request.

@nico-kn nico-kn changed the title fix(docker): omit docker password from manifest YAML serialization fix(docker): don't send docker credentials in the V3 apply_manifest request. Nov 24, 2026

@ZPascal ZPascal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @nico-kn for the contribution and the fix!

@ZPascal
ZPascal merged commit 6550b6d into cloudfoundry:5.x.x Nov 24, 2026
6 checks passed
@nico-kn
nico-kn deleted the patch-1 branch November 24, 2026 15:59
ZPascal added a commit to ZPascal/cf-java-client that referenced this pull request Nov 24, 2026
Follow-up to cloudfoundry#1410:
- Add a DefaultApplicationsTest case for pushManifestV3 that checks the
  apply_manifest body has no docker credentials while the package request
  still gets them.
- Move the stripDockerCredentials test to DefaultApplicationsTest and cover
  several apps, untouched apps and kept fields.
- Only skip stripping when both username and password are missing.
- Delete the temp manifest files written by ApplicationManifestUtilsV3Test.
ZPascal added a commit to ZPascal/cf-java-client that referenced this pull request Nov 24, 2026
Follow-up to cloudfoundry#1410:
- Add a DefaultApplicationsTest case for pushManifestV3 that checks the
  apply_manifest body has no docker credentials while the package request
  still gets them.
- Move the stripDockerCredentials test to DefaultApplicationsTest and cover
  several apps, untouched apps and kept fields.
- Only skip stripping when both username and password are missing.
- Delete the temp manifest files written by ApplicationManifestUtilsV3Test.
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.

2 participants