feat: mark a declared secret sensitive, and warn on a deprecated attribute - #93
Merged
Conversation
…ibute A property the document declares writeOnly or formats as a password generated as a plain, visible attribute: terraform printed it in plan output and wrote it to logs. Either declaration now marks the attribute Sensitive, and a deprecated one carries the framework's warning. The action and list schema packages declare no Sensitive field, so nothing is emitted there; a secret passed as an action argument stays unmarked, which is the framework's limit rather than a choice made here. All four packages declare DeprecationMessage. attributes.go crossed the 800-line ceiling, so it decomposes by protocol: how a declared type becomes an attribute kind, and the attributes that address an object rather than describe it. Co-Authored-By: Claude Opus 5 (1M context) <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.
mapping.md row 4. A property the document declares
writeOnlyor formats aspasswordgenerated as a plain, visible attribute — terraform printed it inplan output and wrote it to logs. That is the security-visible defect
handoff.md:107names, and #91 put the facts in place to fix it.What changed
ir.Attribute.Sensitive=writeOnly || format == "password", read fromboth sides. Either declaration is enough on its own:
format: passwordnameswhat the value is, and
writeOnlysays the API takes it and never gives itback, which is what a credential does.
attributeDeclemitsSensitive: trueandDeprecationMessage: "This attribute is deprecated and may be removed in a future API version."Both are plain fields on the attribute type, so unlike a validator or a plan
modifier they need no import to travel with them.
attributes.godecomposes. It crossed the 800-line ceiling, so it splitsby protocol into
attribute_types.go(how a declared type becomes anattribute kind, and the refusals that follow) and
attribute_addressing.go(the attributes that address an object rather than describe it). 529 / 141 /
142 lines.
One thing the framework does not allow
action/schemaandlist/schemaattribute types have noSensitivefield —I checked every attribute type in v1.19.0; they carry
DeprecationMessagebutnot
Sensitive. Emitting it there would not compile, andpostcheckwould havecaught it only after the fact.
rendersSensitive()gates it to the resource anddatasource packages.
So a secret passed as an action argument or a list filter stays unmarked. That is
the framework's limit rather than a choice made here, and it is stated as such in
the code.
TestUnit_AttributeDecl_OmitsSensitiveWhereThePackageLacksItholds it.Measured effect
Refusals unchanged on all three pilots — 817 / 290 / 343.
provider verifyreports no drift. This adds fields to attributes that already generated; it
recovers nothing and loses nothing.
What moved is the schema itself, counting entity code only (the three
provider-block occurrences are excluded):
SensitivebeforeDeprecationMessagebeforegithub stays at zero for
Sensitivebecause it declares neitherwriteOnlynorformat: passwordanywhere — which is what #91 measured, so this is the expectedanswer rather than a miss.
Why 50 sensitive attributes in the IR become 26 in jamfpro's schema
The IR marks more than the schema emits, and the difference is honest: a
write-only field has no getter on the read model, so
sdkbindprunes it withcarries no GetPasswordEscaped to read "password" from. Those attributes neverreach a schema at all — that is mapping.md row 1, which needs
WriteOnlysupportand is not attempted here.
Gates
gofmt -l internal cmd— emptyscripts/repo_hygiene_gate.sh— pass (it is what forced the decomposition)golangci-lint run— 0 issuesgo build ./... && go vet ./...— passgo test ./...— pass, coverage 91.4% totalprovider generate(postcheck) +provider verifyon all three — no driftNew tests:
internal/emit/render_schema_test.go(3, one per schema packagefamily) and
TestUnit_Attribute_MarksADeclaredSecretSensitive.🤖 Generated with Claude Code