Repository navigation
feat(generate): publish outputs, and never one that reaches the password - #29
Merged
Merged
Conversation
A generated repository built infrastructure and then declined to say what
it built. No cluster endpoint, no database address, no subnet ids, so
finding them meant terraform state show. That is a workaround rather than
a workflow and it does not survive being put in a pipeline. It also
blocked the composition story the README implies, since
terraform_remote_state only exposes root module outputs.
Outputs are an explicit per-stack allowlist, not a forwarding of
everything upstream exposes. That distinction is the whole security
argument: terraform-aws-modules/rds also exposes
db_instance_master_user_secret, and a generator that forwarded wholesale
would be one upstream release away from publishing a credential nobody
chose to publish.
There is no password output and none that reaches one. sensitive = true
is not the mechanism, because terraform output is not privileged, -json
ignores the flag, and CI logs are not private. The mechanism is never
creating the output.
The test checks the name and the value expression, not the description:
an output called endpoint reading db_instance_master_user_secret is
exactly as dangerous as one called password, and only the second is
caught by reading names. Verified by adding
Output("db_connection", "module.rds.db_instance_master_user_secret") and
watching it fail, which is also why the description is excluded: scanning
prose flagged "Not a secret, but a large blob", whose only fix would have
been writing a worse description.
Generated README gains a Consuming what it built section with the
aws eks update-kubeconfig line, using the region the generator already
knows rather than parsing it back out of backend.tf.
Real plan against AWS (profile default, 604786434653): 63 to add, 0 to
change, 0 to destroy, with cluster_certificate_authority_data reported as
(sensitive value) and no password output present.
Closes #9
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ehtishammubarik
added a commit
that referenced
this pull request
Sep 20, 2026
…ready owns (#34) The v0.1.1 release failed at test-wheel on all three Pythons, published nothing, and surfaced a workflow that had been broken for five weeks. release.yml asserted `publicly_accessible = false` with a single space. create_db_subnet_group is 22 characters and joined that block in #13, so terraform fmt realigned the attribute to four spaces and the assertion has been false since 2026-07-31. Nothing noticed because the workflow runs only on a tag push, and no tag was cut in that window. The generated output was correct throughout: the database is private, and prod deletion_protection is true. The assertions should not have been there. tests/test_stackmason.py already covers both properties, and covers them whitespace-tolerantly, and the step directly above runs that suite against the installed package with the source tree deleted. The workflow copy was strictly worse duplication: no feedback loop between releases, so it drifted silently while the copy next to the code was kept correct. - release.yml: drop the HCL content assertions. What remains is what the suite genuinely cannot see, because it is about the artifact rather than the source: the entry point resolves from the wheel, a real `stackmason new` writes real files, the published build still refuses an 0.0.0.0/0 database and writes nothing when it blocks, and the output carries no literal credential. Added outputs.tf to the file list, since #29 made it part of every environment. - A comment states why there are no content assertions there, with the #13 alignment story, so the next person does not add one back. - tests: made the deletion_protection assertion whitespace-tolerant, matching the regex style already used two functions below it for publicly_accessible. Demonstrated both directions rather than assuming: realigned the attribute to one space -> test passes set prod deletion_protection = false -> test fails Verified: pytest 91 passed, coverage 90.90% against the 88% floor, ruff clean. Closes #33 Claude-Session: https://claude.ai/code/session_012fMM2HhoJ2XzDkfMR2HwSa Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9. One issue, one PR.
A generated repository built infrastructure and then declined to say what it built:
No cluster endpoint, no database address, no subnet ids. Finding them meant
terraform state show, which is a workaround rather than a workflow and does not survive being put in a pipeline. It also blocked the composition story the README implies, sinceterraform_remote_stateonly exposes root module outputs.The security argument, which decided the design
The issue's last checkbox is the one that shaped everything else:
So the rule is not "mark the password output
sensitive".sensitivestops casual printing; it does not stopterraform output -json, and the value is in state either way. The rule is never create an output that reaches the password at all, directly or transitively.That is why outputs are an explicit per-stack allowlist rather than a forwarding of everything upstream exposes.
terraform-aws-modules/rdsalso exposesdb_instance_master_user_secretand friends. A generator that forwarded wholesale would be one upstream release away from publishing a credential nobody chose to publish.The test, and why it reads the value expression
An output called
endpointthat readsmodule.rds.db_instance_master_user_secretis exactly as dangerous as one calledpassword, and only the second is caught by reading names. So the test checks name and value expression. I confirmed it catches the realistic mistake rather than only the obvious one:Innocuous name, caught anyway.
It deliberately does not scan
description. My first version did, and it failed on my own text: "Cluster CA certificate. Not a secret, but a large blob...". A test that flags prose has one fix available, which is writing a worse description. Descriptions are for humans and may legitimately discuss secrets; what can leak is what the output exposes.What is published
Nine outputs across three stacks, and only for stacks that were selected, so a repo generated without RDS never references
module.rds:The file opens by saying what is absent and why, because the next person's instinct will be to add a password output:
The generated README gains a Consuming what it built section with the
aws eks update-kubeconfigline the issue asked for, using the region the generator already knows rather than parsing it back out ofbackend.tf.Verification
Real
terraform planagainst AWS,AWS_PROFILE=default(604786434653):Terraform itself confirms the sensitive handling, and confirms no password output exists.
kubernetesandhelmgates skipped, not passed.Per this repo's roadmap rule, the #9 row moves out of Next into Now in this PR rather than afterwards.
Scope
One issue. The six stub stacks (#21-#26) are untouched; when each is configured it adds its own entry to
STACK_OUTPUTS, and the security test covers it automatically.