Scenario objective previews can split supplementary Unicode during truncation

未关闭 适合新手
#3,870 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@Aadithya-kl 已经在做这个了。

开始于 2026年11月3日。

  • #3890 来自 @Aadithya-kl —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
frontend

调研方向

从 objectivePreview 辅助函数开始,它按 UTF-16 代码单元进行截断。先查看那里的截断位置,然后在指定的版本上运行聚焦测试 attackAttemptFormatting,观察索引 94 处孤立的高位代理项。完成的标准是:预览永远不会以未配对的代理项结尾,94 个 a 的用例显示省略号,且完整 emoji 的对照用例仍然通过。

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

描述

Bug: triage help wanted
Describe the bug

objectivePreview truncates JavaScript strings by UTF-16 code unit. If the boundary falls between the two code units of a supplementary Unicode character, the preview contains an unpaired surrogate. The scenario run table renders the corrupted preview. This is presentation-only; the test does not show that stored objectives are changed.

Steps/Code to Reproduce
const objective = `${'a'.repeat(94)}😀 trailing text`
const preview = objectivePreview(objective, 'seed-boundary')

Run the focused attackAttemptFormatting test at revision 01ce6ca66a315770b36c7dca1f320668c0d92d7c.

Expected Results

Truncate without splitting a Unicode scalar, for example 94 a characters followed by an ellipsis. No lone surrogate should appear in the preview.

Actual Results

The helper returns a string whose code unit at index 94 is 0xD83D, an unmatched high surrogate. JSON serialization shows \ud83d…; Jest renders it as �. A complete-emoji boundary control passes.

Screenshots

N/A. The exact returned string and code unit are asserted in the focused test.

Versions

Linux; Node 26.12.1; npm 11.20.0; Jest 30.5.2; frontend at revision 01ce6ca66a315770b36c7dca1f320668c0d92d7c. Pure TypeScript Jest run; no browser or backend.

主要语言
Python
星标
4.7k
派生
1k
平均合并
2 天 3 小时
30 天内合并 PR
450

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

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

从这里开始

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

microsoft/PyRIT 的其他 Issue

查看 microsoft/PyRIT 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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