Skip to content

feat: update scim/core to implement RFC-7643 - #2746

Closed
xlgmokha wants to merge 2 commits into
masterfrom
scim/2-core
Closed

feat: update scim/core to implement RFC-7643#2746
xlgmokha wants to merge 2 commits into
masterfrom
scim/2-core

Conversation

@xlgmokha

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Feature. Implements RFC-7643 SCIM Core Schema.

What is the current behavior?

What is the new behavior?

Additional context

Extracted from #2731

@xlgmokha
xlgmokha changed the base branch from master to scim/1-migrations August 26, 2026 00:57
@xlgmokha xlgmokha self-assigned this Aug 26, 2026
@xlgmokha
xlgmokha marked this pull request as ready for review August 26, 2026 01:01
@xlgmokha
xlgmokha requested a review from a team as a code owner August 26, 2026 01:01
@xlgmokha
xlgmokha force-pushed the scim/2-core branch 2 times, most recently from 11e0e54 to ee648cd Compare August 26, 2026 18:53
@blacksmith-sh

This comment has been minimized.

@xlgmokha
xlgmokha marked this pull request as draft August 26, 2026 21:52
@xlgmokha
xlgmokha force-pushed the scim/2-core branch 2 times, most recently from fec7a7d to 218f257 Compare August 26, 2026 23:31
@xlgmokha
xlgmokha marked this pull request as ready for review August 27, 2026 00:26
@xlgmokha
xlgmokha force-pushed the scim/2-core branch 3 times, most recently from 7ce31be to a9ac782 Compare August 27, 2026 17:10
Base automatically changed from scim/1-migrations to master August 27, 2026 17:11

func (m Meta) For(resource Resource) Meta {
created, updated := resource.Timestamps()
m.Location = Join(m.Location, resource.ResourceID())

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.

Severity: LOW

resource.ResourceID() is copied into the SCIM meta.location URL as a raw path fragment. A client- or directory-derived identifier containing /, ?, #, or .. can change the referenced path or query, causing SCIM consumers following this location to request an unintended resource or operation.
Helpful? Add 👍 / 👎

💡 Fix Suggestion

Suggestion: URL-encode the resource ID before appending it to the SCIM meta.location URL to prevent path traversal and URL manipulation via special characters. Use url.PathEscape(resource.ResourceID()) at line 23, and also expand the import at line 3 to include "net/url" alongside "time". url.PathEscape will percent-encode characters such as /, ?, #, and .. so they are treated as literal data in the path segment rather than URL structure.

⚠️ Experimental Feature: This code suggestion is automatically generated. Please review carefully.

Suggested change
m.Location = Join(m.Location, resource.ResourceID())
m.Location = Join(m.Location, url.PathEscape(resource.ResourceID()))

@xlgmokha
xlgmokha force-pushed the scim/2-core branch 4 times, most recently from a96cfe7 to fc3d2c3 Compare September 1, 2026 14:51

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

Nice work 👏


import "strings"

type Kind struct {

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.

nit: this is subjective so please feel free to ignore — I find that "kind" a bit overloaded and seeing it in method signatures doesn't immediately signal what it's about.

Would it make sense to merge this with Resource (internal/api/scim/core/resource.go or internal/api/scim/core/resource_type.go)?

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 agree. I struggled with this type because I was trying to glue together concepts that don't really fit. I'm going to try dropping it and try Resource because I think that might fit better.

@xlgmokha

xlgmokha commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

I'm closing this in favour of #2747. The SCIM core/protocol code has been moved to https://github.com/supabase-community/scim-go.

@xlgmokha xlgmokha closed this Sep 3, 2026
@xlgmokha
xlgmokha deleted the scim/2-core branch September 3, 2026 18: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