Skip to content

Security: Harden GitOps infrastructure#2

Merged
somethingwithproof merged 1 commit intomainfrom
security/harden-gitops-infra
Feb 8, 2026
Merged

Security: Harden GitOps infrastructure#2
somethingwithproof merged 1 commit intomainfrom
security/harden-gitops-infra

Conversation

@somethingwithproof
Copy link
Owner

@somethingwithproof somethingwithproof commented Feb 8, 2026

Summary

  • Remove ArgoCD --insecure flag, configure TLS properly
  • Restrict EKS public access CIDRs via variable
  • Restrict ArgoCD project sources and destinations
  • Pin GitHub Actions to SHA hashes
  • Change tfsec soft_fail to false

Test plan

  • Terraform plan succeeds
  • ArgoCD configuration is valid
  • CI passes with pinned actions

- Remove ArgoCD --insecure flag, enable TLS certificate generation
- Add public_access_cidrs to EKS cluster (default: 10.0.0.0/8)
- Restrict ArgoCD project destinations to specific namespaces
- Remove untrusted helm chart repo from sourceRepos
- Pin GitHub Actions to SHA hashes (checkout@v4, setup-terraform@v3.1.2)
- Change tfsec soft_fail from true to false

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Security hardening for the GitOps + Terraform stack by tightening EKS API exposure, improving ArgoCD TLS settings, restricting ArgoCD project scope, and strengthening CI security checks.

Changes:

  • Add configurable public_access_cidrs for the EKS public API endpoint.
  • Remove ArgoCD --insecure usage and set Helm values to run with TLS (server.insecure=false).
  • Tighten ArgoCD AppProject repo/destination allow-lists, pin some GitHub Actions to SHAs, and make tfsec fail the build.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
terraform/modules/eks/variables.tf Introduces public_access_cidrs input (with a restrictive default).
terraform/modules/eks/main.tf Applies public_access_cidrs to the EKS cluster vpc_config.
terraform/modules/argocd/main.tf Removes --insecure and enables TLS-related Helm settings.
argocd/projects/default-project.yaml Restricts allowed source repos and destination namespaces for the default AppProject.
.github/workflows/ci.yaml Pins some actions to SHAs and makes tfsec non-soft-fail.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- namespace: 'default'
server: https://kubernetes.default.svc
- namespace: 'kube-system'
server: https://kubernetes.default.svc
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

default AppProject destinations are now limited to argocd, default, and kube-system, but existing ArgoCD Applications/ApplicationSets in this repo deploy into sample-app and sample-app-{dev,staging,production} namespaces. With this change those apps will be rejected as unauthorized destinations. Add the required destination namespaces (or adjust the apps/project strategy) so current manifests continue to sync.

Suggested change
server: https://kubernetes.default.svc
server: https://kubernetes.default.svc
- namespace: 'sample-app'
server: https://kubernetes.default.svc
- namespace: 'sample-app-dev'
server: https://kubernetes.default.svc
- namespace: 'sample-app-staging'
server: https://kubernetes.default.svc
- namespace: 'sample-app-production'
server: https://kubernetes.default.svc

Copilot uses AI. Check for mistakes.
Comment on lines +24 to 26
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f85571c5fb643da9750e94b949 # v3.1.2
with:
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

PR description says GitHub Actions are pinned to SHA hashes, but this workflow still uses version tags for aquasecurity/tfsec-action, azure/setup-helm, and ibiqlik/action-yamllint. Either pin those actions to commit SHAs as well, or update the PR description so expectations match the actual hardening applied.

Copilot uses AI. Check for mistakes.
variable "public_access_cidrs" {
description = "List of CIDR blocks that can access the EKS public API endpoint"
type = list(string)
default = ["10.0.0.0/8"]
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

Setting public_access_cidrs default to ["10.0.0.0/8"] changes the module's out-of-the-box behavior (and the dev environment doesn’t pass this variable), which can easily lock out kubectl/Terraform access to the public endpoint from typical operator/CI IPs. Consider keeping the module default aligned with AWS’s default behavior (or explicitly disabling public access by default) and pushing the hardened CIDR list down from the environment layer so it’s an intentional, visible choice per environment.

Suggested change
default = ["10.0.0.0/8"]
default = ["0.0.0.0/0"]

Copilot uses AI. Check for mistakes.
@somethingwithproof somethingwithproof merged commit 56cd68b into main Feb 8, 2026
9 of 10 checks passed
somethingwithproof added a commit that referenced this pull request Feb 8, 2026
…#2)

- Remove ArgoCD --insecure flag, enable TLS certificate generation
- Add public_access_cidrs to EKS cluster (default: 10.0.0.0/8)
- Restrict ArgoCD project destinations to specific namespaces
- Remove untrusted helm chart repo from sourceRepos
- Pin GitHub Actions to SHA hashes (checkout@v4, setup-terraform@v3.1.2)
- Change tfsec soft_fail from true to false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants