← Back to Pull requests

Drop virtual buffer attributes with invalid XML names #20629

Closed
unknown closed this pull request without merging on Sep 14, 2026 06:21 UTC
View on GitHub
unknown unknown commented on Aug 07, 2026 09:51 UTC
Author

Link to issue number:

Fixes #7173

Summary of the issue:

Malformed markup can make a browser expose accessibility attribute names that are not valid XML names. For example, <section aria-label"almenük"> (note the missing =) yields an IA2 attribute name containing quote characters. NVDA stores virtual buffer fields as XML markup, so emitting such a name makes expat reject the buffer content: NVDA plays an error sound and cannot read the affected range in browse mode.

Minimal test case (from @jcsteh), pasted into the Firefox address bar:

data:text/html,<section aria-label"almen%C3%BCk" role="region">test

Description of user facing changes:

Browse mode now reads pages containing this kind of malformed markup normally; the broken attribute is ignored.

Description of developer facing changes:

VBufStorage_fieldNode_t::addAttribute now rejects attributes whose names are not valid XML names, returning false. This applies to all virtual buffer backends.

Description of development approach:

Validation happens once, in addAttribute, the attribute map's single insertion point, so the buffer only ever holds names that are valid in the XML it serializes to. isValidXMLAttribName in nvdaHelper/common/xml.h accepts a conservative ASCII subset of XML names: the expat build Python ships enforces the stricter XML 1.0 fourth edition name rules, and every attribute name NVDA's Python code consumes is ASCII, so anything outside that subset can only be junk from broken markup. Because only valid names can reach the map, generateAttributesForMarkupOpeningTag now writes stored names directly and sanitizeXMLAttribName is deleted.

Dropping the attribute extends the tradeoff made in #6249, which rewrote spaces in names to underscores: a readable buffer is worth more than preserving an attribute nobody can parse. The practical difference is that a name with invalid characters, such as a localised action name containing spaces, is now absent from the buffer instead of exposed under a mangled name. The well-known ASCII names NVDA itself consumes are unaffected.

An existing XML library was considered and rejected; see the review discussion below for the survey.

Testing strategy:

  • GitHub Actions for the head commit: build, lint, type checks, unit tests, and all but two system test jobs pass.

  • The two red jobs (chrome_misc_aria on windows-2025-vs2026, l10n on windows-2022) each pass on the other OS in the same run, and master is currently red on two different system test suites, so both look like known runner flakiness rather than this change.

  • Manual: loaded the Firefox test case above; browse mode reads "test" with no error sound.
  • Known issues with pull request:

    None in the changed code. Two required system test jobs are red; see testing strategy.

    Code Review Checklist:

  • Documentation:

  • - Change log entry
    - User Documentation
    - Developer / Technical Documentation
    - Context sensitive help for GUI changes
  • Testing:

  • - Unit tests
    - System (end to end) tests
    - Manual testing
  • UX of all users considered:

  • - Speech
    - Braille
    - Low Vision
    - Different web browsers
    - Localization in other languages / culture than English
  • API is compatible with existing add-ons.

  • Security precautions taken.
  • Notes on the checklist: a change log entry is included; no user or developer documentation or GUI help changes are needed. There is no unit test harness for the vbufBase C++ code; the change is a simple rejection at the buffer's insertion point, covered by the manual test case. Add-on facing behaviour changes only for attribute names that were never valid XML: they are now dropped instead of exposed under a sanitized name.

    Diff: 470 lines (+352 / -118) across 5 files Reviewer: jcsteh Review duration: 54510m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 470 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.368
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #20629"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.7% (MEDIUM) · Higher = larger blast radius
    45.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18% · Safe to merge
    18%
    Repository