common-fate / granted

The easiest way to access your cloud.
https://granted.dev
MIT License
955 stars 90 forks source link

feature/use-aws-user-id-sso #665

Open omaotzu opened 1 month ago

omaotzu commented 1 month ago

Firstly to caveat this is my first time contributing to a project and also my first time writing anything in go so please bear with me.

My knowledge isn't great enough to foresee any untoward complications but we ran into several issues related to the randomised gtnd user id and thought I would give it a crack.

Any guidance or feedback would be greatly appreciated and understand that more work may be required on my part (or you can just outright dismiss this 😆 if it's stupid or my approach is wildly off)

Primarily the issues that we faced were the same as outlined within this issue: https://github.com/common-fate/granted/issues/614

What changed?

Why?

Thus finding a method of attributing a userId that was unique to the user rather to the session is imperative for us to continue using this package.

How did you test it?

Potential risks

Is patch release candidate?

Link to relevant docs PRs

omaotzu commented 1 month ago

@shwethaumashanker Any chance of taking a look at this and getting some guidance / feedback if possible?

chrnorm commented 1 month ago

Hi @omaotzu, thanks so much for opening a contribution here. I certainly agree that the current random IDs make attribution difficult in CloudTrail and would like to improve this.

One concern I have is that the RoleSessionName field is user-controlled. If you rely on this for detection, it is possible for an attacker to manipulate this field and change the user ID that events are attributed to. Are you aware if there are any IAM conditions that we'd be able to recommend here to ensure users can only apply a RoleSessionName that matches claims from the IAM Identity Center SAML provider?

omaotzu commented 1 month ago

@chrnorm thanks for your swift response and useful feedback and now that you've mentioned you are correct.

Let me take it away and I'll get back to you as soon as I can!