chore(terraform): terraform security hardening#993
Conversation
…n, refine lock semantics
|
@olepg Sensible changes, though I'm not entirely certain on change no. 2. @equinor/ops-actions-maintainers Opinions? |
|
@sefornes From my experience, terraform plans will go stale within a few hours, so they are useless in the following days regardless. I'm happy to change the timeout to a few days if you feel that is more suitable. 35 is overkill. |
|
I agree with @sefornes on change nr. 2, in my experience I've had to keep the tarball for more than 24h. I've also havent had any issues with the changes going stale, allthough I can agree that 31 days might be excessive. We do have a planning session today where we can discuss this and find a sensible number. |
|
Happy to join the session if you want input. |
2 make variable, default 5 days3 make seperate pr |
…N_PASSWORD masking
Two small, independent hardening changes to the reusable
terraform.ymlworkflow.1. Stop leaking
ENCRYPTION_PASSWORDto every stepRemoved
ENCRYPTION_PASSWORDfrom the workflow-levelenv:block and scoped it to only the two steps that actually need it (Create tarballin the plan job,Extract tarballin the apply job).Secrets passed via
secrets:to a reusable workflow are auto-masked by GitHub. Promoting them to a workflow-levelenv:widens exposure to every step (including any third-party actions added later) with no benefit. The secret's description was updated to note this.2. Make plan-tarball retention configurable (default 5 days, was 35)
Added a new
artifact_retention_daysinput (number, default5) and use it forretention-dayson theUpload artifactstep.The artifact contains the full Terraform configuration and plan, encrypted with
ENCRYPTION_PASSWORD. It is only consumed by the Apply job in the same workflow run. 35 days of retention is unnecessary exposure window if the password ever leaks. Making it an input lets consumers tune the value to their deployment cadence (e.g. workflows that span multiple environments over several days can opt for a higher value).This is an additive input change — existing consumers get the new 5-day default automatically without any code changes.
The lock-semantics change originally proposed here has been split out into #997.