Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

  • Investigate lint error on CI
  • Add missing assert import to test file
  • Verify import ordering follows Biome configuration
Original prompt

This section details on the original issue you should resolve

<issue_title>Restore commonly-used semantic HTML tags lost in v7.0.10 refactoring</issue_title>
<issue_description>Environment

Host

item version
OS Docker image
GROWI 7.4.2
node.js 20.19.6
npm 10.8.2
Using Docker yes
Using growi-docker-compose yes

(Accessing https://{GROWI_HOST}/admin helps you to fill in above versions)

Client

item version
OS Windows 11
browser Edge 143.0.3650.139

Description

Several commonly-used semantic HTML tags that were available in v6.3.5 are missing from the recommended XSS whitelist in v7.0.10+. This affects users who rely on the "Recommended Settings" option in the Markdown Settings.

How to reproduce (再現手順)

  1. Go to Admin > Markdown Settings > XSS Settings
  2. Select "Recommended Settings" (おすすめ設定)
  3. Create a page with the following HTML tags:
    <mark>highlighted text</mark>
    <small>small text</small>
    <abbr title="HyperText Markup Language">HTML</abbr>
    <cite>Citation example</cite>
    <figure>
      <img src="example.png" alt="Example">
      <figcaption>Figure caption</figcaption>
    </figure>
    <table>
      <caption>Table caption</caption>
      <tr><td>Data</td></tr>
    </table>
    <time datetime="2024-01-01">January 1, 2024</time>
  4. Preview or save the page

What happens (症状)

  • The above tags are not rendered with proper styling
  • They are replaced with <p> tags or stripped out
  • Users cannot use these standard HTML elements even though they were available in v6.3.5

What is the expected result (期待される動作)

These tags should be included in the recommended whitelist because:

  • They are standard HTML5 semantic elements
  • They have no security risks (no script execution capabilities)
  • They were available in v6.3.5 and users expect them to work
  • They are commonly used in wiki/documentation platforms

Missing tags comparison

Tags lost in v7.0.10+

The following tags were available in v6.3.5 but are missing in v7.4.2:

Tag Purpose Common Use Case
<mark> Text highlighting Highlighting important text, search results
<small> Small text Fine print, disclaimers, side comments
<abbr> Abbreviation Marking abbreviations with tooltips
<cite> Citation Referencing sources
<figure> Figure container Wrapping images with captions
<figcaption> Figure caption Adding captions to figures
<caption> Table caption Adding captions to tables
<time> Date/time Semantic datetime markup
<dfn> Definition Defining terms
<bdo> Bi-directional override Text direction override
<wbr> Word break opportunity Suggesting line break positions

Root cause

In commit 643e2f17b3 (2024-06-10), the whitelist was refactored from a custom tag list to using hast-util-sanitize's defaultSchema.tagNames.

Before (v6.3.5):

// apps/app/src/services/xss/recommended-whitelist.js
const tags = [
  '-', 'a', 'abbr', 'b', /* ... */, 'mark', /* ... */, 'small', /* ... */
];

After (v7.0.10+):

// apps/app/src/services/renderer/recommended-whitelist.ts
export const tagNames: Array<string> = [
  ...defaultSchema.tagNames ?? [],  // Uses hast-util-sanitize defaults
  '-', 'bdi', 'button', 'col', /* ... */
];

The hast-util-sanitize library's default schema is intentionally minimal and doesn't include many semantic HTML tags - not because they're dangerous, but by design philosophy.

Proposed solution

Add the following commonly-used, safe semantic tags back to the custom tag list in apps/app/src/services/renderer/recommended-whitelist.ts:

export const tagNames: Array<string> = [
  ...defaultSchema.tagNames ?? [],
  '-',
  'abbr',      // abbreviation with tooltip
  'bdi',
  'button',
  'caption',   // table caption
  'cite',      // citation
  'col',
  'colgroup',
  'data',
  'figure',    // figure container
  'figcaption', // figure caption
  'iframe',
  'mark',      // text highlighting
  'rb',
  'small',     // small text
  'time',      // datetime
  'u',
  'video',
];

Tags NOT restored:

  • <dfn>, <bdo>, <wbr> - Less commonly used, can be added later if requested

I'd be happy to submit a PR if this approach is acceptable.</issue_description>

<agent_instructions>## Additional improvements to the proposed solution:

  1. Include all GitHub-allowed tags: Add dfn, bdo, and wbr (these are also...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Add 11 semantic HTML tags: abbr, bdo, caption, cite, dfn, figure, figcaption, mark, small, time, wbr
- Add attribute restrictions for new tags (abbr: title, bdo: dir, dfn: title, time: datetime)
- Add comprehensive tests for all new tags and their attributes
- Sort tags alphabetically for better maintainability

Co-authored-by: yuki-takei <[email protected]>
Copilot AI changed the title [WIP] Restore commonly-used semantic HTML tags in settings Restore semantic HTML tags lost in v7.0.10 refactoring Jan 13, 2026
Copilot AI requested a review from yuki-takei January 13, 2026 05:58
@yuki-takei yuki-takei changed the title Restore semantic HTML tags lost in v7.0.10 refactoring imprv: Restore semantic HTML tags lost in v7.0.10 refactoring Jan 13, 2026
@yuki-takei
Copy link
Contributor

@copilot fix lint error on CI

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot fix lint error on CI

Fixed in ce4c9b6. Added the missing assert import that was incorrectly removed during the refactoring.

@yuki-takei yuki-takei marked this pull request as ready for review January 13, 2026 07:27
@mergify mergify bot added the queued label Jan 13, 2026
mergify bot added a commit that referenced this pull request Jan 13, 2026
@mergify
Copy link
Contributor

mergify bot commented Jan 13, 2026

Merge Queue Status

✅ The pull request has been merged at 487c52d

This pull request spent 12 minutes 10 seconds in the queue, including 11 minutes 59 seconds running CI.
The checks were run on draft #10711.

Required conditions to merge
  • -check-failure ~= ci-app-
  • -check-failure ~= ci-slackbot-
  • -check-failure ~= test-prod-node20 /
  • check-success = test-prod-node20 / build-prod
  • check-success ~= ci-app-launch-dev
  • check-success ~= ci-app-lint
  • check-success ~= ci-app-test
  • check-success ~= test-prod-node20 / launch-prod
  • check-success ~= test-prod-node20 / run-playwright

@mergify mergify bot merged commit 44e221b into master Jan 13, 2026
28 checks passed
@mergify mergify bot deleted the copilot/restore-semantic-html-tags branch January 13, 2026 07:47
@mergify mergify bot removed the queued label Jan 13, 2026
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.

Restore commonly-used semantic HTML tags lost in v7.0.10 refactoring

2 participants