Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

pathFor: adoptPage trusts a mutable page global and a NUL/replacement-char id can escape-collide

未关闭
#220 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
playwright, typescript

调研方向

Start by locating adoptPage and the path helper, then inspect the duplicate-id fix in #182 and #215. Check how the helper is chosen and how escaped id selectors are validated, including invalid-selector handling. Done means page-defined globals cannot collapse paths and distinct elements with NUL or U+FFFD ids do not share a path; verify with focused tests for both cases.

由索引模型根据 Issue 内容生成。

描述

area: engine bug security

Follow-up to #182 / #215.

What is wrong

Two residual identity-collision paths remain after the duplicate-id fix:

  1. adoptPage installs the path helper only if window.__usablPathFor is not already a function. A page that already navigated can define its own window.__usablPathFor = () => '#dup', and adoptPage preserves it, so every element collapses to one identity.
  2. The uniqueness guard checks that the escaped id selector matches exactly one element, not that the match is the element in hand. A NUL id and a literal U+FFFD id both escape to the same selector, so two distinct elements can still collide.

Why it matters

Both reintroduce the set-difference false green the id-collision work closed, for a page that is hostile or has unusual ids.

Fix

Do not trust a mutable page global: evaluate a private path function per query, or install an immutable binding. Before using an id selector, require exactly one match AND matches[0] === element, with invalid-selector handling.

主要语言
TypeScript
星标
0
派生
0
平均合并
2 小时 48 分钟
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

usabl-dev/usabl 的其他 Issue

查看 usabl-dev/usabl 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。