Skip to content

fix: escape labels during JSON import and render tag dropdown as text - #9504

Merged
Alkarex merged 1 commit into
FreshRSS:edgefrom
Pythame:fix/json-import-label-html-injection
Oct 25, 2026
Merged

Alkarex merged 1 commit into
FreshRSS:edgefrom
Pythame:fix/json-import-label-html-injection

Conversation

@Pythame

@Pythame Pythame commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Changes proposed in this pull request:

  • Normalize label names parsed from Google Reader JSON categories during import, using the same escaping helper as the other imported string fields.
  • Decode stored label names before returning them to the dynamic tag dropdown.
  • Build dynamic tag dropdown entries with DOM text nodes instead of HTML string concatenation.

How to test the feature manually:

  1. Import a Google Reader JSON file containing labels with &, quotes, spaces and non-ASCII characters; verify the labels appear correctly in the tag dropdown and on the tag management page.
  2. Open an entry's tag dropdown and verify existing labels are checked, adding/removing labels still works, the order is unchanged, and the datalist suggestions are populated.
  3. Export the labels and re-import the same JSON; verify newly imported labels reuse existing encoded tags and do not create duplicates.

Compatibility note:

This change applies to new JSON imports and the dynamic tag dropdown. It does not migrate _tag.name rows created by older imports. On an installation with such rows, re-importing the same visible label can create a second tag because the existing stored name and the newly escaped name do not match (for example, R&D vs R&D). This is a pre-existing data compatibility issue that this change also touches; no migration is included in this PR.

@Pythame
Pythame force-pushed the fix/json-import-label-html-injection branch from 4da46dd to ef9905c Compare October 25, 2026 03:11
@Alkarex Alkarex added this to the 1.31.0 milestone Oct 25, 2026
@Alkarex
Alkarex merged commit bc962e9 into FreshRSS:edge Oct 25, 2026
4 checks passed
@Alkarex

Alkarex commented Oct 25, 2026

Copy link
Copy Markdown
Member

Thanks!
Please add a line for you in https://github.com/FreshRSS/FreshRSS/blob/edge/CREDITS.md

@Inverle Inverle added the javascript Pull requests that update Javascript code label Oct 25, 2026
Alkarex pushed a commit that referenced this pull request Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update Javascript code Security 🛡️

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants