Skip to content

fix: Modify principal #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

fix: Modify principal #104

wants to merge 5 commits into from

Conversation

babyhuey
Copy link

I've modified the __user_email method to handle more cases where user identity information might be present in the CloudTrail event. The new code will:

  • First check if there's a userIdentity field at all
  • Try to get the email from principalId if it exists (common in IAM role cases)
  • Try to get the email from userName if it exists
  • Try to get the email from the arn field if it exists
  • As a last resort, try to find an email in the entire userIdentity object
  • Return "Unknown" only if none of the above methods work

This should help capture more user identities and reduce the number of "Unknown" principals in notifications. The code will now handle various ways that AWS might represent user identity in CloudTrail events, including:

  • IAM users with email addresses
  • IAM roles with assumed role sessions
  • Federated users
  • AWS service principals

@babyhuey babyhuey changed the title Modify principal fix: Modify principal Mar 27, 2025
@babyhuey
Copy link
Author

babyhuey commented May 9, 2025

Any chance of this getting looked at anytime soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant