authz: make it easier to test authn/authz protection for new endpoints#652
Merged
Conversation
71 tasks
Collaborator
Author
|
For future reference, here's some example log output (at "debug" level): and here are the log messages from the test itself: So it looks like it's doing roughly what I'd expect. |
Contributor
|
This looks very nice, gets rid of a lot of boilerplate. So for a new endpoint, the workflow is to write explicit tests for the happy authed case (plus perhaps some endpoint-specific authz logic if there is some?), but for the base logged-out/logged-in tests you add an entry to the list in |
Collaborator
Author
|
Yes, exactly! |
david-crespo
approved these changes
Jan 31, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change creates a new top-level integration test that has a hardcoded list of API endpoints to which we've added authn/authz protection. This way, when we add that protection for new endpoints, we can add them to this list without having to sprinkle all the other integration tests with a bunch of extra requests to check every case (and risk getting them wrong).
I tried to keep the per-endpoint metadata as minimal as possible.
Still to-do here: