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

Ignore case when comparing the user name #511

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

adombeck
Copy link
Contributor

@adombeck adombeck commented Sep 2, 2024

Microsoft Entra user names are case insensitive, so we should ignore the case when comparing the user name.

Closes #496

UDENG-4334

@codecov-commenter
Copy link

codecov-commenter commented Sep 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.74%. Comparing base (924b003) to head (c69735d).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #511      +/-   ##
==========================================
- Coverage   84.84%   84.74%   -0.10%     
==========================================
  Files          79       79              
  Lines        6942     6937       -5     
  Branches       75       75              
==========================================
- Hits         5890     5879      -11     
- Misses        736      739       +3     
- Partials      316      319       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adombeck
Copy link
Contributor Author

adombeck commented Sep 2, 2024

We're having some real flakiness issues in github.com/ubuntu/authd/pam/integration-tests. Took four attempts to get them to pass here.

@adombeck adombeck marked this pull request as ready for review September 2, 2024 23:32
@adombeck adombeck requested a review from a team as a code owner September 2, 2024 23:32
Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

The rationale itself looks good to me.

However, as everything we do, this requires a companion tests for that use case.

@adombeck
Copy link
Contributor Author

adombeck commented Sep 3, 2024

What I want to avoid is that a user can log in as another user on the same Entra instance because strings.EqualFold considers different Entra user names equal.

I'll create a PR against the brokers repo to use strings.ToLower instead of strings.EqualFold.

@didrocks
Copy link
Member

didrocks commented Sep 3, 2024

forgot to push some commits or is my browser broken? :)

@adombeck
Copy link
Contributor Author

adombeck commented Sep 3, 2024

forgot to push some commits or is my browser broken? :)

Right, my pre-push hook failed because of those weird "directive is unused for linter" errors from golangci-lint which only I get locally :/

Pushed with --no-verify now.

@didrocks
Copy link
Member

didrocks commented Sep 4, 2024

I am unsure if you noticed that the tests are failing (please always check CI after pushing).

If they would not anyway, I would have asked for a test illustrating that we don’t check the user name matching anyway, but we already have them to cover that functionality of the code! :)

Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

Feel free to revert to "request for review" once the tests are fixed, or do not hesitate if you need any help fixing them!

I think now that we moved the logic broker side, we can probably remove the pam service and integration tests, and only rely on the broker package tests to demonstrate that functionality, as it’s not widespread in the end to end contract term (we expect the external broker to do this work).

@adombeck
Copy link
Contributor Author

adombeck commented Sep 4, 2024

I am unsure if you noticed that the tests are failing (please always check CI after pushing).

I did notice that, but at the bottom of the logs of the CI job I only saw the pam integration tests failing, which are known to be flaky, so I just retried the tests a couple of times. After taking a closer look now, I see that the broker tests are also failing. I will address that.

@adombeck adombeck force-pushed the 496-ignore-case-in-user-name branch 3 times, most recently from 8d73725 to c69735d Compare September 4, 2024 12:14
Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the changes! Everything looks good from my end :)

It's the broker's responsibility to do that and authd doesn't know which
usernames the provider considers equal, for example if they are
case-sensitive or not.
@adombeck adombeck merged commit 8ffdf09 into main Sep 4, 2024
5 of 6 checks passed
@adombeck adombeck deleted the 496-ignore-case-in-user-name branch September 4, 2024 16:33
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.

Issue: case-sensitivity in username
5 participants