Skip to content

Commit

Permalink
only hit authorization if there are data attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethhealy committed Nov 13, 2024
1 parent 88496cd commit cc04dc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions service/kas/access/accessPdp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ const (
)

func (p *Provider) canAccess(ctx context.Context, token *authorization.Token, policy Policy) (bool, error) {
if len(policy.Body.Dissem) > 0 {
if policy.Body.Dissem != nil && len(policy.Body.Dissem) > 0 {

Check failure on line 18 in service/kas/access/accessPdp.go

View workflow job for this annotation

GitHub Actions / go (service)

S1009: should omit nil check; len() for []string is defined as zero (gosimple)
// TODO: Move dissems check to the getdecisions endpoint
p.Logger.Error("Dissems check is not enabled in v2 platform kas")
}
if policy.Body.DataAttributes != nil {
if policy.Body.DataAttributes != nil && len(policy.Body.DataAttributes) > 0 {

Check failure on line 22 in service/kas/access/accessPdp.go

View workflow job for this annotation

GitHub Actions / go (service)

S1009: should omit nil check; len() for []github.com/opentdf/platform/service/kas/access.Attribute is defined as zero (gosimple)
attrAccess, err := p.checkAttributes(ctx, policy.Body.DataAttributes, token)
if err != nil {
return false, err
Expand Down

0 comments on commit cc04dc6

Please sign in to comment.