Skip to content
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

Feature Request: Weak GitHub OIDC Claim Verification #204

Closed
bviswanathan-exelixis opened this issue Nov 6, 2023 · 6 comments
Closed

Feature Request: Weak GitHub OIDC Claim Verification #204

bviswanathan-exelixis opened this issue Nov 6, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@bviswanathan-exelixis
Copy link

Ensure IAM policies to integrate with GitHub's OIDC provider validate the subject claim to limit the context in which the role can be assumed. If there are no conditions or the condition is too permissive, it could allow unintended repositories to assume the role.

Doc reference - https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect

@suzuki-shunsuke
Copy link
Owner

suzuki-shunsuke commented Nov 7, 2023

Thank you for your proposal.

If there are no conditions or the condition is too permissive, it could allow unintended repositories to assume the role.

This is AWS IAM Role's settings settings of cloud providers such as AWS, not GitHub Actions.
So this is out of scope of ghalint.

For example, in case of AWS, IAM Role's trust policy should be configured properly.

https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services

e.g.

"Condition": {
  "StringEquals": {
    "token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
    "token.actions.githubusercontent.com:sub": "repo:octo-org/octo-repo:ref:refs/heads/octo-branch"
  }
}

This is the setting of AWS, not GitHub Actions.

@suzuki-shunsuke
Copy link
Owner

suzuki-shunsuke commented Nov 7, 2023

If you have any ideas of new lint rules, could you tell us examples?

e.g. https://github.com/suzuki-shunsuke/ghalint#job_permissions

ghalint/README.md

Lines 29 to 81 in 187f8c9

### job_permissions
:x:
```yaml
permissions:
contents: read
jobs:
foo:
runs-on: ubuntu-latest
# Without permissions
steps:
- run: echo hello
bar:
runs-on: ubuntu-latest
# Without permissions
steps:
- uses: actions/checkout@v3
```
:o:
```yaml
jobs:
foo:
runs-on: ubuntu-latest
permissions: {} # Set permissions
steps:
- run: echo hello
bar:
runs-on: ubuntu-latest
permissions: # Set permissions
contents: read
steps:
- uses: actions/checkout@v3
```
Or
```yaml
permissions: {} # empty permissions
jobs:
foo:
runs-on: ubuntu-latest
steps:
- run: echo hello
bar:
runs-on: ubuntu-latest
permissions: # Set permissions
contents: read
steps:
- uses: actions/checkout@v3
```

@suzuki-shunsuke suzuki-shunsuke added the enhancement New feature or request label Nov 7, 2023
@bviswanathan-exelixis
Copy link
Author

@suzuki-shunsuke I don't have good idea on linting rules but if we can create rules for checking as written in this blog around github security best practices - https://engineering.salesforce.com/github-actions-security-best-practices-b8f9df5c75f5/ then that can be run as part of ghalint tool.

@bviswanathan-exelixis
Copy link
Author

Something like this one - https://github.com/turbot/steampipe-mod-github-sherlock

@suzuki-shunsuke
Copy link
Owner

suzuki-shunsuke commented Nov 30, 2023

I close this issue because the problem and action are not clear.
We need to clarify the issue and action in the scope of ghalint (GitHub Actions Linter).

I already created some issues based on some best practices and handled some of them.

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

No branches or pull requests

2 participants