Skip to content

Fix pmapper-data-basepath ignored in all-checks and instances race condition#127

Merged
jbarciabf merged 1 commit intomainfrom
fix/pmapper-basepath-all-checks
Apr 21, 2026
Merged

Fix pmapper-data-basepath ignored in all-checks and instances race condition#127
jbarciabf merged 1 commit intomainfrom
fix/pmapper-basepath-all-checks

Conversation

@jbarciabf
Copy link
Copy Markdown
Collaborator

Summary

Two bugs fixed that caused --pmapper-data-basepath to be ignored and IsAdminRole?/CanPrivEscToAdmin? columns to appear empty when running all-checks.

Bug 1: pmapperCommand missing PmapperDataBasePath (Fixes #105)

The pmapperCommand struct in runAllChecksCommand was not receiving the PmapperDataBasePath parameter, causing --pmapper-data-basepath to be ignored for the pmapper module during all-checks.

Bug 2: Race condition in instances module

The instances module performed role analysis (pmapper lookup) before the receiver goroutine finished collecting all MappedInstances from the data channel. This caused IsAdminRole? and CanPrivEscToAdmin? to be empty in all-checks despite pmapper data being available and correctly loaded. The commented-out time.Sleep(time.Second * 2) on line 131 was a previous attempt to work around this.

Fix: Signal the receiver to stop and wait for it to drain before running role analysis.

Testing

Tested with a t2.micro EC2 instance running an IAM role with AdministratorAccess and pmapper graph data:

Test Before After
instances (direct) YES, YES YES, YES
all-checks empty, empty YES, YES
all-checks (3 consecutive runs) inconsistent YES, YES (3/3)

Version bumped to 2.0.4.

Closes #105

… instances module

The pmapperCommand in runAllChecksCommand was missing the
PmapperDataBasePath parameter, causing --pmapper-data-basepath to be
ignored for the pmapper module when running all-checks. (Fixes #105)

The instances module had a race condition where role analysis ran before
the receiver goroutine finished collecting all MappedInstances. This
caused IsAdminRole and CanPrivEscToAdmin columns to appear empty in
all-checks despite pmapper data being available. Fixed by signaling
the receiver to stop and waiting for it to drain before running role
analysis.

Version bumped to 2.0.4.
@jbarciabf jbarciabf requested a review from bishopfaure as a code owner April 21, 2026 13:06
@jbarciabf jbarciabf merged commit 1b09258 into main Apr 21, 2026
1 check passed
@jbarciabf jbarciabf added the bug Something isn't working label Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AWS all-checks command ignores pmapper-data-basepath

1 participant