Security: validate explorer URL segments before interpolation (#430) #958
No reviewers
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic!958
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/430-explorer-url-sanitization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes #430 (SEC-E10):
getExplorerTxUrlandgetExplorerAddressUrlnow reject unsafe inputs before interpolating them into URL templates.null.null.null, so spoofed indexer data cannot producejavascript:or HTML-injectedhrefvalues.docs/frontend.mdandskills/AGENTS_FRONTEND_TERRA_EXPLORER.md.Acceptance checklist
terraExplorer.test.tsrejectsjavascript:prefix (output is not ajavascript:URL)bash scripts/with-node.sh --cwd frontend-dapp -- npm test -- src/utils/__tests__/terraExplorer.test.ts -t "javascript"terraExplorer.test.tsrejects HTML-special characters in tx hash or addressbash scripts/with-node.sh --cwd frontend-dapp -- npm test -- src/utils/__tests__/terraExplorer.test.ts -t "HTML-special"hrefunder adversarial input (or document React defense)bash scripts/with-node.sh --cwd frontend-dapp -- npm test -- src/components/ui/__tests__/AddressRow.explorerSafety.test.tsx src/components/ui/__tests__/TerraBroadcastPendingLink.test.tsx -t "explorer link safety"bash scripts/with-node.sh --cwd frontend-dapp -- npm test -- src/utils/__tests__/terraExplorer.test.ts -t "adversarial"Third-party verification
Inspect
frontend-dapp/src/utils/terraExplorer.ts— both public helpers returnnullwhenisSafeExplorerTxHash/isSafeExplorerAddressfail.Docs:
docs/frontend.md§ Terra Classic block explorer URLs ·skills/AGENTS_FRONTEND_TERRA_EXPLORER.mdrule 6.mentioned in commit
8a7e7adda1Security review — MR !958
Commit reviewed:
7e28b26b96a88bc4b2496a3fe960758126f7d3f5Scope:
terraExplorer.tssegment validation (isSafeExplorerTxHash/isSafeExplorerAddress), consumer components (AddressRow,TerraBroadcastPendingLink,TxResultAlert,TradesTable,WalletIndexerHistoryPanel,WalletDropdownMenuItems), adversarial unit/link tests, docs/skills updates.Outcome:
FINDINGS: 0medium+Security review: no medium+ findings on this diff.
Analysis summary
This MR closes SEC-E10 (#430) by validating attacker-influenced segments before URL interpolation:
getExplorerTxUrl/^[0-9a-fA-F]{64}$/javascript:, HTML specials, path traversal, empty — returnsnullgetExplorerAddressUrlisValidTerraBech32Address):,/,<,>; rejects non-terraprefixes — returnsnullAttack-path tracing: Indexer-returned
tx_hash/ address fields are the primary untrusted input. All explorerhrefsinks route through the two helpers above; components render anchors only when the helper returns non-null, otherwise plain<span>(verified inAddressRow.explorerSafety.test.tsx,TerraBroadcastPendingLink.test.tsx). No alternate explorer-URL builders were introduced.Residual notes (informational, below medium): React
hrefsanitization remains a secondary layer.isSafeExplorerAddressvalidatestrim()but interpolates the rawaddressargument — whitespace padding could produce a malformed explorer URL but not scheme injection or XSS.Tests run: adversarial + link-safety vitest targets — PASS.
No inline threads (no medium+ findings).
mentioned in issue #430