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

permit unconfigured permission checks #217

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

mikemrm
Copy link
Contributor

@mikemrm mikemrm commented Feb 2, 2024

Easily permit permission checks when the permission library doesn't have a proper url configured.

This simplifies local development for service which implement permissions checks allowing them to skip calling out to a permissions service while developing locally by simply enabling AllowUnconfiguredChecks.

@mikemrm mikemrm force-pushed the configurable-default branch 2 times, most recently from a10052d to eb4fc16 Compare February 2, 2024 17:29
@mikemrm mikemrm marked this pull request as ready for review February 2, 2024 17:42
@mikemrm mikemrm requested review from a team as code owners February 2, 2024 17:42
Comment on lines 18 to 19
// AllowUnconfiguredChecks permits permission checks when unconfigured.
AllowUnconfiguredChecks bool
Copy link
Contributor

Choose a reason for hiding this comment

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

This strikes me as a bit of an odd name. Maybe something like DefaultAllow or DefaultAllowAll would be better; the distinction between "configured" and "unconfigured" is confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I too am not a fan of the name, however I wanted to be clear that this only takes affect when the url is not defined and therefore we're not processing standard checks.

If you still think one of these is a more appropriate name, I can update it to that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the suggested doc comment helps?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed it does, thanks.

Comment on lines 11 to 12
// URL is the URL checks should be executed against.
// Considered unconfigured if empty.
Copy link
Contributor

Choose a reason for hiding this comment

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

Something like this might convey intent more clearly:

Suggested change
// URL is the URL checks should be executed against.
// Considered unconfigured if empty.
// URL should point to a permissions-api authorization API route, such as https://foo.dev/api/v1/allow.
// If not set, all permissions checks will be denied by default. To override this behavior, set DefaultAllow
// to true.

@mikemrm mikemrm force-pushed the configurable-default branch 2 times, most recently from d689a68 to cddfef1 Compare February 2, 2024 21:02
URL string

// IgnoreNoResponders will ignore no responder errors when auth relationship requests are published.
IgnoreNoResponders bool

// DefaultAllow all permissions checks will be granted when URL is not set.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// DefaultAllow all permissions checks will be granted when URL is not set.
// DefaultAllow, if set to true, will allow all permissions checks when URL is not set.

@@ -22,4 +27,7 @@ func MustViperFlags(v *viper.Viper, flags *pflag.FlagSet) {

flags.Bool("permissions-ignore-no-responders", false, "ignores no responder errors when auth relationship requests are published")
viperx.MustBindFlag(v, "permissions.ignoreNoResponders", flags.Lookup("permissions-ignore-no-responders"))

flags.Bool("default-allow", false, "grant permission checks when url is not set")
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be permissions-default-allow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh good catch, thank you.

Easily permit permission checks when the permission library doesn't have
a proper url configured.

This simplifies local development for service which implement
permissions checks allowing them to skip calling out to a permissions
service while developing locally by simply enabling `DefaultAllow`.

Signed-off-by: Mike Mason <[email protected]>
@mikemrm mikemrm merged commit 7064a66 into infratographer:main Feb 5, 2024
4 checks passed
@mikemrm mikemrm deleted the configurable-default branch February 5, 2024 20:52
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.

2 participants