Skip to content

fix(validation): rewrite P-016 as a per-field sinkCredential writeOnly check#383

Merged
hdamker merged 1 commit into
camaraproject:mainfrom
hdamker:fix/p016-sinkcredential-writeonly
Jul 21, 2026
Merged

fix(validation): rewrite P-016 as a per-field sinkCredential writeOnly check#383
hdamker merged 1 commit into
camaraproject:mainfrom
hdamker:fix/p016-sinkcredential-writeonly

Conversation

@hdamker

@hdamker hdamker commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

correction

What this PR does / why we need it:

Commonalities r4.3 (camaraproject/Commonalities#633, guide-aligned by #656) replaced the blanket "sinkCredential MUST NOT appear in responses" ban with a partial-disclosure model: sinkCredential MAY appear in POST/GET responses, but its secret sub-fields — accessToken/accessTokenType (AccessTokenCredential), clientId/tokenUri (PrivateKeyJWTCredential) — MUST be writeOnly: true. P-016 (check-sinkcredential-not-in-response) was muted pending this design decision.

Rewrites the check as check-sinkcredential-secrets-writeonly: a schema-definition scan for SinkCredential discriminator subtypes (allOf referencing SinkCredential) rather than a response-schema traversal — sinkCredential is typed as the polymorphic base, so a response check would resolve to the base and never see the secrets, which live on the subtypes. This also covers implicit subscription uniformly (no /subscriptions path) and passes trivially on specs that only reference the common schema (no local subtype to check).

Lifts the mute with a graded severity ramp (warn for draft/alpha/rc, error at public) gated to commonalities_release: ">=r4.3", so pre-0.8.0 APIs (which predate writeOnly) aren't checked at all.

Which issue(s) this PR fixes:

Part of #297

Special notes for reviewers:

Replaced TestCheckSinkCredentialNotInResponse with TestCheckSinkCredentialSecretsWriteOnly in test_python_checks_subscription.py, covering the clean-subtype case, missing/false writeOnly on each secret field, response-visible fields being ignored, common-$ref specs (no local subtype), implicit-subscription coverage, and a false-positive guard for a generic non-subtype clientId field.

The regression/r4.3-broken-spec-subscriptions branch on camaraproject/ReleaseTest has been reworked to match (its old sinkCredential-in-response defect no longer trips this rule) and pushed; final fixture recapture is pending this PR reaching validation-framework.

Test evidence:

  • python3 -m pytest validation/tests -q — 1180 passed; 3 pre-existing, unrelated test_yaml_parser_conformance.py failures (reproduce identically on an unmodified checkout).

Changelog input

release-note
Rewrote P-016 to check sinkCredential secret fields are writeOnly (r4.3 partial-disclosure model), lifting the mute from #297.

Additional documentation

This section can be blank.

…y check

r4.3 replaced the blanket response ban with a partial-disclosure model
(Commonalities#633); detection moves from response-schema traversal to a
schema-definition scan for SinkCredential subtypes, since secrets live on the
discriminator subtypes, not the polymorphic base. Lifts the mute from
tooling#297 with a graded warn/error ramp gated to commonalities_release >=r4.3.
@hdamker
hdamker requested review from Kevsy and rartych as code owners July 17, 2026 05:38

@rartych rartych 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.

LGTM

@hdamker
hdamker merged commit 52c6e93 into camaraproject:main Jul 21, 2026
8 checks passed
@hdamker
hdamker deleted the fix/p016-sinkcredential-writeonly branch July 21, 2026 09:12
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