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

authorize: add policy error details for custom error messages #3542

Merged
merged 4 commits into from Aug 9, 2022

Conversation

calebdoxsey
Copy link
Contributor

Summary

Add a new PolicyEvaluationTrace struct and fill it during policy evaluation. This struct contains fields related to policy evaluation that can be used for better errors.

Related issues

Fixes https://github.com/pomerium/internal/issues/949

User Explanation

Not user facing.

Checklist

  • reference any related issues
  • updated docs
  • updated unit tests
  • updated UPGRADING.md
  • add appropriate tag (improvement / bug / etc)
  • ready for review

@calebdoxsey calebdoxsey requested a review from a team as a code owner August 8, 2022 20:20
@calebdoxsey calebdoxsey requested a review from wasaga August 8, 2022 20:20
@coveralls
Copy link

coveralls commented Aug 9, 2022

Coverage Status

Coverage decreased (-0.03%) to 65.23% when pulling f5f4e09 on cdoxsey/custom-error-messages-backend into ebae91f on main.

Copy link
Contributor

@desimone desimone left a comment

Choose a reason for hiding this comment

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

Small suggestion on docs.

@@ -193,6 +196,9 @@ type SubPolicy struct {
AllowedDomains []string `mapstructure:"allowed_domains" yaml:"allowed_domains,omitempty" json:"allowed_domains,omitempty"`
AllowedIDPClaims identity.FlattenedClaims `mapstructure:"allowed_idp_claims" yaml:"allowed_idp_claims,omitempty" json:"allowed_idp_claims,omitempty"`
Rego []string `mapstructure:"rego" yaml:"rego" json:"rego,omitempty"`

Explanation string `mapstructure:"explanation" yaml:"explanation" json:"explanation,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth adding a docstring here to distinguish Remediation and Explanation

@calebdoxsey calebdoxsey merged commit 3c63b6c into main Aug 9, 2022
@calebdoxsey calebdoxsey deleted the cdoxsey/custom-error-messages-backend branch August 9, 2022 20:46
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.

None yet

3 participants