Skip to content

Commit

Permalink
Prevent unexpected privileges escalation (#136)
Browse files Browse the repository at this point in the history
* Prevent unexpected privileges escalation

* Auto Format

* Update README.md

* Auto Format

---------

Co-authored-by: cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>
Co-authored-by: nitrocode <7775707+nitrocode@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 28, 2023
1 parent ea8401e commit 31d0b8a
Show file tree
Hide file tree
Showing 16 changed files with 393 additions and 189 deletions.
72 changes: 72 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: Bug report
description: Create a report to help us improve
labels: ["bug"]
assignees: [""]
body:
- type: markdown
attributes:
value: |
Found a bug?
Please checkout our [Slack Community](https://slack.cloudposse.com)
or visit our [Slack Archive](https://archive.sweetops.com/).
[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
- type: textarea
id: concise-description
attributes:
label: Describe the Bug
description: A clear and concise description of what the bug is.
placeholder: What is the bug about?
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected.
placeholder: What happened?
validations:
required: true

- type: textarea
id: reproduction-steps
attributes:
label: Steps to Reproduce
description: Steps to reproduce the behavior.
placeholder: How do we reproduce it?
validations:
required: true

- type: textarea
id: screenshots
attributes:
label: Screenshots
description: If applicable, add screenshots or logs to help explain.
validations:
required: false

- type: textarea
id: environment
attributes:
label: Environment
description: Anything that will help us triage the bug.
placeholder: |
- OS: [e.g. Linux, OSX, WSL, etc]
- Version [e.g. 10.15]
- Module version
- Terraform version
validations:
required: false

- type: textarea
id: additional
attributes:
label: Additional Context
description: |
Add any other context about the problem here.
validations:
required: false
71 changes: 71 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
name: Feature Request
description: Suggest an idea for this project
labels: ["feature request"]
assignees: [""]
body:
- type: markdown
attributes:
value: |
Have a question?
Please checkout our [Slack Community](https://slack.cloudposse.com)
or visit our [Slack Archive](https://archive.sweetops.com/).
[![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
- type: textarea
id: concise-description
attributes:
label: Describe the Feature
description: A clear and concise description of what the feature is.
placeholder: What is the feature about?
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected.
placeholder: What happened?
validations:
required: true

- type: textarea
id: use-case
attributes:
label: Use Case
description: |
Is your feature request related to a problem/challenge you are trying
to solve?
Please provide some additional context of why this feature or
capability will be valuable.
validations:
required: true

- type: textarea
id: ideal-solution
attributes:
label: Describe Ideal Solution
description: A clear and concise description of what you want to happen.
validations:
required: true

- type: textarea
id: alternatives-considered
attributes:
label: Alternatives Considered
description: Explain alternative solutions or features considered.
validations:
required: false

- type: textarea
id: additional
attributes:
label: Additional Context
description: |
Add any other context about the problem here.
validations:
required: false
22 changes: 15 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
## what
* Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
* Use bullet points to be concise and to the point.

<!--
- Describe high-level what changed as a result of these commits (i.e. in plain-english, what do these changes mean?)
- Use bullet points to be concise and to the point.
-->

## why
* Provide the justifications for the changes (e.g. business case).
* Describe why these changes were made (e.g. why do these commits fix the problem?)
* Use bullet points to be concise and to the point.

<!--
- Provide the justifications for the changes (e.g. business case).
- Describe why these changes were made (e.g. why do these commits fix the problem?)
- Use bullet points to be concise and to the point.
-->

## references
* Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow).
* Use `closes #123`, if this PR closes a GitHub issue `#123`

<!--
- Link to any supporting github issues or helpful documentation to add some context (e.g. stackoverflow).
- Use `closes #123`, if this PR closes a GitHub issue `#123`
-->
4 changes: 2 additions & 2 deletions .github/workflows/auto-context.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
make init
make github/init/context.tf
make readme/build
echo "::set-output name=create_pull_request::true"
echo "create_pull_request=true" >> "$GITHUB_OUTPUT"
fi
else
echo "This module has not yet been updated to support the context.tf pattern! Please update in order to support automatic updates."
Expand All @@ -37,7 +37,7 @@ jobs:
if: steps.update.outputs.create_pull_request == 'true'
uses: cloudposse/actions/github/create-pull-request@0.30.0
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
committer: 'cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>'
author: 'cloudpossebot <11232728+cloudpossebot@users.noreply.github.com>'
commit-message: Update context.tf from origin source
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/auto-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
if: github.event.pull_request.state == 'open'
name: Privileged Checkout
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
# Check out the PR commit, not the merge commit
# Use `ref` instead of `sha` to enable pushing back to `ref`
Expand All @@ -30,7 +30,7 @@ jobs:
if: github.event.pull_request.state == 'open'
shell: bash
env:
GITHUB_TOKEN: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.REPO_ACCESS_TOKEN }}"
run: make BUILD_HARNESS_PATH=/build-harness PACKAGES_PREFER_HOST=true -f /build-harness/templates/Makefile.build-harness pr/auto-format/host

# Commit changes (if any) to the PR branch
Expand All @@ -54,10 +54,10 @@ jobs:
[[ $SENDER == "cloudpossebot" ]] || git push
# Set status to fail, because the push should trigger another status check,
# and we use success to indicate the checks are finished.
printf "::set-output name=%s::%s\n" "changed" "true"
echo "changed=true" >> "$GITHUB_OUTPUT"
exit 1
else
printf "::set-output name=%s::%s\n" "changed" "false"
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No changes detected"
fi
Expand All @@ -75,7 +75,7 @@ jobs:
contains(' 37929162 29139614 11232728 ', format(' {0} ', github.event.pull_request.user.id))
&& steps.commit.outputs.changed == 'false' && github.event.pull_request.state == 'open'
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
repository: cloudposse/actions
event-type: test-command
client-payload: |-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/auto-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
default_branch=$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name)
printf "::set-output name=defaultBranch::%s\n" "${default_branch}"
echo "defaultBranch=${default_branch}" >> "$GITHUB_OUTPUT"
printf "defaultBranchRef.name=%s\n" "${default_branch}"
- name: Update readme
Expand All @@ -52,7 +52,7 @@ jobs:
# If a PR of the auto-update/readme branch is open, this action will just update it, not create a new PR.
uses: cloudposse/actions/github/create-pull-request@0.30.0
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
commit-message: Update README.md and docs
title: Update README.md and docs
body: |-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
- uses: actions-ecosystem/action-get-merged-pull-request@v1
id: get-merged-pull-request
with:
github_token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
github_token: ${{ secrets.REPO_ACCESS_TOKEN }}
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
with:
publish: ${{ !contains(steps.get-merged-pull-request.outputs.labels, 'no-release') }}
prerelease: false
config-name: auto-release.yml
env:
GITHUB_TOKEN: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
4 changes: 2 additions & 2 deletions .github/workflows/chatops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: "Handle common commands"
uses: cloudposse/actions/github/slash-command-dispatch@0.30.0
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
reaction-token: ${{ secrets.GITHUB_TOKEN }}
repository: cloudposse/actions
commands: rebuild-readme, terraform-fmt
Expand All @@ -26,7 +26,7 @@ jobs:
- name: "Run tests"
uses: cloudposse/actions/github/slash-command-dispatch@0.30.0
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
reaction-token: ${{ secrets.GITHUB_TOKEN }}
repository: cloudposse/actions
commands: test
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-codeowners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
checks: "syntax,owners,duppatterns"
owner_checker_allow_unowned_patterns: "false"
# GitHub access token is required only if the `owners` check is enabled
github_access_token: "${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}"
github_access_token: "${{ secrets.REPO_ACCESS_TOKEN }}"
- uses: mszostok/codeowners-validator@v0.7.1
if: github.event.pull_request.head.repo.full_name != github.repository
name: "Syntax check of CODEOWNERS"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Available targets:
| <a name="input_launch_template_version"></a> [launch\_template\_version](#input\_launch\_template\_version) | The version of the specified launch template to use. Defaults to latest version. | `list(string)` | `[]` | no |
| <a name="input_max_size"></a> [max\_size](#input\_max\_size) | Maximum number of worker nodes | `number` | n/a | yes |
| <a name="input_metadata_http_endpoint_enabled"></a> [metadata\_http\_endpoint\_enabled](#input\_metadata\_http\_endpoint\_enabled) | Set false to disable the Instance Metadata Service. | `bool` | `true` | no |
| <a name="input_metadata_http_put_response_hop_limit"></a> [metadata\_http\_put\_response\_hop\_limit](#input\_metadata\_http\_put\_response\_hop\_limit) | The desired HTTP PUT response hop limit (between 1 and 64) for Instance Metadata Service requests.<br>The default is `2` to support containerized workloads. | `number` | `2` | no |
| <a name="input_metadata_http_put_response_hop_limit"></a> [metadata\_http\_put\_response\_hop\_limit](#input\_metadata\_http\_put\_response\_hop\_limit) | The desired HTTP PUT response hop limit (between 1 and 64) for Instance Metadata Service requests.<br>The default is `2` to allows containerized workloads assuming the instance profile, but it's not really recomended. You should use OIDC service accounts instead. | `number` | `2` | no |
| <a name="input_metadata_http_tokens_required"></a> [metadata\_http\_tokens\_required](#input\_metadata\_http\_tokens\_required) | Set true to require IMDS session tokens, disabling Instance Metadata Service Version 1. | `bool` | `true` | no |
| <a name="input_min_size"></a> [min\_size](#input\_min\_size) | Minimum number of worker nodes | `number` | n/a | yes |
| <a name="input_module_depends_on"></a> [module\_depends\_on](#input\_module\_depends\_on) | Can be any value desired. Module will wait for this value to be computed before creating node group. | `any` | `null` | no |
Expand Down Expand Up @@ -465,7 +465,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

## Copyright

Copyright © 2017-2022 [Cloud Posse, LLC](https://cpco.io/copyright)
Copyright © 2017-2023 [Cloud Posse, LLC](https://cpco.io/copyright)



Expand Down
2 changes: 1 addition & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
| <a name="input_launch_template_version"></a> [launch\_template\_version](#input\_launch\_template\_version) | The version of the specified launch template to use. Defaults to latest version. | `list(string)` | `[]` | no |
| <a name="input_max_size"></a> [max\_size](#input\_max\_size) | Maximum number of worker nodes | `number` | n/a | yes |
| <a name="input_metadata_http_endpoint_enabled"></a> [metadata\_http\_endpoint\_enabled](#input\_metadata\_http\_endpoint\_enabled) | Set false to disable the Instance Metadata Service. | `bool` | `true` | no |
| <a name="input_metadata_http_put_response_hop_limit"></a> [metadata\_http\_put\_response\_hop\_limit](#input\_metadata\_http\_put\_response\_hop\_limit) | The desired HTTP PUT response hop limit (between 1 and 64) for Instance Metadata Service requests.<br>The default is `2` to support containerized workloads. | `number` | `2` | no |
| <a name="input_metadata_http_put_response_hop_limit"></a> [metadata\_http\_put\_response\_hop\_limit](#input\_metadata\_http\_put\_response\_hop\_limit) | The desired HTTP PUT response hop limit (between 1 and 64) for Instance Metadata Service requests.<br>The default is `2` to allows containerized workloads assuming the instance profile, but it's not really recomended. You should use OIDC service accounts instead. | `number` | `2` | no |
| <a name="input_metadata_http_tokens_required"></a> [metadata\_http\_tokens\_required](#input\_metadata\_http\_tokens\_required) | Set true to require IMDS session tokens, disabling Instance Metadata Service Version 1. | `bool` | `true` | no |
| <a name="input_min_size"></a> [min\_size](#input\_min\_size) | Minimum number of worker nodes | `number` | n/a | yes |
| <a name="input_module_depends_on"></a> [module\_depends\_on](#input\_module\_depends\_on) | Can be any value desired. Module will wait for this value to be computed before creating node group. | `any` | `null` | no |
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/fixtures.us-east-2.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stage = "test"

name = "eks-node-group"

kubernetes_version = "1.21"
kubernetes_version = "1.25"

oidc_provider_enabled = true

Expand Down Expand Up @@ -43,4 +43,4 @@ kubernetes_taints = [
key = "test"
value = null
effect = "PREFER_NO_SCHEDULE"
}]
}]
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ module "https_sg" {

module "eks_cluster" {
source = "cloudposse/eks-cluster/aws"
version = "2.2.0"
version = "2.4.0"

region = var.region
vpc_id = module.vpc.vpc_id
Expand Down
Loading

0 comments on commit 31d0b8a

Please sign in to comment.