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 authority parsing logic #3261

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JoshLozensky
Copy link
Contributor

@JoshLozensky JoshLozensky commented Feb 25, 2025

This pull request changes logic in the ParseAuthorityIfNecessary method in the MergedOptions class to fix a bug where the check on the indexTenant always evaluates to true.

Originally, there had been a bug here because the '/' chars in the scheme prefix of the URI were not taken into account leading to false positives when checking for the presence of the instance/tenantId

This PR went into Id Web in 3.1.0 and attempted to address the above bug but accidentally created another where the indexTenant >=0 condition always evaluated to true as its min possible value was 7.

The current PR fixes this by making the starting index of the authority URI scheme-agnostic and uses that dynamic value to compare against the indexTenant variable.

@JoshLozensky JoshLozensky requested a review from a team as a code owner February 25, 2025 22:58

This comment was marked as resolved.

Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

Thanks @JoshLozensky
We probably need to add a unit test that would fail before the bug was fixed?

@JoshLozensky JoshLozensky marked this pull request as draft February 25, 2025 23:17

This comment was marked as resolved.

@JoshLozensky
Copy link
Contributor Author

Thanks @JoshLozensky We probably need to add a unit test that would fail before the bug was fixed?

Added :)

@JoshLozensky JoshLozensky marked this pull request as ready for review February 27, 2025 02:38

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

@JoshLozensky JoshLozensky force-pushed the lozensky/AuthorityHttpsCheck branch from ead93b8 to 2dce84c Compare March 5, 2025 19:57
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.

Incorrect authority parsing in MergedOptions.ParseAuthorityIfNecessary
5 participants