Skip to content

[WPB-27953] Make scim error responses comply with RFC7644. - #5439

Open
fisx wants to merge 9 commits into
developfrom
WPB-27953-make-scim-error-responses-comply-with-rfc7644
Open

[WPB-27953] Make scim error responses comply with RFC7644.#5439
fisx wants to merge 9 commits into
developfrom
WPB-27953-make-scim-error-responses-comply-with-rfc7644

Conversation

@fisx

@fisx fisx commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Fixes #5434

This changes the error response body schema for most of the SCIM api. The release notes contain a warning about this with instructions how to re-align code. If anybody is impacted by this change, they are in violation of the RFC as we were and should follow the release note instructions.

https://wearezeta.atlassian.net/browse/WPB-27953
https://wearezeta.atlassian.net/browse/WPB-17623

Checklist

  • Are there any SCIM end-points that throw non-scim spar errors? If so, fix them, too!
  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Aug 11, 2026
@fisx

fisx commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author
  • Are there any SCIM end-points that throw non-scim spar errors? If so, fix them, too!

This is ruled out by the type signatures on the UserDB, GroupDB instances: ScimHandler is the only way of throwing errors (besides undefined and friends, of course).

@fisx
fisx force-pushed the WPB-27953-make-scim-error-responses-comply-with-rfc7644 branch from c198abc to c0b8ea0 Compare August 12, 2026 11:02
@fisx
fisx marked this pull request as ready for review August 12, 2026 13:15
@fisx
fisx requested review from a team as code owners August 12, 2026 13:15
Comment thread services/spar/test/Test/Spar/ErrorSpec.hs Outdated
-- RFC 7644 section 3.12 requires that the response body of a SCIM error *is*
-- the SCIM error object, not a wire-server 'Wai.Error' with the SCIM error
-- object nested (double-encoded) into its 'message' field.
it "renders a SCIM error as the bare RFC 7644 error object" $ do

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.

This test is great to show that the rendering works. But, it would also be good to prove that it is actually used. Either with dedicated integration or effect tests or by adding assertions to existing tests. I would lean to the latter, because that's quicker to do.

@fisx
fisx force-pushed the WPB-27953-make-scim-error-responses-comply-with-rfc7644 branch from 893df62 to af00e70 Compare August 13, 2026 12:27
@fisx
fisx requested a review from supersven August 13, 2026 12:28
Comment thread services/spar/test-integration/Util/Scim.hs Outdated
mkScimErrorResp ::
Maybe Text ->
Maybe Text ->
Text ->

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.

Suggested change
Text ->
Int ->

I would use Int here instead of handing integers around as strings. However, I'm in nitpicking mode 馃

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you're right, but i don't think it's important enough to go another CI round. (we need more ergonomic CI!)

yell at me if insist, otherwise i'll ignore you :)

Co-authored-by: Sven Tennie <sven.tennie@wire.com>
@fisx
fisx requested a review from supersven August 13, 2026 13:40
Comment on lines +2324 to +2325
deleteUser_ (Just tok) Nothing (env ^. teSpar) !!! do
const 405 === statusCode

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.

Have you forgotten something here? Or, is deleteUser_'s error message well enough tested (I'd say so) and you just like do blocks? 馃檭

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i added the do-block mechanically to add the assertion on the body; then i realized that the body was empty; then i realized that this is a stupid smoke test on a route that isn't even defined in the standard (/Users/:id is defined, but /Users is not), and i decided it's not a very important test and testing the status is enough.

then i forgot to remove the do block. :)

=== statusCode
>>= fmap Search.searchResults . responseJsonError

-- | Assert the exact body of an error response from an endpoint that is /not/ scim: brig has

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.

Suggested change
-- | Assert the exact body of an error response from an endpoint that is /not/ scim: brig has
-- | Create the exact body of an error response from an endpoint that is /not/ scim: brig has

馃 (I would expect a call to should... or === and friends to justify the word assert here.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, that was wrong. i thought that this would never happen so i didn't see the need to name the entire thing after it, but it turned out it did happen, and legitimately...

assert removed!

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

Looks good enough, given the other comments are addressed (or dropped with good reasons) 馃憤

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SCIM Error Responses Not Compliant with RFC 7644 Section 3.12

3 participants