abcxyz / abcxyz/guardian

[IAM drift] Resources in `DELETE_REQUESTED` state should be filtered out

Đang mở
#334 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Go
Star
26
Fork
7
Merge trung bình
1 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Mô tả

### TL;DR

Context for https://github.com/abcxyz/guardian/blob/main/pkg/commands/drift/drift.go#L194.

Currently, `asset.SearchAllIamPolicies` will include IAM policies bound to resources that are soft-deleted (state=`DELETE_REQUESTED`) and these are identified as drift. These are false-positives and should be filtered out.

**Initial approach**
1. Get all soft-deleted projects/folders with `asset.SearchAllResources`
2. Exclude them using a query for `asset.SearchAllIamPolicies`.

However, I found that `asset.SearchAllIamPolicies` does not support negated queries, which makes it infeasible to exclude projects/folders in `DELETE_REQUESTED` state from the API response.

**A hacky alternative**
1. `SearchAllResources` for folders/projects in `state:DELETE_REQUESTED`
2. Append these resources to the driftignore hierarchy graph so they will be filtered out using the driftignore approach

While the alternative could work, the best solution is if we can apply the filter in the `SearchAllIamPolicies` request, which doesn't seem to be possible at the moment.

### Expected behavior

_No response_

### Observed behavior

_No response_

### Environment Details

All

### Additional information

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.