Skip to content

fix(citation): open external web documents directly - #20452

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
dcc123456:fix/external-citation-link-open
Oct 8, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
dcc123456:fix/external-citation-link-open

Conversation

@dcc123456

Copy link
Copy Markdown
Collaborator

Summary

Citation buttons always routed to the internal /document/:id preview page, even for web-page documents that carry their own source URL in doc_aggs.url. That page has nothing to render for them, so those links were effectively dead.

  • components/markdown-content, components/next-markdown-content and components/floating-chat-widget-markdown now open the source URL directly when it is an absolute http(s) link, and keep the internal preview route otherwise.
  • pages/next-search/markdown-content previously discarded documentUrl; it is now passed through so external links bypass the preview modal. The unused isPdf parameter was dropped.

Citation buttons always routed to the internal `/document/:id` preview
page, even for web-page documents that carry their own source URL in
`doc_aggs.url`. That page has nothing to render for them, so those links
were effectively dead.

- `components/markdown-content`, `components/next-markdown-content` and
  `components/floating-chat-widget-markdown` now open the source URL
  directly when it is an absolute http(s) link, and keep the internal
  preview route otherwise.
- `pages/next-search/markdown-content` previously discarded
  `documentUrl`; it is now passed through so external links bypass the
  preview modal. The unused `isPdf` parameter was dropped.
@dcc123456
dcc123456 requested a review from wangq8 September 30, 2026 07:50
@dcc123456 dcc123456 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Sep 30, 2026
@dcc123456
dcc123456 marked this pull request as draft September 30, 2026 07:50
@coderabbitai

coderabbitai Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: cf8059fc-ac3e-421a-9607-6e3a79915f9d

📥 Commits

Reviewing files that changed from the base of the PR and between 7130de3 and f527ec0.

📒 Files selected for processing (1)
  • web/src/pages/next-search/markdown-content/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/pages/next-search/markdown-content/index.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Document buttons in four markdown views now open HTTP(S) document URLs in a new tab with noopener,noreferrer. Other URLs retain the internal document route. The next-search view passes the document URL to its click handler and removes an unused parameter.

Changes

External Document URL Handling

Layer / File(s) Summary
Document URL click handling
web/src/components/floating-chat-widget-markdown.tsx, web/src/components/markdown-content/index.tsx, web/src/components/next-markdown-content/index.tsx, web/src/pages/next-search/markdown-content/index.tsx
Click handlers open HTTP(S) document URLs in a new tab with noopener,noreferrer. Other URLs retain the internal document route. The next-search view passes the document URL to the handler and removes the unused isPdf parameter.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to f527e

External web citations open their source URLs, while other citations retain existing routing. No actionable merge-blocking risk was identified; merge after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 7130d

External citation clicks now open source websites directly. HTTP(S)-only routing and isolated new tabs constrain exposure, and no introduced exploit was demonstrated. However, the provenance and validation of the supplied URLs remain unconfirmed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — If a less-trusted producer can supply a document URL shown to another user, clicking its citation can navigate that user's browser to the supplied HTTP(S) destination. This is a conditional exposure, not a verified attack path. Producer privileges, audience, tenant reach, and downstream credential exposure remain unresolved.

Trust Boundaries and Controls

  • observed — The external-navigation gate excludes javascript, data, file, and other non-HTTP(S) schemes from this new branch. New tabs explicitly disable opener access and referrer propagation. Rendered chunk HTML is sanitized separately; that sanitizer is not applied to documentUrl.
  • observed — Next-search's HTTP(S) branch skips the preview callback. The inspected preview hook only opens modal state and selects a document and chunk; it does not establish an authentication control that this PR bypasses. Downstream document authorization remains outside the resolved evidence.

Hardening Proposals

  • proposed — Establish the upstream source-URL provenance and authorized document association contract. If lower-trust contributors can supply destinations displayed to other users, consider making the destination origin visible before navigation. These are conditional hardening proposals, not observed vulnerabilities.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: opening external citation documents directly.
Description check ✅ Passed The description includes the required Summary section and explains the problem, affected components, fallback behavior, and removal of the unused parameter.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files.
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

A rabbit clicks a link with care,
An outside page opens there.
Safe new tabs greet the moonlit night,
Other routes stay on their flight.
Four markdown paths now share the way,
The rabbit hops contentedly away.

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

@dcc123456
dcc123456 marked this pull request as ready for review September 30, 2026 07:51
@wangq8 wangq8 added ci Continue Integration and removed ci Continue Integration labels Sep 30, 2026
The `handleDocumentButtonClick` callback params were wrapped across four
lines; oxfmt collapses them onto one, which is what `lefthook run
web-checks` enforces in CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@wangq8
wangq8 merged commit a2709a4 into infiniflow:main Oct 8, 2026
6 checks passed
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. ci Continue Integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants