Skip to content

fix(metadata): match restricted words using word boundaries - #4530

Open
DYNOSuprovo wants to merge 2 commits into
expo:mainfrom
DYNOSuprovo:fix/restricted-words-regex-boundary
Open

DYNOSuprovo wants to merge 2 commits into
expo:mainfrom
DYNOSuprovo:fix/restricted-words-regex-boundary

Conversation

@DYNOSuprovo

Copy link
Copy Markdown

Why

Fixes #4501

When running eas metadata:push, infoRestrictedWords flagged any word that had "beta" as a substring (such as Danish "Betal" / "betaling", Dutch "betalen", German "Alphabet", English "diabetes", etc.) because it used sanitized.includes(word). In non-interactive CI environments, this prevented publishing legitimate non-English and English metadata to Apple.

How

Updated infoRestrictedWords to compile restricted words into case-insensitive regular expressions with word boundaries (\b${word}\b). This ensures standalone references to restricted terms like "beta", "(beta)", "App Beta", or "v1.0-beta" are flagged according to Apple guidelines, while words merely containing the substring (e.g. "Betal", "Alphabet", "diabetes") are permitted.

Test Plan

  • Added unit tests in packages/eas-cli/src/metadata/apple/rules/__tests__/infoRestrictedWords.test.ts covering:
    • Empty or missing apple.info returns null.
    • Allowed metadata without restricted words passes validation.
    • Words containing "beta" as substring (e.g. "Betal", "betalen", "Alphabet", "Diabetes") are not flagged.
    • Restricted word "beta" in title, subtitle, description, and keywords is correctly flagged with severity 1.
    • Case-insensitive ("BETA") and punctuation-delimited ("(beta)", "v2.0-beta") instances are correctly flagged.
  • Ran tests with Jest:
    yarn --cwd packages/eas-cli test src/metadata/apple/rules
    Output:
    PASS src/metadata/apple/rules/__tests__/infoRestrictedWords.test.ts
      infoRestrictedWords
        √ returns null when apple.info is missing or empty (5 ms)
        √ allows text without restricted words (2 ms)
        √ does not flag words that contain "beta" as a substring (e.g. Danish "Betal", "Alphabet")
        √ flags restricted word "beta" in title, subtitle, description, and keywords (4 ms)
        √ flags case-insensitive and punctuation-delimited instances of "beta" (1 ms)
    
    Test Suites: 1 passed, 1 total
    Tests:       5 passed, 5 total
    

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown

Subscribed to pull request

File Patterns Mentions
packages/eas-cli/** @douglowder
packages/eas-cli/src/metadata/** @byCedric

Generated by CodeMention

Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead.

@douglowder

Copy link
Copy Markdown
Contributor

eas-cli now uses changesets for changelogs (#4580). The required "Check for a changeset" check fails on PRs that edit CHANGELOG.md.

To update this PR:

  1. Revert the changes to CHANGELOG.md.
  2. Run yarn changeset, select the changed packages and the bump type, and write the summary.
  3. Commit the new file in .changeset/.

The release adds the PR link and the author to the entry. If this PR needs no changelog entry, revert the CHANGELOG.md changes and add the "no changelog" label.

@DYNOSuprovo

Copy link
Copy Markdown
Author

@douglowder Thank you for the guidance! I have synchronized the branch with \upstream/main, reverted the direct modifications to \CHANGELOG.md, and added a patch changeset for \eas-cli\ under .changeset/restricted-words-word-boundaries.md. All set for CI checks and review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

metadata:push: apple.info.restrictedWords flags "beta" inside other words (e.g. Danish "Betal")

2 participants