TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Stop Putting AWS Credentials in GitHub Secrets

88 pointsby cnussover 3 years ago
Greetings!<p>I&#x27;ve created a GitHub action that works that allows GitHub Actions to exchange a GitHub token for AWS Access Credentials.<p>I&#x27;ve cultivated a few examples of it in action:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;aws-assume-role-action-examples" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;aws-assume-role-action-examples</a><p>I&#x27;ve always found management of AWS Credentials has been a pain. So this setting up this Action works like this:<p>1) A SAML Identity Provider is created in AWS<p>2) A Role in AWS is set up to trust that Identity Provider<p>3) A config file is added to the repository indicating which role can be assumed<p>4) The GitHub Action exchanges the Repo Secret for AWS Credentials using the SAML.to backend for the exchange<p>Let me know what you think! I&#x27;m Happy to take questions and comments here or on Gitter:<p><a href="https:&#x2F;&#x2F;gitter.im&#x2F;saml-to&#x2F;assume-aws-role-action" rel="nofollow">https:&#x2F;&#x2F;gitter.im&#x2F;saml-to&#x2F;assume-aws-role-action</a>

9 comments

SahAssarover 3 years ago
The title &quot;Show HN: Stop Putting AWS Credentials in GitHub Secrets&quot; to me sounds like it&#x27;s exposing some sort of specific vulunerability or similar but I might just be overreacting because of all the recent hacks.<p>A title like &quot;Show HN: A GitHub action to help using AWS credentials&quot; sounds more appropriate to me, saying what it is and what it does instead of saying what not to do.
评论 #29986308 未加载
orfover 3 years ago
Isn&#x27;t it just this? <a href="https:&#x2F;&#x2F;awsteele.com&#x2F;blog&#x2F;2021&#x2F;09&#x2F;15&#x2F;aws-federation-comes-to-github-actions.html" rel="nofollow">https:&#x2F;&#x2F;awsteele.com&#x2F;blog&#x2F;2021&#x2F;09&#x2F;15&#x2F;aws-federation-comes-to...</a> (<a href="https:&#x2F;&#x2F;github.com&#x2F;github&#x2F;roadmap&#x2F;issues&#x2F;249" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;github&#x2F;roadmap&#x2F;issues&#x2F;249</a>)<p>Why does SAML.to need to be used?
评论 #29986094 未加载
mdanielover 3 years ago
Some observations:<p>* it seems your package.json is still from an old iteration: <a href="https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;assume-aws-role-action&#x2F;blob&#x2F;main&#x2F;package.json#L8" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;assume-aws-role-action&#x2F;blob&#x2F;main&#x2F;...</a><p>* it was super opaque where this relative import comes from: <a href="https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;assume-aws-role-action&#x2F;blob&#x2F;main&#x2F;src&#x2F;action.ts#L9" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;assume-aws-role-action&#x2F;blob&#x2F;main&#x2F;...</a> but after some sniffing around, it seems to be some openapi generation magick <a href="https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;assume-aws-role-action&#x2F;blob&#x2F;main&#x2F;package.json#L17" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;assume-aws-role-action&#x2F;blob&#x2F;main&#x2F;...</a> against one of your own API endpoints <a href="https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;assume-aws-role-action&#x2F;blob&#x2F;main&#x2F;.scaffoldly&#x2F;services.json#L3" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;saml-to&#x2F;assume-aws-role-action&#x2F;blob&#x2F;main&#x2F;...</a> which seems to mean that using this toy is not &quot;self contained&quot; in the way that `sts:AssumeRoleWithWebIdentity` is
评论 #29986873 未加载
sirwinsleyover 3 years ago
I remember receiving a bill for 5K from Amazon once. When inspecting I realized that someone had found my keys in a public GitHub repo I had and was using my account to mine bitcoins. Thankfully AWS support was understanding and forgave me that amount.<p>Other than never exposing keys like that I learned to never hide admin keys and to always create roles specific to the use case. It doesn’t fully protect you but at least it prevents abuse on your behalf.
johnnypangsover 3 years ago
Does anyone know the differences between saml and open id connect? <a href="https:&#x2F;&#x2F;docs.github.com&#x2F;en&#x2F;enterprise-cloud@latest&#x2F;actions&#x2F;deployment&#x2F;security-hardening-your-deployments&#x2F;configuring-openid-connect-in-amazon-web-services" rel="nofollow">https:&#x2F;&#x2F;docs.github.com&#x2F;en&#x2F;enterprise-cloud@latest&#x2F;actions&#x2F;d...</a>
评论 #29986278 未加载
zomglingsover 3 years ago
What is wrong with putting AWS credentials in GitHub secrets?
评论 #29987060 未加载
评论 #29987859 未加载
评论 #29986264 未加载
评论 #29987459 未加载
评论 #29986230 未加载
TheSpiciestDevover 3 years ago
But then what would happen if the GitHub token leaks? Would someone then be able to retrieve their own credentials as if they were your CI&#x2F;CD pipeline? I feel like it be hard to audit that because a baddie would then be able to blend in with your CI&#x2F;CD pipeline&#x27;s traffic.<p>But you say you find &quot;management of AWS Credentials a pain&quot;, so I guess this isn&#x27;t for security purposes, right? More of just a convenience?<p>Don&#x27;t get me wrong, I&#x27;m all about lessening the amount of environment variables in a pipeline!.. especially with ones that you want to rotate!
评论 #29988644 未加载
nodesocketover 3 years ago
Complexity, the enemy of security. Why is using GitHub secrets insecure exactly?
评论 #29986209 未加载
评论 #29988585 未加载
评论 #29988166 未加载
评论 #29987073 未加载
zricethezavover 3 years ago
Speaking of credentials, you can use <a href="https:&#x2F;&#x2F;github.com&#x2F;zricethezav&#x2F;gitleaks" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;zricethezav&#x2F;gitleaks</a> to check if your repos contain any secrets
评论 #29986238 未加载