Add DPoP checks in GraphQL and API requests
-
Review changes -
-
Download -
Patches
-
Plain diff
All threads resolved!
All threads resolved!
What does this MR do and why?
See Sender constraining personal access tokens (#425130) for more context. This MR makes use of the backend DPoP checks that are introduced in Parse and validate DPoP Tokens (!166206 - merged).
How to set up and validate locally
- In rails console, enable the feature flag for the user you are going to be testing the feature with:
Feature.enable(:dpop_authentication, User.find(1))
- Using the rails console, enable DPoP for the user :
UserPreferences::UpdateService.new(User.find(1), {dpop_enabled: true}).execute
- Ensure you have an SSH key-pair setup with the public key uploaded to your user account. Ensure that the key type is saved as "Signing" or "Authentication and Signing".
- Build
glab
from this branch. - Using
glab
generate a DPoP header:bin/glab auth dpop-gen --pat "<glpat-PAT>" --private-key ~/.ssh/id_rsa
- Use the generated header to make an HTTP API request eg.:
curl http://localhost:3000/api/v4/projects --header "Private-Token: <glpat-PAT>" --header "DPoP: <GLAB OUTPUT HERE>"
- Confirm valid response is received. Confirm that the request fails without a valid DPoP header.
- Repeat and confirm for GraphQL requests, e.g.
curl -X POST -H "Content-Type: application/json" -H "Private-Token: <glpat-PAT>" -H "DPoP: <GLAB OUTPUT HERE>" -d '{ "query": "query { currentUser { id } }" }' "http://localhost:3000/api/graphql"
- Confirm that the server responds with accurate error messages related to the failing DPoP check (eg. signature expired, JWT invalid, etc.).
Edited by Ash McKenzie
Merge request reports
Compare and
Show latest version
- version 468b7abd1c
- version 45760ec2ad
- version 44f88e6a9e
- version 4350d4428a
- version 42cafb822c
- version 4199c6c43a
- version 40ff224573
- version 399b83ac31
- version 38207592bf
- version 37230a5b73
- version 363f12324a
- version 3520dcf465
- version 34045a5ef8
- version 33dfbe7064
- version 32c8efd529
- version 31d56931ab
- version 30498ddeb4
- version 2992e95c15
- version 28a83b5dc5
- version 2702b4b392
- version 261b25a768
- version 250399828c
- version 2494383c44
- version 23185a16f6
- version 22ce000cb5
- version 21f2f98757
- version 20f2f98757
- version 19f2f98757
- version 18f2f98757
- version 17f2f98757
- version 16f2f98757
- version 15f2f98757
- version 14f2f98757
- version 13f2f98757
- version 12f2f98757
- version 11f2f98757
- version 10f2f98757
- version 9f2f98757
- version 8f2f98757
- version 7f2f98757
- version 6f2f98757
- version 5f2f98757
- version 4f2f98757
- version 3342e6e81
- version 2bc1a38d6
- version 13aa42034
- master (base)
- latest versione71c453130 commits,
- version 468b7abd1c29 commits,
- version 45760ec2ad28 commits,
- version 44f88e6a9e27 commits,
- version 4350d4428a26 commits,
- version 42cafb822c25 commits,
- version 4199c6c43a24 commits,
- version 40ff22457323 commits,
- version 399b83ac3121 commits,
- version 38207592bf20 commits,
- version 37230a5b7318 commits,
- version 363f12324a17 commits,
- version 3520dcf46516 commits,
- version 34045a5ef815 commits,
- version 33dfbe706416 commits,
- version 32c8efd52915 commits,
- version 31d56931ab12 commits,
- version 30498ddeb412 commits,
- version 2992e95c1511 commits,
- version 28a83b5dc510 commits,
- version 2702b4b3929 commits,
- version 261b25a7687 commits,
- version 250399828c6 commits,
- version 2494383c445 commits,
- version 23185a16f64 commits,
- version 22ce000cb53 commits,
- version 21f2f9875711 commits,
- version 20f2f9875711 commits,
- version 19f2f9875711 commits,
- version 18f2f9875711 commits,
- version 17f2f9875711 commits,
- version 16f2f9875711 commits,
- version 15f2f9875711 commits,
- version 14f2f9875711 commits,
- version 13f2f9875711 commits,
- version 12f2f9875711 commits,
- version 11f2f9875711 commits,
- version 10f2f9875711 commits,
- version 9f2f9875711 commits,
- version 8f2f9875711 commits,
- version 7f2f9875711 commits,
- version 6f2f9875711 commits,
- version 5f2f9875711 commits,
- version 4f2f987573 commits,
- version 3342e6e812 commits,
- version 2bc1a38d62 commits,
- version 13aa420341 commit,
Compare changes
- Side-by-side
- Inline
Files
927Loading