Skip to content

fix(security): sanitize markdown links and enforce noopener noreferrer - #823

Open
d-oit wants to merge 1 commit into
mainfrom
fix/sanitize-markdown-links-10174256451346322883
Open

d-oit wants to merge 1 commit into
mainfrom
fix/sanitize-markdown-links-10174256451346322883

Conversation

@d-oit

@d-oit d-oit commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Sanitize URLs in Markdown link and image rendering in Chat View and Editor View using sanitizeUrl, filter dangerous protocols (javascript:, data:, protocol-relative //), and enforce target="_blank" rel="noopener noreferrer" on external links. Add unit tests in markdown-security.test.tsx.


PR created automatically by Jules for task 10174256451346322883 started by @d-oit


📝 Summary by GitNexus

Summary

This appears to be a security-focused React UI change spanning studio chat and editor views, with tests covering markdown security behavior. Its reach is transitive through related view code, while no individual changed file is flagged high risk.

🔴 CRITICAL blast radius. A security-focused frontend change in src/components/studio/views/editor-view.tsx and src/components/studio/views/chat-subcomponents.tsx reaches dependents across three graph hops.

The change is concentrated in the Studio and Views modules, particularly EditorView and mentionAwareUrlTransform in src/components/studio/views/editor-view.tsx, alongside MessageList and related chat-view interfaces in src/components/studio/views/chat-subcomponents.tsx. src/components/studio/views/editor-view.tsx is the hottest changed file, so review its markdown link handling and editor rendering path first.

Review the interaction between the editor and chat presentation code, then use src/components/studio/views/markdown-security.test.tsx to validate the expected markdown security coverage. The affected execution paths pass through the changed symbols, so changes to shared rendering or URL transformation behavior deserve particular attention.

Added by GitNexus for PR #823. Edit freely — this block is replaced on the next review, everything above it is left untouched.

@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
do-knowledge-studio Ready Ready Preview, v0 Sep 26, 2026 1:09am UTC

@github-actions

Copy link
Copy Markdown
Contributor

Blocked merge diagnosis — blocked
⏳ Check run(s) still in progress: ["Detect Changes","labeler","commitlint","Diagnose Blocked Merge State","Infrastructure as Code Security","Shell Script Security Analysis","Secret Detection","Trivy Filesystem Security Scan","Analyze (actions)","Analyze (javascript-typescript)"]

@github-actions github-actions Bot added config tests Related to automated/manual tests labels Sep 26, 2026
@nexuscheck

nexuscheck Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor
Akon Labs

GitNexus Review · PR #823

GitNexus reviewed 3 changed files.

🤖 Agent context — 19 symbols · 3 files

Summary

This appears to be a security-focused React UI change spanning studio chat and editor views, with tests covering markdown security behavior. Its reach is transitive through related view code, while no individual changed file is flagged high risk.

🔴 CRITICAL blast radius. A security-focused frontend change in src/components/studio/views/editor-view.tsx and src/components/studio/views/chat-subcomponents.tsx reaches dependents across three graph hops.

The change is concentrated in the Studio and Views modules, particularly EditorView and mentionAwareUrlTransform in src/components/studio/views/editor-view.tsx, alongside MessageList and related chat-view interfaces in src/components/studio/views/chat-subcomponents.tsx. src/components/studio/views/editor-view.tsx is the hottest changed file, so review its markdown link handling and editor rendering path first.

Review the interaction between the editor and chat presentation code, then use src/components/studio/views/markdown-security.test.tsx to validate the expected markdown security coverage. The affected execution paths pass through the changed symbols, so changes to shared rendering or URL transformation behavior deserve particular attention.

🔴 CRITICAL blast radius — this change reaches 6 downstream symbols across 2 modules; this lands on a critical surface, so review the dependents carefully before merging.

Blast Level Dependents Modules Files
🔴 CRITICAL 6 2 3

What changed

Symbol Changes (19)
Kind Symbol Location
Function MessageList src/components/studio/views/chat-subcomponents.tsx:213
Const SERIF_FONT_STYLE src/components/studio/views/editor-view.tsx:57
Function mentionAwareUrlTransform src/components/studio/views/editor-view.tsx:54
Function EditorView src/components/studio/views/editor-view.tsx:154
Interface InputBarProps src/components/studio/views/chat-subcomponents.tsx:320
Interface SuggestionsBarProps src/components/studio/views/chat-subcomponents.tsx:292
Interface MessageListProps src/components/studio/views/chat-subcomponents.tsx:204
Interface CitationDisclosureProps src/components/studio/views/chat-subcomponents.tsx:137
Interface WelcomePanelProps src/components/studio/views/chat-subcomponents.tsx:83
Const COUNTER_THRESHOLD src/components/studio/views/chat-subcomponents.tsx:48
Const MAX_INPUT_LENGTH src/components/studio/views/chat-subcomponents.tsx:46
Const ASSISTANT_ROLE_LABEL src/components/studio/views/chat-subcomponents.tsx:44
Const entityId src/components/studio/views/editor-view.tsx:343
Const query src/components/studio/views/editor-view.tsx:266
Const FORMAT_HANDLERS src/components/studio/views/editor-view.tsx:138
Const FORMAT_COMMANDS src/components/studio/views/editor-view.tsx:120
Const ADVANCED_METADATA_DESCRIPTION src/components/studio/views/editor-view.tsx:62
Const ADVANCED_METADATA_TITLE src/components/studio/views/editor-view.tsx:61
Function a src/components/studio/views/editor-view.tsx:484
Changed Files (3)
File Status
src/components/studio/views/chat-subcomponents.tsx 🟡 modified
src/components/studio/views/editor-view.tsx 🟡 modified
src/components/studio/views/markdown-security.test.tsx 🟢 added

What it affects

Architecture Impact

Module Hits Direct
Studio 3 🟢
Views 3 🟢

Blast Radius

Depth Count
d1 (direct) 2
d2 (indirect) 2
d3 (transitive) 2
Direct dependents (d1)
  • src/components/studio/app-shell.tsx:98 · ViewRouter
  • src/components/studio/views/chat-view.tsx:28 · ChatView
Indirect dependents (d2)
  • src/components/studio/app-shell.tsx:123 · AppShell
  • src/components/studio/app-shell.tsx · app-shell.tsx
Transitive dependents (d3)
  • src/app/page.tsx · page.tsx
  • src/app/page.tsx:5 · Home

Full detail lives in the GitNexus check run for this commit.

@codacy-production

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 8 complexity · 0 duplication

Metric Results
Complexity 8
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch was successfully deployed

1 active deployment
Preview — 4c78b12c Deployed Sep 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config tests Related to automated/manual tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant