SAML Metadata parsing does not correctly parse valid duration values.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- go
- Domain
- authentication
Research direction
No file or test is named in the report. Start by tracing SAML metadata handling for the cacheDuration attribute and the strconv.ParseInt error, then add coverage for the valid value PT5H. Done means valid SAML metadata using ISO 8601 duration syntax is accepted when adding an identity provider.
Written by the indexing model from the issue text.
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
We have a customer that we are setting up with SAML authentication. Their metadata EntitiesDescriptor contains the following:
(Sanitized)
<md:EntitiesDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui" xmlns:mdattr="urn:oasis:names:tc:SAML:metadata:attribute" xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xrd="http://docs.oasis-open.org/ns/xri/xrd-1.0" ....snip... validUntil="2024-08-09T23:11:46Z" cacheDuration="PT5H">
When adding this provider via supabase sso add we receive the following error:
Unexpected error adding identity provider: {"message":"Unexpected failure, please check server logs for more information"}
The server logs show:
(Sanitized)
{"component":"api","error":"strconv.ParseInt: parsing \"PT5H\": invalid syntax","level":"error","method":"POST","msg":"Unhandled server error: strconv.ParseInt: parsing \"PT5H\": invalid syntax","path":"/admin/sso/providers","referer":"https://<removed>","remote_addr":"3.95.37.194","request_id":"8abf1e44f73505f5-IAD","time":"2024-07-31T16:55:49Z"}
According to the spec:
https://docs.oasis-open.org/security/saml/v2.0/saml-schema-metadata-2.0.xsd
This is the cacheDuration schema:
<attribute name="cacheDuration" type="duration" use="optional"/>
According to the XML schema:
https://www.w3.org/TR/xmlschema-2/#duration
3.2.6.1 Lexical representation
The lexical representation for duration is the [[ISO 8601]](https://www.w3.org/TR/xmlschema-2/#ISO8601) extended format PnYn MnDTnH nMnS, where nY represents the number of years, nM the number of months, nD the number of days, 'T' is the date/time separator, nH the number of hours, nM the number of minutes and nS the number of seconds. The number of seconds can include decimal digits to arbitrary precision.
This is a valid way of specifying a duration.
To Reproduce
- Create an XML metadata file that uses Lexical representation to specify cacheDuration
- Attempt to add this to an instance using
supabase sso add - Get error
Expected behavior
Valid SAML metadata is processed successfully.
- Dominant language
- Go
- Stars
- 2.6k
- Forks
- 764
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/auth
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100