Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure each individual resource indicator is a valid URI #1258

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

charIeszhao
Copy link
Contributor

@charIeszhao charIeszhao commented Apr 23, 2024

Fix a bug in checkResource util function.

When checking if the resource identifier is a valid URL, we should iterate the resource array with a for-loop, and check if each identifier in the resource array is valid, by utilizing the new URL() constructor.

However, the origin code seems to mistakenly pass the entire resource array into the URL constructor, resulting unexpected behavior.

Fixes: logto-io/logto#5779

@panva
Copy link
Owner

panva commented Apr 23, 2024

You're absolutely right. This only works when there's a single element due to how new URL calling toString() on non-string inputs.

Let me just add a regression test.

@charIeszhao
Copy link
Contributor Author

Thanks! Glad I can help.

@panva panva changed the title fix: should check if a single identifier is valid instead of the entire resource array fix: ensure each individual resource indicator is a valid URI Apr 23, 2024
@panva panva merged commit d9e1ad2 into panva:main Apr 23, 2024
30 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: OIDC server returns "resource indicator must be an absolute URI" error
2 participants