limosa-io / laravel-scim-server

SCIM 2.0 Server implementation for Laravel
MIT License
51 stars 29 forks source link

Schema version generated for User and group looks wrong #90

Open LasneF opened 2 months ago

LasneF commented 2 months ago

Given the request :

GET https://[api.scim.dev/scim/v2/Schemas/urn:ietf:params:scim:schemas:core:2.0:User](https://api.scim.dev/scim/v2/Schemas/urn:ietf:params:scim:schemas:core:2.0:User)

it returns

    "meta": {
        "resourceType": "Schema",
        "created": "2001-01-01T00:00:00+00:00",
        "lastModified": "2001-01-01T00:00:00+00:00",
        "version": "W/\"1\"",
        "location": "https://api.scim.dev/scim/v2/Schemas/urn:ietf:params:scim:schemas:core:2.0:User"
    },

the version string looks not appropriate as containing kind of escaped char , it could be something like 1.0.0 or 1.3.3 (to not confused with others versionning like the api version , or scim version)

this looks coming from this line

https://github.com/limosa-io/laravel-scim-server/blob/9fefb3f5e0a6c1ab1a6423a825c128d03dac3784/src/Attribute/Schema.php#L19

arietimmerman commented 2 months ago

The value of version is actually W/"1". The JSON specs require escaping quote characters, and allow escaping forward slashes. The "W/" prefix indicated "weak validation", see here.

Nevertheless, you are right that version "1" is not really correct and never really updated. I agree that something better should be used. Now version "1" is simply hard coded somewhere. I could change this to something else but need to find a proper way.

LasneF commented 1 month ago

thx for investigation re reading the spec clearly highlight what i missed

version The current resource version. Version MAY be used if the service provider supports entity-tags (ETags) (Section 2.3 of [RFC7232]) and so the versionning model and sample in fact are quite clear in the spec
"version": "W\/\"lha5bbazU3fNvfe5\"",

i let you keep it the ticket open for fixing the sample value or just close the ticket, as the current implementation is correct