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

Clarification in trust-relationship policy example #12137

Merged
merged 10 commits into from
Feb 16, 2022

Conversation

conradt-paf
Copy link
Contributor

@conradt-paf conradt-paf commented Nov 19, 2021

I've tested a wide variety of cases and compared to Cloudtrail Events.

only sub is currently sent to and compared in AWS open-id connector for GitHub.
aud will always be sts.amazonaws.com, making the aud string used in the example obsolete (and possibly misleading)

So, the IAM trust relationship policy (GitHub OIDC -> AWS) for the role-to-be-assumed should perform conditional checks on sub which (currently only) contain this information:

"token.actions.githubusercontent.com:sub": "repo:organization-name/repository-name:ref:refs/heads/branch-name"

If the conditional StringLike is used, wildcard can be used for branch-name

There might be other things to touch up on in this README.md to reflect this information

Why:

fix some confusion

What's being changed:

IAM policy example will correctly check for aud and sub claim that AWS openid-connector uses.
sub claim inherently contains organization claim already.

We also use ForAllValues to correctly perform an AND operation (instead of OR)

Check off the following:

  • I have reviewed my changes in staging (look for "Automatically generated comment" and click Modified to view your latest changes).
  • For content changes, I have completed the self-review checklist.

Writer impact (This section is for GitHub staff members only):

  • This pull request impacts the contribution experience
    • I have added the 'writer impact' label
    • I have added a description and/or a video demo of the changes below (e.g. a "before and after video")

@welcome
Copy link

welcome bot commented Nov 19, 2021

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Nov 19, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2021

Automatically generated comment ℹ️

This comment is automatically generated and will be overwritten every time changes are committed to this branch.

The table contains an overview of files in the content directory that have been changed in this pull request. It's provided to make it easy to review your changes on the staging site. Please note that changes to the data directory will not show up in this table.


Content directory changes

You may find it useful to copy this table into the pull request summary. There you can edit it to share links to important articles or changes and to give a high-level overview of how the changes in your pull request support the overall goals of the pull request.

Source Staging Production What Changed
content/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services.md Modified Original

@github-actions github-actions bot temporarily deployed to docs-12137--patch-2 November 19, 2021 08:07 Inactive
@conradt-paf conradt-paf changed the title Correct misleading IAM example user ForAllValues in IAM policy example Nov 19, 2021
@conradt-paf conradt-paf changed the title user ForAllValues in IAM policy example use ForAllValues in IAM policy example Nov 19, 2021
@ramyaparimi ramyaparimi added content This issue or pull request belongs to the Docs Content team waiting for review Issue/PR is waiting for a writer's review and removed triage Do not begin working on this issue until triaged by the team labels Nov 19, 2021
@ramyaparimi
Copy link
Contributor

@conradt-paf
Thanks so much for opening a PR! I'll get this triaged for review ⚡

I've tested a wide variety of cases and compared to Cloudtrail Events.

only `sub` is currently sent to and compared in AWS open-id connector for GitHub.
`aud` will *always* be sts.amazonaws.com

So, the IAM trust relationship policy (GitHub OIDC -> AWS) for the role-to-be-assumed should perform conditional checks on `sub` which contains this information:

`"token.actions.githubusercontent.com:sub": "repo:organization-name/repository-name:ref:refs/heads/branch-name"`

If the conditional StringLike is used, wildcard can be used for `branch-name`

There might be other things to touch up on in this README.md to reflect this information
@conradt-paf conradt-paf changed the title use ForAllValues in IAM policy example Clarification in trust-relationship policy Nov 19, 2021
@conradt-paf conradt-paf changed the title Clarification in trust-relationship policy Clarification in trust-relationship policy example Nov 19, 2021
@github-actions github-actions bot temporarily deployed to docs-12137--patch-2 November 19, 2021 16:13 Inactive
@conradt-paf
Copy link
Contributor Author

conradt-paf commented Nov 19, 2021

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

Using StringLike

"Condition": {
  "StringLike": {
    "token.actions.githubusercontent.com:sub": "repo:octo-org/octo-repo:ref:refs/heads/*"
  }
}

@github-actions github-actions bot temporarily deployed to docs-12137--patch-2 November 19, 2021 16:39 Inactive
@conradt-paf
Copy link
Contributor Author

Tested and working, that was the final commit. You may push to this fork/branch if possible

@conradt-paf
Copy link
Contributor Author

@conradt-paf Thanks so much for opening a PR! I'll get this triaged for review ⚡

Thank you, I added even more clarification after rigorous testing and trying to find out how this works

@ramyaparimi ramyaparimi added the actions This issue or pull request should be reviewed by the docs actions team label Dec 6, 2021
@martin389
Copy link
Contributor

Status update: I've asked for tech review of these proposed changes 👍

@martin389
Copy link
Contributor

martin389 commented Jan 31, 2022

Update: just doing some final checks

@github-actions github-actions bot temporarily deployed to docs-12137--patch-2 February 3, 2022 07:41 Inactive
@redova87

This comment was marked as spam.

@github-actions github-actions bot temporarily deployed to docs-12137--patch-2 February 8, 2022 04:48 Inactive
@Benzgood77

This comment was marked as spam.

@Benzgood77

This comment was marked as spam.

@Benzgood77

This comment was marked as spam.

@martin389
Copy link
Contributor

Status update: confirming tech review

Copy link
Contributor

@martin389 martin389 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PM has approved this change 👍

@martin389 martin389 merged commit 0f2392a into github:main Feb 16, 2022
@github-actions
Copy link
Contributor

Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team waiting for review Issue/PR is waiting for a writer's review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants