fix: skip secure params lint for type aliases#19796
Open
nanookclaw wants to merge 2 commits into
Open
Conversation
| CompileAndTest(""" | ||
| type SecureStringType = string | ||
|
|
||
| param password SecureStringType |
Member
There was a problem hiding this comment.
This doesn't seem like the right behavior - this should still be flagged
Contributor
Author
There was a problem hiding this comment.
Fixed in 80867b9. User-defined type references with secret-like parameter names are flagged again unless the referenced alias resolves to a secure declared type.
| } | ||
|
|
||
| type ContainerAppSecretListType = { | ||
| secureList: ContainerAppSecretType[] |
Member
There was a problem hiding this comment.
Despite the name, this is not marked as @secure() and should continue to be flagged
Contributor
Author
There was a problem hiding this comment.
Fixed in 80867b9. This unannotated alias case now produces the secure-secrets-in-params diagnostic; only @secure() type aliases are skipped.
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.
Description
Fixes #15086.
The
secure-secrets-in-paramsrule was flagging parameters whose declared type is a user-defined type alias that resolves tostringorobject. Its quick fix then offered@secure(), but the compiler rejects applying@secure()to type aliases.This updates the name-based heuristic to skip parameters whose declared type syntax resolves through a type alias/imported type alias, matching the compiler restriction that already reports
DecoratorMayNotTargetTypeAlias. The default-value check still reports parameters that reference a secure parameter, so that existing security signal is preserved.Added focused linter tests for object and string alias false positives, direct
objectbehavior, and default values referencing secure parameters.Checklist
Microsoft Reviewers: Open in CodeFlow