Clone references before escaping?
还没有人认领这个 Issue。
评估
调研方向
从 issue 中描述的 _encode 入口点开始,跟踪它如何递归处理模板参数和引用。验证涉及 Dancer::Template::Abstract 的示例,并确认转义不再修改原始设置或 $foo 引用;如果存在相关的现有测试,请添加或运行它们。
由索引模型根据 Issue 内容生成。
描述
As originally discovered in http://www.backup-manager.org/pipermail/dancer-users/2012-April/002424.html :
When automatic_escaping is enabled, we recursively encode HTML entities in template params, following references.
Since the app's settings are automatically passed to the template by Dancer::Template::Abstract, stored as a reference to the real settings hashref, we can inadvertently go HTML-encoding stuff in the app's actual settings.
A partial fix is for Dancer to clone the settings rather than storing an actual reference, but of course that still means the problem can occur in other cases.
For example:
get '/' => sub {
my $foo = { foo => '<Foo>' };
my $html = template 'bar', { foo => $foo };
# $foo->{foo} has been changed to <Foo>
};
Probably a safer fix is for _encode to automatically clone any reference it's about to change before making changes. This would need some refactoring in _encode to assume that it's starting with a hashref (which it will be) and to pass on both the key and the value each time, rather than simply passing the reference to the value when recursing.
- 主要语言
- Perl
- 星标
- 4
- 派生
- 3
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
observablt-ci
难度 2/5 1-3 小时 新手友好度 86/100
elastic/golang-crossbuild#840 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
LMS-Community/slimserver#1701 · 6 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
RotherOSS/otobo#6286 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
-
fix(api): API v3 Product Read ignores request language (lc) for sample products and image URLs可能已有人在做 @muntasir-396 于 3 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
openfoodfacts/openfoodfacts-server#15042 · 1 条评论 ·
维护者通常 1 天内回复