Repository navigation
Add data.credentials support to Buildpack and CNB lifecycles - #5547
Merged
Merged
Conversation
johha
force-pushed
the
worktree-lifecycle-credentials-consistency
branch
4 times, most recently
from
October 14, 2026 12:44
6f9fd9f to
4568e76
Compare
Makes credential handling consistent across lifecycles by introducing data.credentials for both buildpack and CNB lifecycle types, stored encrypted in the buildpack_lifecycle_data table. - New migration adds encrypted_credentials_json / _salt columns to buildpack_lifecycle_data (previously CNB-only via cnb_lifecycle_data) - BuildpackLifecycleDataModel gains credentials accessors backed by set_field_as_encrypted; to_hash redacts the value - AppBaseLifecycle#update_lifecycle_data_model persists requested lifecycle fields (including credentials, honoring an explicit null to clear); staging reads credentials via LifecycleBase#credentials_for_staging - Buildpack lifecycle injects credentials into the custom buildpack URL for both the url and key fields, so the staging git clone (driven by key via -buildpackOrder) authenticates; CNB does not inject into the URL and relies solely on CNB_REGISTRY_CREDS - Validators enforce XOR between URL-embedded credentials and data.credentials, with a clearer message when the conflicting credentials are already stored - Manifest: unified top-level credentials key for both lifecycles, with cnb-credentials kept as a backward-compatible alias; specifying both is a validation error; an explicit null clears stored credentials - Redaction: audit events, the app manifest output, and the manifest diff all mask credentials and buildpack-URL userinfo (singular and plural keys) - url_has_userinfo? detects password-only userinfo (:token@host) - Docs: document data.credentials for both lifecycles and the manifest credentials / cnb-credentials keys
johha
force-pushed
the
worktree-lifecycle-credentials-consistency
branch
from
October 14, 2026 13:01
4568e76 to
83f7460
Compare
johha
marked this pull request as ready for review
October 14, 2026 13:35
philippthun
reviewed
Oct 16, 2026
- inject_credentials: normalize credentials with deep_stringify_keys so request-sourced (symbol-keyed) credentials are matched, not just stored (string-keyed) ones; a POST /v3/builds with inline lifecycle.data.credentials was otherwise silently skipped - inject_credentials: use CGI.escape for userinfo, matching the codebase convention (config.rb#escape_userinfo) - migration: size encrypted_credentials_json at 16_000 (was unsized -> varchar(255) on MySQL, too small for an encrypted multi-host credentials map), and grow the existing CNB encrypted_registry_credentials_json to match
philippthun
approved these changes
Oct 20, 2026
ari-wg-gitbot
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Oct 20, 2026
Changes in cloud_controller_ng:
- Add data.credentials support to Buildpack and CNB lifecycles
PR: cloudfoundry/cloud_controller_ng#5547
Author: Johannes Haass <johannes.haass@sap.com>
3 of 7 tasks
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds support for
data.credentialsto the buildpack lifecycle and unifies how credentials are provided across lifecycles. Previously only the CNB lifecycle had adata.credentialsfield; buildpack apps could only authenticate to private buildpacks by embedding credentials in the buildpack URL. This change makes credential handling consistent between the two lifecycles.Specifically:
credentials(encrypted at rest, in newencrypted_credentials_json/_saltcolumns onbuildpack_lifecycle_data).credentialskey that works for both buildpack and CNB apps. The existingcnb-credentialskey is kept as a backward-compatible alias. Specifying both is a validation error.urlandkeyentry fields) so the staging git clone - which is driven bykeyvia-buildpackOrder- authenticates. CNB continues to receive credentials only viaCNB_REGISTRY_CREDS; its buildpack URL stays clean.data.credentials. When the conflict is with already-stored credentials (not supplied in the same request), the error explains how to clear them.credentials: nullclears stored credentials; omitting the key leaves them untouched (consistent with the additive manifest contract).GET /v3/apps/:guidlifecycle data, the generated app manifest, the space manifest diff (both thecredentialskeys and userinfo embedded in buildpack URLs, singular andplural), and audit events.Example - buildpack app with a private git buildpack:
CC resolves the credentials at staging and injects them into the buildpack entry so the clone authenticates (pseudocode):
Example - clearing stored credentials:
Operators and developers can authenticate to private buildpacks (buildpack lifecycle) and private buildpack registries/images (CNB lifecycle) using a single, consistent manifest/API field instead of embedding secrets in buildpack URLs. This smooths and unifies the API ahead of further lifecycle work, and avoids credentials leaking into URLs that previously had to carry them inline.
I have reviewed the contributing guide
I have viewed, signed, and submitted the Contributor License Agreement
I have made this pull request to the
mainbranchI have run all the unit tests using
bundle exec rakeI have run CF Acceptance Tests