Skip to content

[deprecation] Deprecate AddSensitiveParameterAttributeRector - #8337

Merged
TomasVotruba merged 1 commit into
mainfrom
deprecate-sensitive-parameter-attribute-rector
Aug 10, 2026
Merged

[deprecation] Deprecate AddSensitiveParameterAttributeRector#8337
TomasVotruba merged 1 commit into
mainfrom
deprecate-sensitive-parameter-attribute-rector

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

The rule depends on a user-provided list of variable names and adds #[\SensitiveParameter] to every parameter that matches by name. Name matching is vague and risky: the same name can hold a non-sensitive value in another context, and the attribute silently hides the argument from stack traces and debug_backtrace().

Marking a parameter as sensitive is a per-case security decision, not a bulk rename. Add the attribute manually where it belongs.

The intended change:

 class SomeClass
 {
-    public function run(string $password)
+    public function run(#[\SensitiveParameter] string $password)
     {
     }
 }

...but the same config also hits places where it only hurts:

 class PasswordPolicy
 {
-    public function describe(string $password): string
+    public function describe(#[\SensitiveParameter] string $password): string
     {
         // $password here is a policy name, not a secret,
         // and is now hidden from every stack trace
     }
 }

The rule now implements DeprecatedInterface and throws in refactor(), same as the other deprecated rules. Tests and fixtures are removed; the rule was not part of any set.

@TomasVotruba
TomasVotruba enabled auto-merge (squash) August 10, 2026 17:28
@TomasVotruba
TomasVotruba merged commit 1332071 into main Aug 10, 2026
54 checks passed
@TomasVotruba
TomasVotruba deleted the deprecate-sensitive-parameter-attribute-rector branch August 10, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant