Skip to content

Commit

Permalink
Merge pull request #3710 from Azure/nwnt/add-checkaccess-group-expansion
Browse files Browse the repository at this point in the history
Always do group expansion for CheckAccess subjects
  • Loading branch information
mociarain authored Jul 23, 2024
2 parents 6ab3476 + e20b612 commit 18fa5ec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pkg/util/azureclient/authz/remotepdp/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ const (
Allowed AccessDecision = "Allowed"
NotAllowed AccessDecision = "NotAllowed"
Denied AccessDecision = "Denied"

// GroupExpansion is the value to be used with ClaimName in SubjectAttributes
// This value gives CheckAccess a hint that it needs to retrieve all the groups the principal belongs to
// and then give the response based on all group entitlements.
//
// https://eng.ms/docs/microsoft-security/identity/auth/access-control-managed-identityacmi/azure-authz-data-plane/authz-dataplane-partner-wiki/remotepdp/checkaccess/samples/requestresponse
GroupExpansion = `{"groups":"src1"}`
)
1 change: 1 addition & 0 deletions pkg/util/azureclient/authz/remotepdp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type SubjectAttributes struct {
AltSecId string `json:"altsecid,omitempty"`
IdentityProvider string `json:"idp,omitempty"`
Issuer string `json:"iss,omitempty"`
ClaimName string `json:"_claim_names,omitempty"`
}

// ActionInfo contains an action the query checks whether the subject
Expand Down
3 changes: 2 additions & 1 deletion pkg/validate/dynamic/dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ func createAuthorizationRequest(subject, resourceId string, actions ...string) r
return remotepdp.AuthorizationRequest{
Subject: remotepdp.SubjectInfo{
Attributes: remotepdp.SubjectAttributes{
ObjectId: subject,
ObjectId: subject,
ClaimName: remotepdp.GroupExpansion, // always do group expansion
},
},
Actions: actionInfos,
Expand Down

0 comments on commit 18fa5ec

Please sign in to comment.