Preview checker: entity names like `&constructor;` decode to function source

Ouverte
#356 2 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@amitsinha-cell y travaille déjà.

Depuis le 31/10/2026.

Évaluation

Cette issue n'a pas encore été évaluée.

Description

bug

decodeEntities() in src/lib/meta-fetcher.ts looks names up with NAMED_ENTITIES[body], and NAMED_ENTITIES is a plain object, so names that exist on Object.prototype are found too. A page whose title has one of them shows function source in the preview checker:

parseMetaTags('<title>a &constructor; b</title>', 'https://example.com').title
// "a function Object() { [native code] } b"

&toString;, &hasOwnProperty; and &valueOf; do the same. Browsers leave an unknown name like &constructor; as it is.

What to do

  • Only decode names that are in NAMED_ENTITIES itself, for example with Object.hasOwn(NAMED_ENTITIES, body), or make it a null-prototype object or a Map.

Acceptance criteria

  • &constructor;, &toString;, &hasOwnProperty; and &valueOf; stay as they are, and every entity that decodes today still does
  • A test that fails on the current code
  • npm run check, npm run test and npm run build pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #NUM in the description.

Langage dominant
TypeScript
Étoiles
8
Forks
4
Merge moyen
8 h 47 min
PR mergées (30 j)
157

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de codercops/ogcops

Toutes les issues de codercops/ogcops

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.