nerdexam
GIAC

GSEC · Question #245

Which practice can help protect secrets in a cloud environment?

The correct answer is C. Excluding the tfstate file from code repositories. Terraform state files store resource attributes in plaintext, including sensitive values like passwords and API keys, making them a critical secret exposure risk if committed to version control.

Cloud, Web, and Application Security

Question

Which practice can help protect secrets in a cloud environment?

Options

  • AAvoiding the use of Terraform variables
  • BRunning privileged docker runtime
  • CExcluding the tfstate file from code repositories
  • DUsing the -net-host flag

How the community answered

(49 responses)
  • A
    8% (4)
  • B
    16% (8)
  • C
    71% (35)
  • D
    4% (2)

Why each option

Terraform state files store resource attributes in plaintext, including sensitive values like passwords and API keys, making them a critical secret exposure risk if committed to version control.

AAvoiding the use of Terraform variables

Terraform variables are a recommended practice for parameterization and can even reference environment variables or secret managers, so avoiding them does not protect secrets.

BRunning privileged docker runtime

Running a privileged Docker runtime expands the attack surface and grants the container elevated host permissions, which is a security risk rather than a protection.

CExcluding the tfstate file from code repositoriesCorrect

The tfstate file persists all infrastructure state including sensitive data such as database passwords, private keys, and connection strings in plaintext JSON. Committing this file to a code repository exposes these secrets to anyone with repository access. Excluding it via .gitignore and using remote state backends with encryption is the correct mitigation.

DUsing the -net-host flag

The --net=host flag shares the host network namespace with the container for networking purposes and has no relationship to secret management or protection.

Concept tested: Terraform state file secret exposure risk

Source: https://developer.hashicorp.com/terraform/language/state/sensitive-data

Topics

#cloud secrets management#Terraform#tfstate file#infrastructure as code security

Community Discussion

No community discussion yet for this question.

Full GSEC Practice