Skip to content

Reach nested credentials, and lint workflow files - #35

Merged
norman-abramovitz merged 3 commits into
masterfrom
nested-credentials-and-actionlint
Jul 28, 2026
Merged

Reach nested credentials, and lint workflow files#35
norman-abramovitz merged 3 commits into
masterfrom
nested-credentials-and-actionlint

Conversation

@norman-abramovitz

Copy link
Copy Markdown
Contributor

Nested credential access (#23, #11)

CredentialString does a single top-level lookup and asserts the value is a
string, so a credential like protocols.amqp.uri was unreachable and a
non-string leaf like protocols.amqp.ssl returned false.

  • Service.Credential(keys ...string) (interface{}, bool) walks the
    credentials one key at a time and returns the value with its own type —
    string, bool, the float64 a JSON number decodes to, or a nested map or
    slice.
  • Service.CredentialPath("protocols.amqp.uri") is the dot-delimited form,
    built on Credential.

Keys are passed separately in the primitive because VCAP_SERVICES credentials
are broker-defined free-form JSON and a key may itself contain a dot — jdbc.url
is a common one. The dotted form splits on every dot and so cannot address those;
the doc comment states the limitation and points at Credential.

CredentialString is deliberately untouched: making it path-aware would silently
change behavior for any existing caller whose key contains a dot.

Issue #11 needed no code — its payload decodes cleanly today, since Credentials
is map[string]interface{}. That payload is pinned as a regression test.

API impactgorelease -base=v1.19.1:

## compatible changes
(*Service).Credential: added
(*Service).CredentialPath: added

# summary
Suggested version: v1.20.0

Purely additive; no existing signature or behavior altered.

actionlint

Workflow files are executable configuration, and YAML validity says nothing about
whether they run. Last release cycle a duplicate env: key made CI parse to zero
jobs. make actionlint catches that class, auto-installing on demand the way
mk/security.mk does for govulncheck and gosec.

It is wired into make check and listed as its own step in the CI quality-gates
job — that job runs the gates individually rather than calling make check, because
golangci-lint comes from the action instead of make lint.

Verification

  • make check clean, make test-race passes
  • coverage 89.4% → 90.9%

Closes #23
Closes #11

Workflow files are executable configuration, and YAML validity says
nothing about whether they run. A duplicate env: key made CI parse to
zero jobs last release; actionlint flags it.

The target auto-installs on demand, matching how mk/security.mk handles
govulncheck and gosec. The CI quality-gates job lists the gates
individually rather than calling `make check`, so actionlint is wired in
both places.
CredentialString does a single top-level lookup and asserts the value is
a string, so a credential like protocols.amqp.uri was unreachable and a
non-string leaf such as protocols.amqp.ssl returned false.

Credential takes keys separately, so every key is addressable including
one containing a dot, which brokers do emit (jdbc.url). CredentialPath
adds the dotted form on top; it cannot address such a key, and the doc
comment says so and points at Credential.

CredentialString is left alone: making it path-aware would silently
change behavior for callers whose key contains a dot.

Also pins the issue #11 payload, whose nested object once panicked the
decoder, as a regression test.

Closes #23
Closes #11
@norman-abramovitz
norman-abramovitz merged commit cd91395 into master Jul 28, 2026
6 checks passed
@norman-abramovitz
norman-abramovitz deleted the nested-credentials-and-actionlint branch July 29, 2026 10:05
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.

CredentialString(key string) can not deal with multi-layer keys JSON parsing fails for VCAP_SERVICES with complex credentials

1 participant