Repository navigation
fix(ipa): IPA 108/106 read only check bug - #1574
Conversation
gssbzn
left a comment
There was a problem hiding this comment.
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:
- 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.
- IPA-106 now depends on the
create-method-request-body-is-get-method-responseexception. 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.
This is added to the description and the README 👍
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 |
Proposed changes
xgen-IPA-106-readonly-resource-should-not-have-create-methodandxgen-IPA-108-readonly-resource-should-not-have-delete-methodtreat a resource as read-only when all fields in its GET response arereadOnly. 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 takessecretExpiresAfterHoursand 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:
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.Things to consider:
isReadOnlyResource(). That function is shared with IPA-107 and both IPA-113 rules, which are unchanged.Testing
hasStandardCreateMethod()inresourceEvaluation.test.js.npm run ipa-validationonopenapi/.raw/v2.yamlwith 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