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

Authentication option doesn't take effect if there's no authorization policy #3392

Merged

Conversation

kale-amruta
Copy link
Contributor

@kale-amruta kale-amruta commented Apr 18, 2021

This fix gives a Error msg when you start the opa runtime server with authentication as TOKEN and authorization OFF

Fixes #3380

@kale-amruta kale-amruta marked this pull request as draft April 18, 2021 19:24
@kale-amruta kale-amruta marked this pull request as ready for review April 18, 2021 19:24
@kale-amruta kale-amruta force-pushed the amruta-basicAuth-3380 branch 2 times, most recently from d8e152b to 4f1b438 Compare April 18, 2021 19:32
runtime/runtime.go Outdated Show resolved Hide resolved
runtime/runtime_test.go Outdated Show resolved Hide resolved
runtime/runtime.go Outdated Show resolved Hide resolved
Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

Starting to look good! :)

runtime/runtime_test.go Outdated Show resolved Hide resolved
anderseknert
anderseknert previously approved these changes Apr 19, 2021
Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

LGTM. You'll need to squash the commits before merge though. Thanks @kale-amruta!

This commit gives a message stating authetication will be ineffective
when you run the opa server with authentication as TOKEN and no authorization

Fixes open-policy-agent#3380
Signed-off-by: Amruta Kale <[email protected]>
@kale-amruta
Copy link
Contributor Author

@anderseknert Thanks! I dont think I have access to merge the PR. Will you be merging it?

@anderseknert
Copy link
Member

It looks good from my POV, but never hurts to get a second opinion before merge so leaving this for someone else to review.

@kale-amruta
Copy link
Contributor Author

@anderseknert sure, makes sense.

@@ -305,6 +305,10 @@ func (rt *Runtime) Serve(ctx context.Context) error {
"diagnostic-addrs": *rt.Params.DiagnosticAddrs,
}).Info("Initializing server.")

if rt.Params.Authorization == server.AuthorizationOff && rt.Params.Authentication == server.AuthenticationToken {
logrus.Error("Token authentication enabled without authorization. Authentication will be ineffective. See https://www.openpolicyagent.org/docs/latest/security/#authentication-and-authorization for more information.")
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Should we log a warning (ie. logrus.Warn) ?

Copy link
Member

Choose a reason for hiding this comment

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

Better check the resolved conversations ;)

@anderseknert anderseknert merged commit 27c8d75 into open-policy-agent:main Apr 21, 2021
@kale-amruta kale-amruta deleted the amruta-basicAuth-3380 branch June 30, 2021 08:06
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.

Authentication option doesn't take effect if there's no authorization policy
3 participants