Do you know a way where RBAC can be used for the above?
For us, we're using long lived credentials in this space using IAM Users but with very tightly controlled authorisations.
https://aws.amazon.com/about-aws/whats-new/2022/07/aws-ident...
You add the long lived IAM user API key/secret to it and it stores it in a password protected storage (MacOS keychain or similar).
Then you invoke aws-vault with an IAM role and command, and it will handle obtaining short-lived credentials scoped to that role (including TOTP 2-factor code auth), and then run the command with those temporary credentials as env vars.
With the right AWS permissions on your user, it can also automatically rotate the IAM user API keys for you.
aws-vault is one of them, though out of support now, aws-okta [1] is another.
Just an FYI it's no longer supported and it looks like the fork has gone stagnant, too.
Not Invented Here
I still use aws-vault, though, when I'm not in a position to set up AWS SSO.
Static, long lived secrets with limited governance that have no conditional access guards are weapons of mass self destruction.
Refreshing an environment variable that has changed is (for me) a line I won't cross. Time to write the app a different way, once that becomes a concern.
For example, for AWS you can create long lived credentials for users which are scoped to only allow one operation, namely obtaining a short lived token (with the aid of a hardware token such as a Yubikey) with scope to perform other operations.
AWS guide here: https://aws.amazon.com/blogs/security/enhance-programmatic-a...
The oidc subject includes the GitHub org, repo, branch, and environment for the IAM assume role policy to match or filter.