Skip to content

usage-bar: in operator matches Object.prototype inherited properties #98466

Description

@zhangLei99586

Summary

The usage bar translator in src/auto-reply/usage-bar/translator.ts uses key in table for alias vocabulary lookup (line 133) and segment case table lookup (line 203). The in operator traverses the prototype chain, so keys like toString, valueOf, constructor incorrectly match Object.prototype properties instead of falling through to the intended fallback/default behavior.

Reproduction

When a usage template has an alias table or map case table, and the lookup key is "toString" or "constructor", in returns true even when those are not own properties.

Expected

Use Object.hasOwn(table, key) (ES2022) to check only own properties.

Scope

src/auto-reply/usage-bar/translator.ts:133,203 — 1 file, 2 lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions