Skip to content

Conversation

@azmeuk
Copy link
Contributor

@azmeuk azmeuk commented May 2, 2024

This is an implementation of MSC4098. It implements a subset of the SCIM provisioning protocol defined in RFC7643 and RFC7644.

It contains:

  • A SCIM servlet implementing the minimal SCIM endpoints.
    • The data edition/retrieval part largely takes inspiration (and shameless copied) from synapse/rest/admin/users.py.
    • The SCIM payload validation and production is achieved with scim2-models, a library based on pydantic which I maintain.
  • Unit tests for those endpoints.
  • Documentation on the state of the SCIM implementation, and examples of requests and response payloads.

The SCIM requires needs python 3.9+ (because of the use of typing.Anotated in scim2-models) and pydantic 2.7.0+

SCIM implementation details

Only a subset of the SCIM endpoints are implemented:

What's implemented:

  • The main endpoints:
    • /Users (GET, POST)
    • /Users/<user_id> (GET, PUT, DELETE)
    • /ServiceProviderConfig (GET)
    • /Schemas (GET)
    • /Schemas/<schema_id> (GET)
    • /ResourceTypes (GET)
    • /ResourceTypes/<resource_type_id>
  • pagination
  • The user attributes:
    • userName
    • password
    • emails
    • phoneNumbers
    • displayName
    • photos (as a MXC URI)
    • active

What is defined in the SCIM specs but not implemented here:

What do you think?

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct
    (run the linters)

@azmeuk azmeuk requested a review from a team as a code owner May 2, 2024 14:49
@azmeuk azmeuk marked this pull request as draft May 2, 2024 14:50
@azmeuk azmeuk force-pushed the msc4098-scim branch 4 times, most recently from ea6a6d6 to dd52360 Compare May 3, 2024 16:06
@erikjohnston erikjohnston removed the request for review from a team May 14, 2024 12:14
@erikjohnston
Copy link
Member

(I've taken this out of the review queue as its in draft, let us know if you want feedback)

@azmeuk
Copy link
Contributor Author

azmeuk commented May 27, 2024

Hi @erikjohnston
Thank you for your feedback offering. Indeed this is a draft, but I hope to take back the development soon.

There is one design question though. I see that there is a dependency to pydantic in synapse, and I recently published scim2-models that is a library that helps to parse and serialize SCIM2 payloads using pydantic. I think the SCIM implementation would greatly benefit from using scim2-models, as a big part of the specification compliance would be delegated to the library.

Would it be acceptable to add a dependency towards scim2-models in synapse, or should I continue checking and building SCIM2 payloads manually?

@azmeuk azmeuk force-pushed the msc4098-scim branch 4 times, most recently from f893967 to 81d751b Compare June 6, 2024 14:25
@azmeuk azmeuk force-pushed the msc4098-scim branch 3 times, most recently from dcd72ed to 6a1e1b2 Compare July 25, 2024 12:06
@azmeuk azmeuk marked this pull request as ready for review July 25, 2024 12:09
@azmeuk
Copy link
Contributor Author

azmeuk commented Jul 25, 2024

Hi @erikjohnston
I think the PR can be reviewed now. I edited the OP to detail what's in there.
I am available on #synapse-dev too if there are things to discuss.

Implementation of a subset of SCIM endpoint and capabilities as
described in MSC4098.

Signed-off-by: Éloi Rivard <eloi@yaal.coop>
@github-actions github-actions bot deployed to PR Documentation Preview August 13, 2024 09:03 Active
@anoadragon453 anoadragon453 requested a review from a team August 13, 2024 10:20
@azmeuk

This comment was marked as outdated.

@azmeuk

This comment was marked as outdated.

@github-actions github-actions bot deployed to PR Documentation Preview November 22, 2024 13:57 Active
@github-actions github-actions bot deployed to PR Documentation Preview November 22, 2024 14:03 Active
@azmeuk
Copy link
Contributor Author

azmeuk commented Nov 22, 2024

@reivilibre I think all your comments have been addressed now. Most of them have been fixed in the code and I responded to some with new questions.
The implementation have been tested against Keycloak with the keycloak-scim extension.

I am sorry for the many commits, the PR looks like a mess. If it is easier for the review, I can close it and open a new one. Let me know.

@reivilibre reivilibre self-requested a review December 5, 2024 16:54
@github-actions github-actions bot deployed to PR Documentation Preview January 2, 2025 12:51 Active
Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

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

this is looking generally good, but a few comments (and some still open from last time).

The CI is also unhappy but hopefully that's nothing too difficult?

```
DELETE /_matrix/client/unstable/coop.yaal/scim/Users/@bjensen:test
```

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this was noted on the documentation?

return env


def mxc_to_http(
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspect this is no longer functional, given authenticated media means you can't just hotlink to media like this anymore.

@github-actions github-actions bot deployed to PR Documentation Preview June 19, 2025 12:03 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 19, 2025 12:05 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 19, 2025 12:17 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 19, 2025 12:19 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 19, 2025 12:49 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 19, 2025 13:39 Active
@github-actions github-actions bot deployed to PR Documentation Preview June 19, 2025 14:47 Active
@azmeuk
Copy link
Contributor Author

azmeuk commented Jun 19, 2025

@reivilibre
After all those months I finally took time to solve the remaining issues and merge the current develop branch. I have more availability now so it should not take as long if there other things to do.

The DELETE http call is documented here. I don't know why this is not displayed by GH here.

I think everything should be solved except the enable_authenticated_media question, see the conversation for more details.

@reivilibre reivilibre requested a review from a team June 19, 2025 17:21
@wrjlewis
Copy link
Contributor

Hey @azmeuk

Thanks for the update. Unfortunately, we won't be able to continue work on this PR at this time for a couple of reasons:

  1. We want to limit features like this in Synapse not least to reduce our maintenance burden, but mainly this category of auth work is now being directed to MAS instead, as the natural home for it.

  2. Which begs the question 'what about if someone contributed this to MAS instead?'. For full transparency, in this case we see it as an enterprise-level feature and therefore again wouldn't wish to pursue it in open-souce.

Thanks very much for taking the time to develop this PR and get it to this stage - I just want to acknowledge this isn't an ideal situation to come to this conclusion at this stage and really appreciate the effort you've put in!

@ara4n
Copy link
Member

ara4n commented Jul 23, 2025

To clarify (speaking as element ceo/cto), there are three considerations here:

  • It's not clear that this should go in Synapse rather than MAS - given it's managing user identities, MAS is surely a better bet than Synapse (and would then benefit any homeserver which uses MAS). I'm a bit confused on how we've been managing to review this for 16 months without spotting this; it feels like we might have been missing the bigger picture.
  • That said, we barely have bandwidth at Element to maintain our own stuff right now, let alone major new features like this (especially if it's not stuff we're using in production ourselves)
  • we don't have any policy against accepting enterprisey PRs: instead, we take them case by case; the key question is whether we'd have the bandwidth to maintain it going forwards. If a FOSS PR conflicts with an existing proprietary product, then we'd figure out which direction we'd want to take - i.e. whether to adopt the contribution or not.

So, my recommendation here would be to maintain this out-of-tree, either in Synapse (given that's where the work has happened already), or as a third-party Synapse module, or even better to do it on MAS (although I can't guarantee that we'd have bandwidth to accept it there either. plus I guess MAS being in Rust might be an obstacle).

I can only apologise that we (I) didn't spot this back in May 2024 and warn that this might not be a feature we'd be able to merge.

@azmeuk
Copy link
Contributor Author

azmeuk commented Jul 24, 2025

Hi.
This is bad news but I understand your reasons.
@ara4n no hard feelings, @reivilibre warned me last year on #synapse-dev that it could end this way, even before I started the development.

I'll see how much work it would ask to maintain this out of synapse, but I fear this would double the maintenance burden.

I might tackle the implementation on MAS some day, but certainly not anytime soon. I would not benevolently contributing to a proprietary feature though, and on the other hand I understand that you would not be interested in paying for a feature you did not even ask in the first place. So for this to happen, this should probably be funded by someone else.

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.

8 participants