T09 · Insecure Skill Coding Practices
- Location
SKILL.md:29- Finding
Untrusted External Data Rendered into Active HTML Without Required Sanitization
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 29-175
Vulnerability Type: Unsafe HTML generation from externally sourced data
Risk Level: MediumEvidence
markdown ## Data Modules and MCP Tool Mapping | Module | MCP Tool | Filter Parameters | |------|---------|---------| | BD deals | `ls_drug_deal_search` | `drug_type=["ADC"]`, `deal_date_from/to` | | Clinical results | `ls_clinical_trial_result_search` | `drug_type=["ADC"]`, `published_date_from/to` | | New clinical trials | `ls_clinical_trial_search` | `drug_type=["ADC"]`, `study_first_posted_date_from/to` | | Patents | `ls_patent_search` | `drug_type=["ADC"]`, `publication_date_from/to` | | Approved drugs | `ls_drug_search` | `drug_type=["ADC"]`, `highest_phase=["approved"]` | | Literature | `ls_paper_search` | `drug_type=["ADC"]`, `year_from/to` | | Conferences | `mcp_web-search__web_search` | ASCO/AACR/ESMO/ASH/JPM plus ADC keywords | ### Step 2A: BD deal processing - Fields: `deal_title` / `deal_time` / `principle_organization` / `partner_organization` / `url` - Links: Prefer the original `url` field; otherwise use `synapse.zhihuiya.com/news-detail/{deal_id}` ### Step 2B: Clinical result processing - Required fields: `trial_name` / `drug` / `target` / `indication` / `phase` / `sponsor_org` / `key_endpoints` / `publication_date` / `source_url` ### Step 4: Authoritative conference module - Perform web searches for ADC-related abstracts from conferences that are ongoing or recently completed. ### Step 6: HTML report rendering specification #### 6.3 Compact card structure - Title row: entity name plus badge group plus date - Tag row: display all properties as inline tags - Data box: original numeric values only - Link button: lower-right corner #### 6.4 `data-tags` specification Each card's `data-tags` attribute must contain: `target / drug name / company abbreviation / phase / geography / technology type / ...[truncated 3606 chars]- Remediation
View remediation
Remediation Suggestions
-
Apply contextual output encoding
- Escape all externally sourced values before insertion into HTML element text.
- Escape quotation marks and other special characters before insertion into attributes.
- Do not construct HTML through raw string concatenation.
-
Use safe DOM construction
- Create elements with DOM APIs.
- Assign external text through
textContent. - Set known attributes with
setAttributeonly after validation. - Store filter values in normalized internal structures rather than embedding raw source text in
data-tags.
-
Validate links
- Parse every URL with a standards-compliant URL parser.
- Permit only
https:URLs. - Reject
javascript:,data:,file:, and other unintended schemes. - Where practical, allowlist expected source domains.
- Preserve the existing path checks, but treat them as correctness checks rather than security controls.
-
Sanitize unavoidable HTML
- If source formatting must be retained, process it through a well-maintained sanitizer configured with a minimal allowlist.
- Remove scripts, event-handler attributes, embedded frames, forms, unsafe style content, and dangerous URL schemes.
-
Add browser-level defense in depth
- Add a restrictive Content Security Policy, such as:
default-src 'none'; script-src 'self'; style-src 'unsafe-inline'; img-src https: data:; connect-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'. - Move required JavaScript into a fixed, trusted script and avoid dynamically generated script content.
- If the report must contain inline JavaScript, use a generated CSP nonce rather than broadly allowing inline scripts.
- Add a restrictive Content Security Policy, such as:
-
Test hostile inputs
- Add test records containing HTML tags, quotation marks, event-handler attributes, encoded payloads, and dangerous URL schemes.
- Verify that all such values are displayed ...[truncated 26 chars]
-
