buzzfeed / sso

sso, aka S.S.Octopus, aka octoboi, is a single sign-on solution for securing internal services
MIT License
3.09k stars 186 forks source link

validator pkg: control when each validator is ran #266

Closed Jusshersmith closed 4 years ago

Jusshersmith commented 4 years ago

Problem

With the validator abstraction work that was recently done we inadvertently started to run group validations more than we used to.

Depending on the request volume flowing through SSO running the group check again can cause issues with upstream providers.

Solution

We don't need to validate the groups again here. This pull request adds a feature to the validator package that allows us to pass in a flag whenever calling the RunValidators() function that will determine which validators we want to run in that flow.

This gives us more flexibility to control when specific validators should or shouldn't be ran.

Notes

Now that the group membership check is an official 'validator' within sso-proxy it's ran each time we call RunValidators(), whereas before when running the equivalent function the group check wasn't part of this.

Specifically, here: https://github.com/buzzfeed/sso/blob/9019d4f79b453b50882213baa8549d40852daaf7/internal/proxy/oauthproxy.go#L784

Previously, we were only checking email address/domains as the group check is ran just above that when refreshing or validating the session: https://github.com/buzzfeed/sso/blob/9019d4f79b453b50882213baa8549d40852daaf7/internal/proxy/oauthproxy.go#L731 & https://github.com/buzzfeed/sso/blob/9019d4f79b453b50882213baa8549d40852daaf7/internal/proxy/oauthproxy.go#L762

Jusshersmith commented 4 years ago

Closing in favour of https://github.com/buzzfeed/sso/pull/267