[IAM drift] Resources in `DELETE_REQUESTED` state should be filtered out
- 主要语言
- Go
- 星标
- 26
- 派生
- 7
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 1
描述
### 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_
贡献指南
调研方向
该 issue 位于 pkg/commands/drift/drift.go 第 194 行,那里 asset.SearchAllIamPolicies 包含了 soft-deleted resources。首先,通过阅读该行附近的代码和 asset package,了解 asset.SearchAllResources 和 asset.SearchAllIamPolicies 的工作方式。然后,探索 driftignore hierarchy graph,看看 resources 是如何被过滤的。目标是将 DELETE_REQUESTED state 的 resources 从 drift detection 中排除,可以通过修改 query,或将它们添加到 driftignore graph。
由索引模型根据 Issue 内容生成。
评估
- 领域
- backend, cloud
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100