Repository navigation
Moved settings limit dialogs to Shade - #29562
Conversation
no ref The settings app can now own its upgrade prompts without retaining a dependency on the legacy design-system modal implementation.
WalkthroughLimitModal exports were removed from the design-system barrel and consumers now import the component locally from admin-x-settings. LimitModal was refactored to render through ConfirmationModalContent, which gained an optional configurable test ID. The LimitModal Storybook story was removed, and a unit test was added covering prompt HTML, upgrade interaction, modal presence, and cleanup. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run @tryghost/admin:test:acceptance |
✅ Succeeded | 6m 7s | View ↗ |
nx run-many -t test:unit -p @tryghost/admin-x-d... |
✅ Succeeded | 2m 26s | View ↗ |
nx run ghost-monorepo:lint:boundaries |
✅ Succeeded | 22s | View ↗ |
nx run-many -t lint -p @tryghost/admin-x-design... |
✅ Succeeded | 1m 13s | View ↗ |
nx run @tryghost/admin:build |
✅ Succeeded | 17s | View ↗ |
nx run-many --target=build --projects=tag:publi... |
✅ Succeeded | 1s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-23 18:28:36 UTC
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@apps/admin-x-settings/src/components/limit-modal.tsx`:
- Around line 23-35: Update the promptContent handling in the limit modal to
sanitize string prompts containing HTML with an explicit safe allowlist before
passing them to dangerouslySetInnerHTML. Keep non-HTML strings and existing
React-node prompts on the normal rendering path, and ensure the sanitized
value—not the raw prompt—is injected.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b849da49-1abe-4771-b544-27bdd09517a8
📒 Files selected for processing (15)
apps/admin-x-design-system/src/global/modal/limit-modal.stories.tsxapps/admin-x-design-system/src/index.tsapps/admin-x-settings/src/components/confirmation-modal.tsxapps/admin-x-settings/src/components/limit-modal.tsxapps/admin-x-settings/src/components/settings/advanced/integrations/add-integration-modal.tsxapps/admin-x-settings/src/components/settings/email/newsletters/add-newsletter-modal.tsxapps/admin-x-settings/src/components/settings/email/newsletters/newsletter-detail-modal.tsxapps/admin-x-settings/src/components/settings/general/user-detail-modal.tsxapps/admin-x-settings/src/components/settings/membership/stripe/stripe-connect-modal.tsxapps/admin-x-settings/src/components/settings/membership/tiers.tsxapps/admin-x-settings/src/components/settings/site/change-theme.tsxapps/admin-x-settings/src/components/settings/site/design-and-theme-modal.tsxapps/admin-x-settings/src/components/settings/site/theme-modal.tsxapps/admin-x-settings/src/components/settings/site/theme/advanced-theme-settings.tsxapps/admin-x-settings/test/unit/components/limit-modal.test.tsx
💤 Files with no reviewable changes (2)
- apps/admin-x-design-system/src/index.ts
- apps/admin-x-design-system/src/global/modal/limit-modal.stories.tsx
| const promptContent = typeof prompt === 'string' && prompt.includes('<') ? ( | ||
| <div dangerouslySetInnerHTML={{__html: prompt}} /> | ||
| ) : prompt; | ||
|
|
||
| return ( | ||
| <Modal | ||
| backDropClick={false} | ||
| <ConfirmationModalContent | ||
| formSheet={formSheet} | ||
| okLabel={okLabel} | ||
| okVariant='default' | ||
| prompt={<div className='w-full'>{promptContent}</div>} | ||
| testId='limit-modal' | ||
| title={title} | ||
| width={540} | ||
| onOk={onOk} | ||
| > | ||
| <div className='py-4 leading-9 text-pretty'> | ||
| {typeof prompt === 'string' && prompt.includes('<') ? ( | ||
| <div dangerouslySetInnerHTML={{__html: prompt}} /> | ||
| ) : ( | ||
| prompt | ||
| )} | ||
| </div> | ||
| </Modal> | ||
| /> |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Sanitize the HTML prompt before injecting it.
HostLimitError.message is passed into this component by callers, and any untrusted markup is sent directly to dangerouslySetInnerHTML, bypassing React escaping. Sanitize with an allowlist at this boundary, or only render trusted React nodes.
Static analysis identifies this raw HTML injection sink.
🧰 Tools
🪛 ast-grep (0.44.1)
[warning] 23-23: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation
(react-unsafe-html-injection)
🤖 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 `@apps/admin-x-settings/src/components/limit-modal.tsx` around lines 23 - 35,
Update the promptContent handling in the limit modal to sanitize string prompts
containing HTML with an explicit safe allowlist before passing them to
dangerouslySetInnerHTML. Keep non-HTML strings and existing React-node prompts
on the normal rendering path, and ensure the sanitized value—not the raw
prompt—is injected.
Source: Linters/SAST tools
E2E Tests FailedTo view the Playwright test report locally, run: REPORT_DIR=$(mktemp -d) && gh run download 30033282027 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR" |

What changed
Why
Limit prompts were one of the remaining Settings dependencies on the legacy admin-x-design-system modal layer. Keeping the wrapper local lets Settings preserve its host-limit behavior while using the Shade modal foundation.
Validation
pnpm --dir apps/admin-x-settings lintpnpm --dir apps/admin-x-design-system lintpnpm --dir apps/admin-x-settings test— 24 files / 217 testsapps/adminbuild