T09 · Insecure Skill Coding Practices
- Location
assets/template.html:294- Finding
Externally Sourced Travel Data Enables Stored HTML and JavaScript Injection
- Content
View full analysis
' + LOADING_STEPS[i] + ''; } document.getElementById('loadingSteps').innerHTML = stepsHtml; ``` ```javascript if (node.status === 'unlocked') { buttons = ''; } else if (node.status === 'in_progress') { buttons = '' + '查看订单' + '确认到店 (模拟核销)' + ''; } html += '' + ''; container.innerHTML = html; ``` ```javascript for (var i = 0; i < gameState.rewards.length; i++ ...[truncated 3387 chars]' + '
' + '' + (i + 1) + '' + '' + node.chapter + ': ' + node.title + '' + '' + statusTextMap[node.status] + '' + '"' + node.story + '"
' + '📍 ' + node.address + ' | 🎫 ' + node.skuName + '
' + buttons + '- Remediation
View remediation
` as `\u003e`. - Escape `&` as `\u0026`. - Escape U+2028 and U+2029. - Ensure `` cannot terminate the containing script element. - Prefer embedding data in an `application/json` element and parsing its `textContent`. 3. Apply strict URL validation: - Parse URLs with a standards-compliant URL parser. - Permit only `https:` for remote booking and image resources. - Reject embedded credentials, control characters, malformed hosts, and unexpected ports. - Where feasible, allowlist official FlyAI or Fliggy destination hosts. - Reject `javascript:`, `data:`, `file:`, `blob:`, and other unneeded schemes. 4. Add `rel="noopener noreferrer"` to every external link using `target="_blank"`. 5. Treat every external CLI response as untrusted, even if it is valid JSON. 6. Add a restrictive Content Security Policy that disallows inline event handlers and limits scripts, images, and navigation destinations. Refactoring inline handlers should precede enabling a strict policy. 7. Add security tests containing payloads with quotes, angle brackets, ``, event handlers, malformed URLs, and Unicode separator characters. ]]>
