List Google Analytics subproperties in access reviews
listProperties filtered properties with parent:accounts/{id}, which returns
only properties whose direct parent is the account and silently drops
subproperties and roll-up properties (parented to another property). A member
holding a binding only on such a subproperty was omitted from the review.
Switch to the ancestor:accounts/{id} filter, which walks the whole account
hierarchy and is a strict superset, so no property is lost.
Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
@@ -143,13 +143,16 @@ func (d *GoogleAnalyticsDriver) collectBindings(ctx context.Context, members map
|
|||||||
return fmt.Errorf("cannot list all google analytics access bindings: %w", ErrPaginationLimitReached)
|
return fmt.Errorf("cannot list all google analytics access bindings: %w", ErrPaginationLimitReached)
|
||||||
}
|
}
|
||||||
|
|
||||||
// listProperties returns the numeric IDs of every property directly beneath the
|
// listProperties returns the numeric IDs of every property under the account,
|
||||||
// account.
|
// including subproperties and roll-up properties. The ancestor filter walks the
|
||||||
|
// whole account hierarchy (parent: would return only properties whose direct
|
||||||
|
// parent is the account, silently dropping subproperties parented to another
|
||||||
|
// property, and with them any subproperty-only members).
|
||||||
func (d *GoogleAnalyticsDriver) listProperties(ctx context.Context) ([]string, error) {
|
func (d *GoogleAnalyticsDriver) listProperties(ctx context.Context) ([]string, error) {
|
||||||
var propertyIDs []string
|
var propertyIDs []string
|
||||||
|
|
||||||
pageToken := ""
|
pageToken := ""
|
||||||
filter := url.Values{"filter": {"parent:accounts/" + d.accountID}}
|
filter := url.Values{"filter": {"ancestor:accounts/" + d.accountID}}
|
||||||
|
|
||||||
for range maxPaginationPages {
|
for range maxPaginationPages {
|
||||||
endpoint, err := googleAnalyticsURL(pageToken, filter, "v1alpha", "properties")
|
endpoint, err := googleAnalyticsURL(pageToken, filter, "v1alpha", "properties")
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ interactions:
|
|||||||
host: analyticsadmin.googleapis.com
|
host: analyticsadmin.googleapis.com
|
||||||
form:
|
form:
|
||||||
filter:
|
filter:
|
||||||
- parent:accounts/123456
|
- ancestor:accounts/123456
|
||||||
pageSize:
|
pageSize:
|
||||||
- "200"
|
- "200"
|
||||||
headers:
|
headers:
|
||||||
Accept:
|
Accept:
|
||||||
- application/json
|
- application/json
|
||||||
url: https://analyticsadmin.googleapis.com/v1alpha/properties?filter=parent%3Aaccounts%2F123456&pageSize=200
|
url: https://analyticsadmin.googleapis.com/v1alpha/properties?filter=ancestor%3Aaccounts%2F123456&pageSize=200
|
||||||
method: GET
|
method: GET
|
||||||
response:
|
response:
|
||||||
proto: HTTP/2.0
|
proto: HTTP/2.0
|
||||||
|
|||||||
Reference in New Issue
Block a user