Coder Social home page Coder Social logo

aripalo / aws-cdk-github-oidc Goto Github PK

View Code? Open in Web Editor NEW
118.0 118.0 17.0 997 KB

CDK constructs to use OpenID Connect for authenticating your Github Action workflow with AWS IAM

License: Apache License 2.0

JavaScript 8.08% TypeScript 91.92%
aws aws-cdk aws-cdk-construct cdk github github-actions iam oidc openid-connect python typescript

aws-cdk-github-oidc's People

Contributors

aripalo avatar dependabot[bot] avatar haaja avatar heikkis avatar pgarbe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aws-cdk-github-oidc's Issues

Feature: allow setting an array of filters (subjects)

Currently, it is only possible to set one filter per role.

StringLike: {
// Only allow specified subjects to assume this role
[`${GithubActionsIdentityProvider.issuer}:sub`]: subject,
},

However I believe it is possible to support an array of filters, like so:

      "Condition": {
        "ForAnyValue:StringLike": {
          "token.actions.githubusercontent.com:sub": [
            "repo:myorg/myrepo:ref:refs/heads/test-branch-1",
            "repo:myorg/myrepo:ref:refs/heads/test-branch-2"
          ]
        }

(not actually tested, source)

Feature: support partitions

It seems that the library does not support other partitions than the different one.
I have an implementation for this and I will open a PR soon.

adding repo to trust policy does not allow role assumption

When making a role like so

    const githubActionsRole = new GithubActionsRole(this, roleName, {
      roleName: roleName,
      provider,
      owner: 'f',
      repo: 'catalog',
      filter: 'ref:refs/heads/main'
    })
    

it makes a policy like this

            "Condition": {
                "StringEquals": {
                    "token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
                },
                "StringLike": {
                    "token.actions.githubusercontent.com:sub": "repo:f/catalog:ref:refs/head/main"
                }
            }

but it will not work with github unless it is this

            "Condition": {
                "StringEquals": {
                    "token.actions.githubusercontent.com/jamf:sub": "repo:f/catalog:ref:refs/heads/main",
                    "token.actions.githubusercontent.com/jamf:aud": "sts.amazonaws.com"
                }
            }

behaves similarly with or without the filter defined

Stale GitHub thumbprints

GitHub has updated their certificates:
https://github.blog/changelog/2023-06-27-github-actions-update-on-oidc-integration-with-aws/
You can see the thread of challenges for people here:
aws-actions/configure-aws-credentials#357

For temporary workaround:

    (GithubActionsIdentityProvider as any).thumbprints = [
      '1c58a3a8518e8759bf075b76b750d4f2df264fcd', // 2023-06-27
      '6938fd4d98bab03faadb97b34396831e3780aea1',
    ];
    const provider = new GithubActionsIdentityProvider(this, 'GithubProvider');

I cannot make a PR against origin, but essentially here is the fix:
pmoghaddam#1
I extended the code to more natively support overriding going forward.

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

Github Thumbprints can be ommited

Hi there,

Just wanted to let you know, that you can omit the github certificates thumbprints and cdk/aws will fetch them on its own.

I am referring to this lines:
https://github.com/aripalo/aws-cdk-github-oidc/blob/main/src/provider.ts#L20-L23

See also the docs to the thumbprints parameter in the official docs

Type: string[] (optional, default: If no thumbprints are specified (an empty array or undefined), the thumbprint of the root certificate authority will be obtained from the provider's server as described in https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_oidc_verify-thumbprint.html)

Its probably easier if you stick with that solution as a Constructs Library Maintainer, in case github change its certificate you dont need to maintain thumbprints at all.

Deprecate NodeJS v14 LTS and upgrade to v16 LTS

NodeJS v14 LTS has reached its end-of-life. Latest Projen requires active LTS version of NodeJS:

Screenshot 2023-08-03 at 1 27 11

In some ways, this could be a major version release (for this construct), but as fixing current vulnerabilities requires updating Projen as well, using NodeJS v14 results in a build error (for this construct):
Screenshot 2023-08-03 at 1 36 46 copy

So, doing this in non-major version bump isn't optimal (and apologies for anyone this may cause trouble) but requiring NodeJS v16 is reasonable requirement (in my mind at least) because:

On that note, I will be enabling DependaBot security update Pull Requests for this repo (I dunno why I've disabled them at some point - probably accident), to hopefully avoid this kind of mess in the future where a lot of depedency updates are required at one go.

Constructs are not taggable

Looks like the custom constructs in this library are not taggable. Therefore tags added on the stack or app level don't propagate to resources created by custom constructs in this library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.