Skip to content

fix: user-setting modal fixes and DOMPurify cleanup - #16449

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/bug-0629
Jun 29, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
dcc123456:fix/bug-0629

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

fix: user-setting modal fixes and DOMPurify cleanup

  • HighlightMarkdown: drop post-process DOMPurify pass (ineffective after preprocessLaTeX; Coderabbit CRITICAL
    #3486038798)
  • SettingTeam: add invite-only-registered-users hint to add-user modal
  • SettingModel: reset provider loading state when add-provider modal closes
  • MCP edit dialog: set maskClosable=false to prevent accidental dismissal
  • Form: switch FormDescription color from text-muted-foreground to text-text-disabled

  - HighlightMarkdown: drop post-process DOMPurify pass (ineffective after preprocessLaTeX; Coderabbit CRITICAL
  #3486038798)
  - SettingTeam: add invite-only-registered-users hint to add-user modal
  - SettingModel: reset provider loading state when add-provider modal closes
  - MCP edit dialog: set maskClosable=false to prevent accidental dismissal
  - Form: switch FormDescription color from text-muted-foreground to text-text-disabled
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jun 29, 2026
@dcc123456
dcc123456 requested a review from wangq8 June 29, 2026 07:49
@coderabbitai

coderabbitai Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Several small fixes across the web UI: DOMPurify sanitization removed from HighLightMarkdown, an inviteTip translation added to the add-user modal email field, FormDescription color token updated, MCP dialog triple-negation and mask-close fixed, and providerLoading reset added when ProviderModal closes.

Changes

User Settings UI Fixes

Layer / File(s) Summary
Remove DOMPurify sanitization
web/src/components/highlight-markdown/index.tsx
Markdown now renders the unsanitized processed string directly; safeChildren/DOMPurify call removed.
Invite tip i18n and add-user modal helper text
web/src/locales/en.ts, web/src/locales/zh.ts, web/src/pages/user-setting/setting-team/add-user-modal.tsx
New inviteTip key added in English and Chinese locales; FormDescription renders that tip beneath the email input in the add-user modal.
FormDescription color token
web/src/components/ui/form.tsx
FormDescription className updated from text-muted-foreground to text-text-disabled.
MCP dialog fixes
web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx
Corrects !!!tools?.length to !tools?.length for the save button disabled state; adds maskClosable={false} to the modal.
Reset providerLoading on modal close
web/src/pages/user-setting/setting-model/index.tsx
Adds useEffect to reset providerLoading to false when providerVisible becomes false; adjusts ProviderModal and BedrockModal prop wiring in JSX.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • cike8899

Poem

🐇 A bunny hopped through settings today,
Fixed a triple-bang that went astray,
Added a tip for invited friends,
Reset the loading before it ends,
No mask-click closes — the modal stays put!
Small fixes sprinkled from ear to foot. 🌸

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main changes: modal fixes and DOMPurify cleanup.
Description check ✅ Passed The description matches the required Summary template and clearly lists the key changes and context.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dcc123456
dcc123456 marked this pull request as draft June 29, 2026 07:51
@dcc123456
dcc123456 marked this pull request as ready for review June 29, 2026 07:51
@dcc123456
dcc123456 marked this pull request as draft June 29, 2026 07:52
@dcc123456
dcc123456 marked this pull request as ready for review June 29, 2026 07:52

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
web/src/components/highlight-markdown/index.tsx (1)

32-32: 🔒 Security & Privacy | 🔴 Critical | ⚡ Quick win

Restore sanitization after preprocessLaTeX before rendering raw HTML.
preprocessLaTeX() can turn entity-encoded payloads back into real tags, and rehypeRaw will parse them at render time. The current path passes processed straight into Markdown, so <script>/onerror content can reach the DOM; the tests here already expect that to be stripped.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/components/highlight-markdown/index.tsx` at line 32, The highlighted
markdown flow currently preprocesses input with preprocessLaTeX and then sends
processed directly into Markdown, which can reintroduce real HTML tags before
rehypeRaw renders them. Update the HighlightMarkdown component to sanitize the
processed content again before rendering, using the existing sanitization path
or equivalent safe filtering, so any script tags or event-handler attributes
introduced by preprocessLaTeX are stripped before Markdown receives the string.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/components/ui/form.tsx`:
- Line 152: The requested change should not be made inside FormDescription in
src/components/ui/form.tsx because that directory is restricted. Move the
styling adjustment into a new wrapper/adapter component outside
src/components/ui/ and have it compose the existing FormDescription from the ui
module. Use a clear symbol name like FormDescriptionWrapper (or similar) in a
feature/shared components folder so callers can import the wrapper without
altering the base ui component.

---

Outside diff comments:
In `@web/src/components/highlight-markdown/index.tsx`:
- Line 32: The highlighted markdown flow currently preprocesses input with
preprocessLaTeX and then sends processed directly into Markdown, which can
reintroduce real HTML tags before rehypeRaw renders them. Update the
HighlightMarkdown component to sanitize the processed content again before
rendering, using the existing sanitization path or equivalent safe filtering, so
any script tags or event-handler attributes introduced by preprocessLaTeX are
stripped before Markdown receives the string.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eaec4d42-61e5-47bc-abc0-16d3d7e32b67

📥 Commits

Reviewing files that changed from the base of the PR and between 9b726a5 and f4530de.

📒 Files selected for processing (7)
  • web/src/components/highlight-markdown/index.tsx
  • web/src/components/ui/form.tsx
  • web/src/locales/en.ts
  • web/src/locales/zh.ts
  • web/src/pages/user-setting/mcp/edit-mcp-dialog.tsx
  • web/src/pages/user-setting/setting-model/index.tsx
  • web/src/pages/user-setting/setting-team/add-user-modal.tsx

Comment thread web/src/components/ui/form.tsx Resolved
@wangq8
wangq8 merged commit ca17808 into infiniflow:main Jun 29, 2026
15 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants