Skip to content

fix(blueprints): address IL5 and FedRAMP-high security issues - #375

Open
LeonxLJX wants to merge 3 commits into
google:mainfrom
LeonxLJX:fix/373-blueprints-il5-fedramp-high
Open

LeonxLJX wants to merge 3 commits into
google:mainfrom
LeonxLJX:fix/373-blueprints-il5-fedramp-high

Conversation

@LeonxLJX

Copy link
Copy Markdown

Fixes #373.

Summary

This PR addresses multiple security and functional defects in blueprints/il5 and blueprints/fedramp-high:

Changes Made

  1. blueprints/il5/dataflow/main.tf - Fixed broken Terraform reference:

    • Changed network = var.network_project_id to network = var.network_name on google_dataflow_job
  2. blueprints/il5/gke/main.tf - Fixed private endpoint configuration:

    • Changed private_nodes = var.gke_cluster_enable_private_endpoint to private_nodes = true
  3. blueprints/il5/gke-hardened/main.tf - Fixed SA ID length limit and Config Sync:

    • Truncated account_id to 30 characters via substr()
    • Changed secret_type = "none" to secret_type = "gcenode"
  4. blueprints/fedramp-high/gitlab/main.tf - Switched to HTTPS and created dedicated node SA:

    • Changed protocol to HTTPS on application LB
    • Changed health check port from 80 to 443
    • Created dedicated google_service_account.gitlab_node_sa for GKE node pool
    • Wired node SA into compute network user and KMS IAM bindings

Security Impact

  • Fixes broken Terraform references that prevent blueprint deployment
  • Prevents service account creation failures from exceeding GCP 30-character ID limit
  • Ensures GitLab serves over HTTPS instead of HTTP
  • Implements least-privilege separation between GitLab VM and GKE node pool service accounts

- dataflow: fix network reference from var.network_project_id to var.network_name
- gke(il5): set private_nodes = true instead of variable reference
- gke-hardened: truncate SA account_id to 30 chars, fix secret_type to gcenode
- gitlab: switch LB protocol to HTTPS/443, create dedicated node service account
- wire node SA into compute network user and KMS crypto key IAM bindings
@google-cla

google-cla Bot commented Oct 28, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions Bot added Framework - IL5 DoD Impact Level 5 (IL5) compliance regime and controls Framework - FedRAMP High FedRAMP High compliance regime and controls Scope - Blueprint Related to solution blueprints in the blueprints directory labels Oct 28, 2026
@LeonxLJX

Copy link
Copy Markdown
Author

刚 force push 了 erraform fmt 修复 Repository Lint(for_each map key 对齐)。CI 会重新跑。

@LeonxLJX

Copy link
Copy Markdown
Author

Hi, I just signed the Google Contributor License Agreement (CLA). Could someone please re-run the \cla/google\ check? Thanks!

@aghassemlouei aghassemlouei added Bug Something isn't working Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week Priority - High Critical issues blocking development or users; urgent bugs or core features for release Security Something is insecure or can be secured labels Oct 29, 2026

@aghassemlouei aghassemlouei left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Appreciate the work addressing the il5 and fedramp-high blueprint defects. Running terraform plan across the touched blueprints surfaced four functional and deployment gaps documented inline:

  1. blueprints/fedramp-high/gitlab/main.tf omits project = var.project_id on google_service_account.gitlab_node_sa and gitlab_sa unlike the sibling resources in the file, leaves substr(..., 0, 30) susceptible to a trailing hyphen at character 30, and omits the baseline GKE node service account IAM roles on gitlab_node_sa.
  2. blueprints/il5/dataflow/main.tf passes bare var.network_name to google_dataflow_job.job alongside a Shared VPC subnetwork in var.network_project_id and omits project = var.main_project_id plus trailing-hyphen trimming on google_service_account.dataflow_worker.
  3. blueprints/il5/gke-hardened/main.tf can produce a trailing hyphen in substr(..., 0, 30) and hardcodes Config Sync secret_type = "gcenode", which breaks external Git repositories such as GitHub or GitLab; blueprints/il5/gke/main.tf also leaves gke-sa-${var.gke_cluster_name} untruncated.
  4. The description uses Fixes #373. while items 2, 3, and 4 of #373 in cloud-translation, document-ai, and il5/kms-project remain open, and omits the .github/pull_request_template.md sections. Please switch Fixes #373. to Part of #373. unless those items are included, and populate the pull request template.

Pushing a new commit with these updates will also re-trigger the cla/google check against the signed Contributor License Agreement.

Comment on lines +29 to +32
resource "google_service_account" "gitlab_node_sa" {
account_id = substr("gitlab-node-${var.project_id}", 0, 30)
display_name = "gitlab-gke-node-sa"
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Three issues prevent gitlab_node_sa from validating cleanly across project IDs and registering GKE nodes:

  1. Set project = var.project_id explicitly on google_service_account.gitlab_node_sa and google_service_account.gitlab_sa at line 24 to match the sibling resources in this file so child-module callers without a default provider project do not fail or target the wrong project.
  2. substr("gitlab-node-${var.project_id}", 0, 30) fails GCP service account ID validation whenever character 30 is a hyphen -. Wrap the expression in trimsuffix(substr("gitlab-node-${var.project_id}", 0, 30), "-").
  3. gitlab_node_sa is never granted the baseline GKE node IAM roles on data.google_project.project.project_id, specifically roles/logging.logWriter, roles/monitoring.metricWriter, roles/monitoring.viewer, roles/autoscaling.metricsWriter, and roles/artifactregistry.reader, and module "cluster" at line 246 still omits service_account under node_config for initial default-pool creation prior to removal.

parameters = var.parameters

network = var.network_project_id
network = var.network_name

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In a Shared VPC deployment where subnetwork resolves data.google_compute_subnetwork.subnetwork.self_link inside var.network_project_id, setting network = var.network_name causes Dataflow to look up the network inside var.main_project_id rather than the host project. Omit network when subnetwork is a full regions/.../subnetworks/... self link or pass data.google_compute_network.network.self_link, and add project = var.main_project_id plus trimsuffix(substr(..., 0, 30), "-") on google_service_account.dataflow_worker at line 55 so child-module callers do not rely on a provider-level default project.


resource "google_service_account" "gke" {
account_id = "gke-${var.main_project_id}"
account_id = substr("gke-${var.main_project_id}", 0, 30)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

substr("gke-${var.main_project_id}", 0, 30) fails GCP account_id regex validation ^[a-z](?:[-a-z0-9]{4,28}[a-z0-9])$ whenever character 30 is -. Use trimsuffix(substr("gke-${var.main_project_id}", 0, 30), "-"), and apply the same 30-character truncation to google_service_account.cluster_service_account in blueprints/il5/gke/main.tf at line 79 for gke-sa-${var.gke_cluster_name} from item 1 of #373:

Suggested change
account_id = substr("gke-${var.main_project_id}", 0, 30)
account_id = trimsuffix(substr("gke-${var.main_project_id}", 0, 30), "-")

git {
sync_repo = var.source_repo
secret_type = "none"
secret_type = "gcenode"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hardcoding secret_type = "gcenode" authenticates only to Cloud Source Repositories or Secure Source Manager via the node service account and breaks Config Sync whenever var.source_repo points to GitHub, GitLab, or an unauthenticated repository. Expose a config_sync_secret_type variable in variables.tf with a validation block covering none, ssh, cookiefile, gcenode, gcpserviceaccount, token, and githubapp, then regenerate README.md with tools/tfdoc.py.

@LeonxLJX

LeonxLJX commented Nov 4, 2026

Copy link
Copy Markdown
Author

Hi maintainers! @GoogleCloudPlatform/foundation-framework 👋 This PR is all green (no conflicts, CI passing) and has been rebased on latest. Could someone take a look when you have a moment? Thanks!

@Calvin-Cheng1

Copy link
Copy Markdown
Collaborator

@LeonxLJX Hello, thank you for the contribution so far. Please let us know if you are able to reconcile all outstanding comments/conversations related to the submitted code for this PR. If you are not able to resolve them by Friday, we will close this PR as the review is becoming stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Framework - FedRAMP High FedRAMP High compliance regime and controls Framework - IL5 DoD Impact Level 5 (IL5) compliance regime and controls Level of Effort - Medium Moderate task requiring thought and testing; typically takes a couple of days to a week Priority - High Critical issues blocking development or users; urgent bugs or core features for release Scope - Blueprint Related to solution blueprints in the blueprints directory Security Something is insecure or can be secured

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] blueprints/il5, fedramp-high: fix broken Terraform references, service account ID length limits, and GitLab HTTP listener

4 participants