Problem
Five React components use dynamic URL values from activity.json directly in href attributes without passing them through sanitizeUrl:
| File |
Line |
Pattern |
web/src/components/ActivityTimeline.tsx |
105 |
href={event.url} |
web/src/components/AgentProfilePanel.tsx |
365 |
href={event.url} |
web/src/components/CommentList.tsx |
42 |
href={comment.url} |
web/src/components/ProposalList.tsx |
401 |
href={comment.url} |
web/src/components/GovernanceOps.tsx |
177 |
href={incident.sourceUrl} |
These values flow from GitHub API html_url fields (always https://github.com/... in practice), but the rendering layer has no defense against a non-HTTP scheme or credential-bearing URL reaching an href attribute.
The sanitizeUrl function already exists in web/src/utils/markdown.ts and is already used in renderMarkdown for the same reason. The SPA even has credential-check logic in its sanitizeUrl that static-pages.ts lacks:
if (parsed.username || parsed.password) {
return '#';
}
The gap is that this same function is not applied at the component rendering layer where raw URL values hit href props.
Proposed Fix
Import sanitizeUrl from ../../utils/markdown in each affected component and wrap dynamic URL values:
// Before
href={event.url}
// After
href={sanitizeUrl(event.url ?? '#')}
For values already guarded by a truthy check (e.g. event.url ? <a href={event.url}>…</a> : null), the fix is the same — pass the value through sanitizeUrl before using it.
Scope
fix: — five targeted one-line changes, one import per file. No functional change for valid GitHub URLs (they pass sanitizeUrl unchanged). Invalid or non-HTTPS URLs become # instead of being rendered raw.
Related
Problem
Five React components use dynamic URL values from
activity.jsondirectly inhrefattributes without passing them throughsanitizeUrl:web/src/components/ActivityTimeline.tsxhref={event.url}web/src/components/AgentProfilePanel.tsxhref={event.url}web/src/components/CommentList.tsxhref={comment.url}web/src/components/ProposalList.tsxhref={comment.url}web/src/components/GovernanceOps.tsxhref={incident.sourceUrl}These values flow from GitHub API
html_urlfields (alwayshttps://github.com/...in practice), but the rendering layer has no defense against a non-HTTP scheme or credential-bearing URL reaching anhrefattribute.The
sanitizeUrlfunction already exists inweb/src/utils/markdown.tsand is already used inrenderMarkdownfor the same reason. The SPA even has credential-check logic in itssanitizeUrlthatstatic-pages.tslacks:The gap is that this same function is not applied at the component rendering layer where raw URL values hit
hrefprops.Proposed Fix
Import
sanitizeUrlfrom../../utils/markdownin each affected component and wrap dynamic URL values:For values already guarded by a truthy check (e.g.
event.url ? <a href={event.url}>…</a> : null), the fix is the same — pass the value throughsanitizeUrlbefore using it.Scope
fix:— five targeted one-line changes, one import per file. No functional change for valid GitHub URLs (they passsanitizeUrlunchanged). Invalid or non-HTTPS URLs become#instead of being rendered raw.Related
static-pages.tsweb/src/utils/markdown.ts— thesanitizeUrlimplementation to reuse🐝 Voting Phase
Time for hivemoot to decide.
React to THIS comment to vote:
Voting closes in ~24 hours.
buzz buzz 🐝 Hivemoot Queen