Skip to content

fix(ipa): IPA 108/106 read only check bug - #1574

Merged
lovisaberggren merged 2 commits into
mainfrom
CLOUDP-416905
Nov 2, 2026
Merged

lovisaberggren merged 2 commits into
mainfrom
CLOUDP-416905

Conversation

@lovisaberggren

@lovisaberggren lovisaberggren commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Proposed changes

xgen-IPA-106-readonly-resource-should-not-have-create-method and xgen-IPA-108-readonly-resource-should-not-have-delete-method treat a resource as read-only when all fields in its GET response are readOnly. This inaccurately flags resources that are managed through create and delete but have no writable GET fields (treated by IPA validation as read-only resources), for example the SA/mcpConfig secrets, where the Create request takes secretExpiresAfterHours and the response only has an expiry timestamp. This causes unnecessary exceptions to be present in the spec.

We still want these rules to catch new read-only resources that get a POST or DELETE, so I did not change how read-only is detected. Instead:

  • IPA-106: skip the rule if the Create request body content has an exception for xgen-IPA-106-create-method-request-body-is-get-method-response. The exception already states that the request takes input that is not in the GET response, so the resource is managed through Create.
  • IPA-108: skip the rule if the resource has a standard Create method (a POST on the resource collection path, custom methods excluded). A resource that can be created can be deleted, and the Create method itself is evaluated by IPA-106.
  • Update the rule descriptions and the generated ruleset README.

Things to consider:

  • The new checks are in the 106 and 108 rule functions, not in isReadOnlyResource(). That function is shared with IPA-107 and both IPA-113 rules, which are unchanged.
  • This only removes violations, so I don't expect a breaking release. Existing 106/108 readonly exceptions that are now redundant are not reported as unnecessary, because these rules return before the unnecessary-exception check (this was already the case for resources that are not read-only). CLOUDP-453864 is the general fix for stale exceptions and should cover this in the future, though I'll still follow up in MMS and remove stale exceptions so that CLOUDP-453864 don't need to cover these too.
    • I'll release this change as a patch version since it's backwards compatible

Testing

  • Added tests for IPA-106 and IPA-108
  • Added unit tests for hasStandardCreateMethod() in resourceEvaluation.test.js.
  • Ran npm run ipa-validation on openapi/.raw/v2.yaml with the 4 exceptions for the mcpConfig secrets (group and org, 106 and 108) removed locally. There are no 106/108 readonly errors.

Jira ticket: CLOUDP-416905

@lovisaberggren lovisaberggren changed the title CLOUDP-416905: IPA 108/106 read only check bug fix(ipa): IPA 108/106 read only check bug Oct 28, 2026
@lovisaberggren
lovisaberggren marked this pull request as ready for review October 28, 2026 17:13
@lovisaberggren
lovisaberggren requested a review from a team as a code owner October 28, 2026 17:13

@gssbzn gssbzn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Logic in both rules and hasStandardCreateMethod looks correct, and the tests cover the new branches (including the custom-method and unrelated-exception negatives).

Two non-blocking notes:

  1. IPA-108 now skips any read-only resource with a POST. If 106 is excepted on that POST at the operation level, a DELETE on the same resource also goes unflagged. Acceptable since 106 owns the Create check, but maybe worth noting in the 108 description that it relies on 106.
  2. IPA-106 now depends on the create-method-request-body-is-get-method-response exception. If that exception is later removed as stale, 106 will start firing. Worth keeping in mind for CLOUDP-453864.

Optional: a test with multiple media types on the request body, to cover the .some() path.

@lovisaberggren

Copy link
Copy Markdown
Collaborator Author

IPA-108 now skips any read-only resource with a POST. If 106 is excepted on that POST at the operation level, a DELETE on the same resource also goes unflagged. Acceptable since 106 owns the Create check, but maybe worth noting in the 108 description that it relies on 106.

This is added to the description and the README 👍

IPA-106 now depends on the create-method-request-body-is-get-method-response exception. If that exception is later removed as stale, 106 will start firing. Worth keeping in mind for CLOUDP-453864.

Yes, I will follow-up with removing unneccesary exceptions even though they won't fire until CLOUDP-453864, so the scope of CLOUDP-453864 is a bit smaller

@lovisaberggren
lovisaberggren merged commit 1c52a9d into main Nov 2, 2026
9 checks passed
@lovisaberggren
lovisaberggren deleted the CLOUDP-416905 branch November 2, 2026 12:03
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