#[\SensitiveParameter] values leak through joinpoint frames in stack traces
维护者通常 1 天内回复
已经有一个关联 PR 被合并了。
- #803 来自 @lisachenko —— 已合并
评估
调研方向
Start with the joinpoint __invoke() methods named in the issue: DynamicTraitAliasMethodInvocation, StaticTraitAliasMethodInvocation, ReflectionFunctionInvocation and ReflectionConstructorInvocation, plus the ClassFieldAccess read and write values. Reproduce the leaked frame with zend.exception_ignore_args=0 and check Throwable::getTrace(). The work is already claimed by open pull request #803, so coordinate there before starting.
由索引模型根据 Issue 内容生成。
描述
What happens
Proxies keep #[\SensitiveParameter], so the proxy frame and the original method frame are redacted correctly. The joinpoint frames between them, though, receive the arguments as a plain array, and Throwable::getTrace() exposes the secret there:
public function fail(string $user, #[\SensitiveParameter] string $password): never { throw new RuntimeException('boom'); }
#0 Demo\Auth->failOriginalAlias ["bob","SensitiveParameterValue"]
#1 ReflectionMethod->invokeArgs ["Demo\\Auth",["bob","s3cr3t"]] <- leaked
#2 Go\Aop\Framework\DynamicTraitAliasMethodInvocation->proceed []
#3 Demo\LogAspect->around [...]
#4 Go\Aop\Framework\AroundInterceptor->invoke [...]
#5 Go\Aop\Framework\DynamicTraitAliasMethodInvocation->proceed []
#6 Go\Aop\Framework\DynamicTraitAliasMethodInvocation->__invoke ["Demo\\Auth",["bob","s3cr3t"]] <- leaked
#7 Demo\Auth->fail ["bob","SensitiveParameterValue"]
(reproduced with zend.exception_ignore_args=0)
The string form of the trace prints Array, so the usual log line is safe. Error trackers that serialize getTrace() (Sentry and similar) capture the value. PHP 8.6 puts more weight on argument display (error_include_args and more #[\SensitiveParameter] markings in core). This leak exists on all supported versions.
Proposed fix
- Mark the
$arguments/$variadicArgumentsparameters of every joinpoint__invoke()with#[\SensitiveParameter]:DynamicTraitAliasMethodInvocation,StaticTraitAliasMethodInvocation,ReflectionFunctionInvocation,ReflectionConstructorInvocation, and theClassFieldAccessread/write values. The parameter values stay visible in the proxy frame, where#[\SensitiveParameter]is applied per parameter. There is no runtime cost on the hot path (check withcomposer test:performance). - The
ReflectionMethod::invokeArgs()frame (#1) can't carry the attribute because the method is internal. Fixing that frame means calling the original body through a closure whose parameter is marked, for example withClosure::call(). That's a separate trade-off: the class docblock explains whyinvokeArgs()was chosen (speed, by-reference arguments).
Part of #789.
- 主要语言
- PHP
- 星标
- 1.7k
- 派生
- 166
- 平均合并
- 1 天 1 小时
- 30 天内合并 PR
- 38
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
goaop/framework 的其他 Issue
-
Enhancement
难度 3/5 1-2 天 新手友好度 72/100
维护者通常 1 天内回复
-
cache:warmup:opcache runs out of memory with the default memory_limit (128M) on larger applications未关闭Bug
难度 4/5 3-5 天 新手友好度 55/100
维护者通常 1 天内回复
-
Bug To Be Discussed
难度 5/5 一周以上 新手友好度 28/100
维护者通常 1 天内回复
-
Bug
难度 4/5 1-2 天 新手友好度 56/100
维护者通常 1 天内回复
-
Bug
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
相似的 Issue
-
enhancement priority Sales
难度 2/5 1-3 小时 新手友好度 78/100
novalo-dev/Prestashop-MCP-Server#201 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
Include flows spanning the full report time window可能已有人在做 @somethingwithproof 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
Cacti/plugin_flowview#306 ·
维护者通常 1 天内回复
-
bug origin: upstream priority: low
难度 2/5 1-3 小时 新手友好度 78/100
mattytap/Mattytap-Sermons#105 ·
-
priority:low type:bug
难度 2/5 1-3 小时 新手友好度 82/100
crazy-goat/workerman-bundle#1189 ·
维护者通常 1 天内回复