Skip to content

[Audit][Medium] InputBinding.eql() treats .key and .key_alt as equivalent, breaking distinct binding behavior #729

@MichaelFisher1997

Description

@MichaelFisher1997

🔍 Module Scanned

(automated audit scan)

📝 Summary

The function considers and variants with the same underlying key as equivalent, even though they represent distinct bindings. This causes the input mapper to treat primary and alternate bindings incorrectly when using with the alternate key variant.

📍 Location

  • File:
  • Function/Scope:

🔴 Severity: Medium

  • Critical: Crashes, data corruption, security vulnerabilities, GPU device loss
  • High: Memory leaks, race conditions, incorrect rendering, broken features
  • Medium: Performance degradation, missing error handling, suboptimal patterns
  • Low: Code style, dead code, minor improvements

💥 Impact

When a user binds an action to (or the system uses internally), will incorrectly return when compared against . This means the input mapper's , , and methods compare bindings using with and treat them as the same physical key. This breaks the expected behavior when users want distinct bindings for primary vs alternate inputs—the alternate binding () would incorrectly respond to the primary binding () query.

🔎 Evidence

The same pattern exists in :

The union explicitly defines and as separate variants for a reason—users should be able to bind an action to both W (primary) and Up Arrow (alternate). But deflates this distinction.

🛠️ Proposed Fix

  1. Fix to distinguish from : The function should return only when both and use the same variant with the same key value:

  2. Add tests for that verify does NOT equal :

  3. Consider whether should be queried separately in //. If so, the vtable lookup could map to and to (which currently does not exist—would need to add to ). This is a larger change; the minimal fix is correcting .

✅ Acceptance Criteria

  • returns when comparing against
  • New unit tests verify and are treated as distinct
  • No regression in existing tests

📚 References

Metadata

Metadata

Assignees

No one assigned

    Labels

    automated-auditIssues found by automated opencode audit scansbugSomething isn't workingenhancementNew feature or requesthotfixquestionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions