Open
Conversation
Collaborator
|
Will review during the week - fyi @tank1st99 we've been discussing these changes on Gram's Discord. We should probably align so this doesn't break Klarna's deployment. The semgrep finding may be an actual vulnerability from what I'm reading, curious to test it (and then we should report it as such here on github) |
Collaborator
|
Had a look earlier in the summer but will require more work than I have time/energy for. @tank1st99 you may want to investigate the vulnerability here. |
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.
Overview
We needed a way to support Authorization for Gram, but since we don't use LDAP there were no suitable providers aside from the static providers. So, I added providers to the OIDC plugin to support authorization based on group claims, after authenticating with the identity provider. These were based loosely on the existing LDAP providers.
This is my first time working with OIDC flows and using this web framework, so if there's anything that could be improved or done a different way please let me know.
Changes
OIDCIdentityProvider-> Already existed, but pulled out into it's own file. Pushes user info and group mappings to the DB after loginOIDCGroupBasedAuthzProvider-> Maps groups from claims to roles, based on provided mappingOIDCGroupBasedReviewerProvider-> Determine users that are reviewers based on group membershipOIDCTeamProvider-> Convert groups to teams. Use filtering to only include a subset of the groups as valid teamsSearchProviderto look up teams by nameOIDCUserProvider-> Convert user info toUserobjectOIDCUserStore-> For interacting with thegram-oidcDB, which stores information about users and their group mappingsoidc_userstable for storing usersoidc_user_groupsfor storing user to group mappingsWent with a DB approach for storing group claims for a couple of reasons:
userinfoendpoint, so might as well use itOther Small Changes
.tool-versionsfile to getnpmworking, so included it here.{ authTagLength: 16 }to thecrypto.createDecipherivto resolve a Semgrep finding that was found when we scanned the repo. Reference here: https://systemsecurity.com/blog/forging_ciphertexts_under_Galois_Counter_Mode_for_the_Node_js_crypto_module/