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

Rotating the API key of an nonexistent role returns Error #1924

Merged
merged 1 commit into from
Nov 5, 2020

Conversation

john-odonnell
Copy link
Contributor

What does this PR do?

This PR fixes a bug where a user rotating a nonexistent role's API key with basic auth would
receive a successful status code implying that the nonexistent role's key was rotated. In
reality, the user was rotating their own API key. The action of rotating a nonexistent user's
API key is now rejected with a 401 Unauthorized status code. Adds test cases to confirm.

What ticket does this PR close?

Resolves #1914

Checklists

Change log

  • The CHANGELOG has been updated, or
  • This PR does not include user-facing changes and doesn't require a CHANGELOG update

Test coverage

  • This PR includes new unit and integration tests to go with the code changes, or
  • The changes in this PR do not require tests

Documentation

  • Docs (e.g. READMEs) were updated in this PR, and/or there is a follow-on issue to update docs, or
  • This PR does not require updating any documentation

@john-odonnell john-odonnell force-pushed the rotate_api_key_tests branch 2 times, most recently from cc59a98 to 0e260ef Compare November 4, 2020 21:02
@john-odonnell john-odonnell changed the title Rotating the API key of an nonexistent role returns error Rotating the API key of an nonexistent role returns Error Nov 4, 2020
@john-odonnell john-odonnell self-assigned this Nov 4, 2020
@john-odonnell john-odonnell marked this pull request as ready for review November 4, 2020 21:40
@john-odonnell john-odonnell requested a review from a team as a code owner November 4, 2020 21:40
Copy link
Contributor

@diverdane diverdane left a comment

Choose a reason for hiding this comment

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

@john-odonnell this looks pretty good to me, esp. after your explanations in chat.
A couple of minor editorial questions/suggestions.

@john-odonnell john-odonnell force-pushed the rotate_api_key_tests branch 2 times, most recently from b982cda to 536daa8 Compare November 5, 2020 20:50
This fixes a bug where a user rotating a nonexistent role's API key with basic auth would
receive a successful status code implying that the nonexistent role's key was rotated. In
reality, the user was rotating their own API key. The action of rotating a nonexistent user's
API key is now rejected with a 401 Unauthorized status code. Adds test cases to confirm.
@codeclimate
Copy link

codeclimate bot commented Nov 5, 2020

Code Climate has analyzed commit ce0145d and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 87.8% (0.0% change).

View more on Code Climate.

Copy link
Contributor

@sgnn7 sgnn7 left a comment

Choose a reason for hiding this comment

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

@sgnn7 sgnn7 merged commit be67fd8 into master Nov 5, 2020
@sgnn7 sgnn7 deleted the rotate_api_key_tests branch November 5, 2020 22:06
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.

Attempting to rotate a non-existent entity's with basic auth (API key/pass) rotates your own API key
3 participants