Skip to content

Make the browser i18n runtime look up profile names and message ids as own keys #701

Closed

Description

@JuroOravec

The problem

The browser i18n runtime looks up format profiles and message ids by plain object index on objects made by JSON.parse:

  • profile() in packages/js/citry-client/src/citry-i18n-runtime.ts:448-452: category?.[name]
  • the Fluent NUMBER profile check, citry-i18n-runtime.ts:894
  • message lookups, citry-i18n-runtime.ts:990 and packages/js/citry-client/src/citry-i18n-core.ts:224

So a profile name __proto__ finds Object.prototype instead of failing: format.number(1, {format: "__proto__"}) formats with default options, while docs_site/content/i18n/formatting.md says an unknown profile name raises. A message id __proto__ or constructor fails with I18N_ARTIFACT_INVALID instead of I18N_MESSAGE_MISSING.

The effect is wrong output or a wrong error code; no markup or code is involved. Locale names and State names already use Maps or null-prototype objects with own-key checks.

Fix

Look these names up with an own-property check (Object.hasOwn), or copy the tables into Maps, so a name reaches only its own entry (CLAUDE.md Mechanism 7).

Found while writing the trust-boundary design doc for #603.

🤖 Generated with Claude Code

Activity

  1. changed the title [-]Look up i18n format profiles and message ids by own key in the browser[/-] [+]Make the browser i18n runtime look up profile names and message ids as own keys[/+] on Nov 15, 2026
  2. added
    next-sprint
    on Nov 15, 2026
  3. added this to the 1.1.0 milestone on Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-sprint

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions