Repository navigation
Conversation
The regions cache used one fixed key for all accounts. In organization mode, the first account set the region list for all member accounts. If that account had an opt-in region disabled, the other accounts got no clients for that region. S3 logged "aws client not found", and the other fetchers skipped the region with no error. The cache key now includes the access key ID of the credentials. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
This pull request does not have a backport label. Could you fix it @groman92? 🙏
|
groman92
marked this pull request as ready for review
November 30, 2026 16:25
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of your changes
In organization mode, cloudbeat did not collect an opt-in region for a member account when the first account had that region disabled. This PR fixes it.
Cloudbeat makes the regional AWS clients from the result of
ec2:DescribeRegions. This result holds only the regions that are enabled for the calling account.cachedRegionSelectorkept this result in a process-wide cache with one fixed key (AllRegionSelectorCache) and a TTL of720h. In organization mode, one cloudbeat process collects data for all member accounts. Thus the first account wrote the cache, and all the other accounts read its list.The result for a member account that has a region enabled when the first account has it disabled:
Error: aws client not found, becauseListBucketsis global.This occurs in CSPM (
aws_org_preset.go) and in Asset Discovery (initOrgFetchers).The fix puts the access key ID of the credentials in the cache key. Each member account has its own assumed-role session, so each account gets its own region list. This change adds no API call.
Retrievereturns the cached credentials, and the firstDescribeRegionscall needs these credentials anyway. IfRetrievefails,Regionsreturns the error, and the caller uses the same fallback tocfg.Regionas before.Screenshot/Data
TestCachedRegionSelector_CachePerAccountfails onmainand passes on this branch:Related Issues
Checklist