@salesforce/afv-skills 1.37.0 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/agentforce-generate/README.md +20 -3
- package/skills/agentforce-generate/SKILL.md +253 -440
- package/skills/agentforce-generate/assets/agent-spec-template.md +6 -2
- package/skills/agentforce-generate/assets/agents/order-service.agent +16 -12
- package/skills/agentforce-generate/assets/agents/production-faq.agent +4 -4
- package/skills/agentforce-generate/assets/agents/router-first.agent +5 -5
- package/skills/agentforce-generate/assets/agents/template-single-subagent.agent +4 -4
- package/skills/agentforce-generate/assets/agents/verification-gate.agent +8 -6
- package/skills/agentforce-generate/assets/agents/voice-knowledge-grounded.agent +9 -9
- package/skills/agentforce-generate/assets/agents/voice-service-agent.agent +7 -7
- package/skills/agentforce-generate/assets/patterns/README.md +3 -3
- package/skills/agentforce-generate/assets/patterns/action-callbacks.agent +5 -5
- package/skills/agentforce-generate/assets/patterns/advanced-input-bindings.agent +6 -8
- package/skills/agentforce-generate/assets/patterns/bidirectional-routing.agent +11 -13
- package/skills/agentforce-generate/assets/patterns/critical-input-collection.agent +11 -16
- package/skills/agentforce-generate/assets/patterns/lifecycle-events.agent +2 -3
- package/skills/agentforce-generate/assets/patterns/llm-controlled-actions.agent +6 -7
- package/skills/agentforce-generate/assets/patterns/open-gate-routing.agent +3 -3
- package/skills/agentforce-generate/assets/patterns/prompt-template-action.agent +14 -19
- package/skills/agentforce-generate/assets/patterns/system-instruction-overrides.agent +11 -20
- package/skills/agentforce-generate/references/actions-reference.md +2 -2
- package/skills/agentforce-generate/references/agent-audit-and-repair.md +135 -0
- package/skills/agentforce-generate/references/agent-audit-candidate-verification.md +160 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostic-catalog.md +156 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-actions-state.md +176 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-architecture-evaluation.md +68 -0
- package/skills/agentforce-generate/references/agent-audit-diagnostics-instructions-routing.md +283 -0
- package/skills/agentforce-generate/references/agent-audit-evaluation-loop.md +191 -0
- package/skills/agentforce-generate/references/agent-audit-repair-report.md +143 -0
- package/skills/agentforce-generate/references/agent-audit-scope-path-review.md +180 -0
- package/skills/agentforce-generate/references/agent-design-and-spec-creation.md +105 -59
- package/skills/agentforce-generate/references/agent-script-core-language.md +144 -61
- package/skills/agentforce-generate/references/agent-subagent-map-diagrams.md +33 -23
- package/skills/agentforce-generate/references/agent-validation-and-debugging.md +37 -11
- package/skills/agentforce-generate/references/agentscript-toolchain.md +112 -0
- package/skills/agentforce-generate/references/architecture-patterns.md +81 -18
- package/skills/agentforce-generate/references/common-control-flow-pitfalls.md +255 -0
- package/skills/agentforce-generate/references/control-flow-actions-sequencing.md +198 -0
- package/skills/agentforce-generate/references/control-flow-lifecycle-side-effects.md +87 -0
- package/skills/agentforce-generate/references/examples.md +22 -22
- package/skills/agentforce-generate/references/instruction-resolution.md +123 -83
- package/skills/agentforce-generate/references/known-issues.md +1 -2
- package/skills/agentforce-generate/references/optimization-pattern-1-data-flow.md +4 -0
- package/skills/agentforce-generate/references/optimization-pattern-2-deterministic-logic.md +33 -0
- package/skills/agentforce-generate/references/optimization-pattern-3-reference-syntax.md +32 -3
- package/skills/agentforce-generate/references/optimization-pattern-4-escalation.md +2 -2
- package/skills/agentforce-generate/references/patterns-by-requirement.md +3 -1
- package/skills/agentforce-generate/references/posture-and-determinism.md +103 -22
- package/skills/agentforce-generate/references/reference-map.md +19 -3
- package/skills/agentforce-generate/references/scoring-rubric.md +1 -1
- package/skills/agentforce-generate/references/voice-latency-heuristics.md +4 -0
- package/skills/agentforce-generate/references/voice-modality-reference.md +4 -4
- package/skills/agentforce-generate/references/zen-of-agentscript.md +139 -23
- package/skills/agentforce-generate/scripts/agentscript-sdk-loader.mjs +133 -0
- package/skills/agentforce-generate/scripts/index-agent.mjs +141 -0
- package/skills/agentforce-generate/scripts/setup-agentscript-sdk.mjs +337 -0
- package/skills/automation-sandbox-post-copy-config-generate/SKILL.md +1 -1
- package/skills/automation-sandbox-post-copy-configure/SKILL.md +433 -0
- package/skills/automation-sandbox-post-copy-configure/assets/api_request_templates.json +89 -0
- package/skills/automation-sandbox-post-copy-configure/examples/sample_config_input.json +40 -0
- package/skills/automation-sandbox-post-copy-configure/examples/sample_execution_summary.md +79 -0
- package/skills/automation-sandbox-post-copy-configure/references/api_endpoints.md +273 -0
- package/skills/automation-sandbox-post-copy-configure/references/authentication.md +94 -0
- package/skills/automation-sandbox-post-copy-configure/references/execution_phasing.md +93 -0
- package/skills/automation-sandbox-post-copy-configure/references/rules_gotchas.md +35 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/classify-patch-result.mjs +88 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/map-metadata-key.mjs +98 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/plan-phases.mjs +98 -0
- package/skills/automation-sandbox-post-copy-configure/scripts/resolve-target-org.mjs +56 -0
- package/skills/design-systems-slds-validate/SKILL.md +14 -13
- package/skills/dx-code-analyzer-custom-rule-create/examples/xpath-examples.md +1 -1
- package/skills/dx-code-analyzer-custom-rule-create/references/xpath-patterns-security.md +1 -1
- package/skills/dx-org-devhub-configure/SKILL.md +268 -0
- package/skills/dx-org-devhub-configure/examples/status-output.md +39 -0
- package/skills/dx-org-devhub-configure/scripts/devhub.sh +650 -0
- package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +116 -0
- package/skills/dx-org-manage/SKILL.md +135 -42
- package/skills/dx-org-manage/assets/derive-alias.sh +95 -0
- package/skills/dx-org-manage/assets/scratch-def.seed.json +6 -0
- package/skills/dx-org-manage/examples/README.md +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/delete_output.json +8 -0
- package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +23 -0
- package/skills/dx-org-manage/examples/scratch-orgs/list_output.json +58 -0
- package/skills/dx-org-manage/examples/scratch-orgs/resume_output.json +38 -0
- package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +1 -1
- package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +41 -0
- package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +1 -1
- package/skills/dx-org-manage/examples/snapshots/error_output.json +3 -3
- package/skills/dx-org-manage/references/creating-scratch-org.md +2 -2
- package/skills/dx-org-manage/references/creating-snapshot.md +1 -2
- package/skills/dx-org-manage/references/definition_file_options.md +24 -0
- package/skills/dx-org-manage/references/edition_types.md +10 -8
- package/skills/dx-org-manage/references/opening-org.md +11 -12
- package/skills/dx-org-manage/references/scratch-org-create.md +303 -0
- package/skills/dx-org-manage/references/scratch-org-operations.md +135 -0
- package/skills/experience-aura-lwc-migrate/SKILL.md +120 -0
- package/skills/experience-aura-lwc-migrate/references/aura-api-expert.md +170 -0
- package/skills/experience-aura-lwc-migrate/references/aura-data-expert.md +172 -0
- package/skills/experience-aura-lwc-migrate/references/aura-migration-guidelines.md +299 -0
- package/skills/experience-aura-lwc-migrate/references/aura-prd-framework.md +79 -0
- package/skills/experience-aura-lwc-migrate/references/aura-redundant-code-expert.md +24 -0
- package/skills/experience-aura-lwc-migrate/references/aura-reference-expert.md +140 -0
- package/skills/experience-aura-lwc-migrate/references/aura-resolver-expert.md +115 -0
- package/skills/experience-aura-lwc-migrate/references/aura-slots-expert.md +67 -0
- package/skills/experience-aura-lwc-migrate/references/aura-style-expert.md +62 -0
- package/skills/experience-aura-lwc-migrate/references/aura-to-lwc-completeness-checklist.md +188 -0
- package/skills/experience-aura-lwc-migrate/references/aura-values-expert.md +67 -0
- package/skills/experience-content-media-search/SKILL.md +17 -12
- package/skills/experience-content-media-stock-image-search/SKILL.md +192 -0
- package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +102 -0
- package/skills/experience-lds-best-practices-apply/SKILL.md +245 -0
- package/skills/experience-lds-best-practices-apply/references/adapter-apis.md +1640 -0
- package/skills/experience-lds-best-practices-apply/references/lds-data-consistency.md +126 -0
- package/skills/experience-lds-best-practices-apply/references/lds-expert.md +429 -0
- package/skills/experience-lds-best-practices-apply/references/lds-referential-integrity.md +322 -0
- package/skills/experience-lds-best-practices-apply/references/wire-adapter-types.md +1511 -0
- package/skills/experience-lds-graphql-generate/SKILL.md +222 -0
- package/skills/experience-lds-graphql-generate/references/generation-guide.md +236 -0
- package/skills/experience-lds-graphql-generate/references/generation-mutation.md +277 -0
- package/skills/experience-lds-graphql-generate/references/generation-query.md +237 -0
- package/skills/experience-lds-graphql-generate/scripts/fetch-lds-graphql-schema.sh +230 -0
- package/skills/experience-lds-graphql-generate/scripts/test-lds-graphql-query.sh +128 -0
- package/skills/experience-lwc-accessibility-validate/SKILL.md +112 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-1-1-non-text-content.md +88 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-i-lists.md +52 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-ii-tables.md +106 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iii-form-labels.md +78 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iv-regions.md +26 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-v-groups.md +66 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-5-identify-input.md +70 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-4-3-contrast.md +115 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-1-1-keyboard.md +47 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-4-link-purpose.md +39 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-6-headings-labels.md +50 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-1-pointer-gestures.md +54 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-2-pointer-cancellation.md +49 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-3-label-in-name.md +77 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-7-dragging-movement.md +45 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-1-on-focus.md +55 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-2-on-input.md +51 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-1-error-identification.md +84 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-2-labels-instructions.md +50 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-3-error-suggestion.md +64 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-i-name.md +105 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-ii-role.md +99 -0
- package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-iii-value.md +97 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-1-1-non-text-content.md +83 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-1-use-of-color.md +62 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-10-resize-reflow.md +18 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-11-non-text-contrast.md +43 -0
- package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-3-contrast.md +25 -0
- package/skills/experience-lwc-accessibility-validate/scripts/contrast-ratio.py +153 -0
- package/skills/experience-lwc-design-generate/SKILL.md +261 -0
- package/skills/experience-lwc-design-generate/references/figma-to-prd-blueprint.md +66 -0
- package/skills/experience-lwc-design-generate/references/prd-analysis-template.md +17 -0
- package/skills/experience-lwc-design-generate/scripts/check-component-name.sh +75 -0
- package/skills/experience-lwc-design-generate/scripts/detect-project-tools.sh +97 -0
- package/skills/experience-lwc-runtime-observe/SKILL.md +244 -0
- package/skills/experience-lwc-runtime-observe/examples/component-preview-and-dom.md +41 -0
- package/skills/experience-lwc-runtime-observe/scripts/extract-dom.sh +79 -0
- package/skills/experience-lwc-runtime-observe/scripts/open-frontdoor.sh +46 -0
- package/skills/experience-lwc-runtime-observe/scripts/verify-toolchain.sh +48 -0
- package/skills/experience-lwc-security-validate/SKILL.md +151 -0
- package/skills/experience-lwc-security-validate/examples/review-report.md +6 -0
- package/skills/experience-lwc-security-validate/examples/score-report.sarif.json +32 -0
- package/skills/experience-lwc-security-validate/references/lws-security-expert.md +986 -0
- package/skills/experience-lwc-security-validate/references/security-analysis.md +611 -0
- package/skills/experience-lwc-security-validate/scripts/check-lwc-import.sh +166 -0
- package/skills/experience-lwc-security-validate/scripts/validate-sarif.sh +131 -0
- package/skills/experience-ui-bundle-2gp-deploy/SKILL.md +454 -0
- package/skills/experience-ui-bundle-2gp-deploy/assets/CustomApplication.app-meta.xml +12 -0
- package/skills/experience-ui-bundle-2gp-deploy/assets/PermissionSet.permissionset-meta.xml +9 -0
- package/skills/experience-ui-bundle-2gp-deploy/scripts/find-bundle-package-dir.sh +53 -0
- package/skills/experience-ui-bundle-agentforce-client-generate/SKILL.md +104 -26
- package/skills/experience-ui-bundle-agentforce-client-generate/references/constraints.md +35 -24
- package/skills/experience-ui-bundle-agentforce-client-generate/references/examples.md +92 -1
- package/skills/experience-ui-bundle-agentforce-client-generate/references/style-tokens.md +2 -0
- package/skills/experience-ui-bundle-agentforce-client-generate/references/troubleshooting.md +14 -1
- package/skills/experience-ui-bundle-agentforce-client-generate/scripts/detect-framework.sh +67 -0
- package/skills/experience-ui-bundle-deploy/SKILL.md +83 -14
- package/skills/experience-ui-bundle-deploy/assets/Communities.settings-meta.xml +19 -0
- package/skills/experience-ui-bundle-deploy/assets/org-setup.config.template.json +5 -0
- package/skills/experience-ui-bundle-deploy/assets/social-login-auth-providers.apex +158 -0
- package/skills/experience-ui-bundle-deploy/references/config-scaffold.md +13 -1
- package/skills/experience-ui-bundle-deploy/references/social-login.md +179 -0
- package/skills/experience-ui-bundle-frontend-generate/SKILL.md +14 -0
- package/skills/experience-ui-bundle-mfa-configure/SKILL.md +6 -5
- package/skills/experience-ui-bundle-mfa-configure/references/social-login.md +15 -7
- package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +41 -5
- package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +10 -22
- package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +4 -19
- package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +5 -0
- package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +33 -150
- package/skills/mobile-platform-native-capabilities-integrate/references/nfc.md +35 -0
- package/skills/platform-apex-generate/SKILL.md +8 -7
- package/skills/platform-apex-test-generate/SKILL.md +3 -1
- package/skills/platform-apex-test-run/SKILL.md +9 -8
- package/skills/platform-lightning-type-widget-coordinate/SKILL.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/examples/existing-lightning-type-with-widget-prompt.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/examples/new-lightning-type-with-widget-prompt.md +1 -1
- package/skills/platform-lightning-type-widget-coordinate/references/validation-gates.md +3 -3
- package/skills/platform-mcp-tool-widget-coordinate/SKILL.md +43 -67
- package/skills/platform-mcp-tool-widget-coordinate/examples/action-name-source-prompt.md +1 -2
- package/skills/platform-mcp-tool-widget-coordinate/examples/apex-invocable-source-prompt.md +2 -3
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-list-source-prompt.md +163 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-single-source-prompt.md +198 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/pasted-tool-output-prompt.md +0 -1
- package/skills/platform-mcp-tool-widget-coordinate/references/build-plan-format.md +17 -11
- package/skills/platform-mcp-tool-widget-coordinate/references/mcp-tool-output-discovery.md +48 -15
- package/skills/platform-mcp-tool-widget-coordinate/references/two-clt-modeling.md +73 -10
- package/skills/platform-mcp-tool-widget-coordinate/references/validation-gates.md +48 -8
- package/skills/platform-policy-rule-generate/SKILL.md +22 -12
- package/skills/platform-policy-rule-generate/references/deploy-errors.md +1 -1
- package/skills/platform-policy-rule-generate/references/policy-schema-full.md +8 -29
- package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
- package/skills/platform-sharing-owd-configure/SKILL.md +20 -8
- package/skills/platform-sharing-owd-configure/references/access_levels.md +14 -1
- package/skills/platform-sharing-rules-generate/SKILL.md +67 -35
- package/skills/platform-sharing-rules-generate/examples/create-cases.md +16 -17
- package/skills/platform-sharing-rules-generate/examples/delete-cases.md +34 -79
- package/skills/platform-sharing-rules-generate/examples/edit-cases.md +13 -26
- package/skills/platform-sharing-rules-generate/scripts/count-remaining-rules.sh +33 -0
- package/skills/platform-widget-generate/SKILL.md +3 -5
- package/skills/platform-widget-generate/examples/conditional.json +18 -13
- package/skills/platform-widget-generate/examples/list-with-foreach.json +2 -2
- package/skills/platform-widget-generate/examples/single-object.json +2 -2
- package/skills/platform-widget-generate/references/schema-from-lightning-type.md +27 -6
- package/skills/platform-widget-generate/references/widget-bundle-layout.md +4 -3
- package/skills/service-itsm-agentic-setup-cmdb-access-assign/SKILL.md +287 -0
- package/skills/service-itsm-agentic-setup-cmdb-access-assign/references/mcp-invocation.md +260 -0
- package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/SKILL.md +252 -0
- package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/references/mcp-invocation.md +204 -0
- package/skills/service-itsm-agentic-setup-cmdb-configure/SKILL.md +259 -0
- package/skills/service-itsm-agentic-setup-cmdb-configure/references/mcp-invocation.md +188 -0
- package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +197 -0
- package/skills/service-itsm-agentic-setup-cmdb-coordinate/examples/output-templates.md +77 -0
- package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/SKILL.md +316 -0
- package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/references/mcp-invocation.md +221 -0
- package/skills/service-itsm-incident-priority-configure/SKILL.md +168 -0
- package/skills/service-itsm-incident-priority-configure/examples/matrix-operations.md +200 -0
- package/skills/service-itsm-incident-priority-configure/examples/render-matrix.md +54 -0
- package/skills/service-itsm-incident-priority-configure/examples/seed-full-matrix.md +52 -0
- package/skills/service-itsm-incident-priority-configure/references/sf-cli-invocation.md +264 -0
- package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-source-prompt.md +0 -191
- package/skills/platform-policy-rule-generate/references/fixtures-index.md +0 -29
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
### Document.createProcessingInstruction
|
|
2
|
+
|
|
3
|
+
#### How to Find the Issue
|
|
4
|
+
|
|
5
|
+
Flag ALL usage of `document.createProcessingInstruction` including:
|
|
6
|
+
|
|
7
|
+
- Direct calls, bracket notation, destructuring
|
|
8
|
+
- Variable-based or dynamically constructed method names
|
|
9
|
+
- String concatenation or template literals creating the method name
|
|
10
|
+
- All contexts: Loops, conditionals, event handlers, async callbacks, hidden by unicode escape sequences and Reflection APIs
|
|
11
|
+
|
|
12
|
+
#### How to report the Issue
|
|
13
|
+
|
|
14
|
+
**RuleId: lws-001**
|
|
15
|
+
**level: error**
|
|
16
|
+
**message: Usage of document.createProcessingInstruction creates XML injection vulnerabilities enabling XSS attacks**
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
### Document Event Handlers
|
|
21
|
+
|
|
22
|
+
#### How to Find the Issue
|
|
23
|
+
|
|
24
|
+
Flag ONLY actual event handler registrations for these THREE forbidden events (case-sensitive):
|
|
25
|
+
|
|
26
|
+
- `rejectionhandled`
|
|
27
|
+
- `securitypolicyviolation`
|
|
28
|
+
- `unhandledrejection`
|
|
29
|
+
|
|
30
|
+
Include all contexts: Loops, conditionals, event handlers, async callbacks, template literals, string concatenation, hidden by unicode escape sequences.
|
|
31
|
+
|
|
32
|
+
#### How to report the Issue
|
|
33
|
+
|
|
34
|
+
**RuleId: lws-002**
|
|
35
|
+
**level: error**
|
|
36
|
+
**message: Usage of forbidden document event handler ({eventName}) exposes sensitive information**
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### Document.open
|
|
41
|
+
|
|
42
|
+
#### How to Find the Issue
|
|
43
|
+
|
|
44
|
+
Flag `document.open` based on argument count:
|
|
45
|
+
|
|
46
|
+
- `document.open()` with 0 args: **BLOCKED** - Clears document (security risk)
|
|
47
|
+
- `document.open(url)` with 1 arg: **BLOCKED** - Opens in same window (navigation hijacking)
|
|
48
|
+
- `document.open(url, name)` with 2 args: **BLOCKED** - Opens with target in same window (security risk)
|
|
49
|
+
- `document.open(url, name, features)` with 3+ args: **ALLOWED**
|
|
50
|
+
|
|
51
|
+
Include indirect access patterns: bracket notation (`document['open']`), destructuring (`const {open} = document`), and variable references in all contexts.
|
|
52
|
+
|
|
53
|
+
#### How to report the Issue
|
|
54
|
+
|
|
55
|
+
**RuleId: lws-003**
|
|
56
|
+
**level: error**
|
|
57
|
+
**message: Usage of document.open with {argCount} arguments is a security risk**
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
### Document.write/writeln
|
|
62
|
+
|
|
63
|
+
#### How to Find the Issue
|
|
64
|
+
|
|
65
|
+
Flag ALL uses of `document.write()` and `document.writeln()`:
|
|
66
|
+
|
|
67
|
+
- **document.write()**: ALL uses - allows HTML injection enabling XSS attacks
|
|
68
|
+
- **document.writeln()**: ALL uses - identical to document.write with newline
|
|
69
|
+
- **Indirect calls**: Bracket notation (`document['write']`), destructuring (`const {write} = document`), aliasing
|
|
70
|
+
- **All contexts**: Loops, conditionals, event handlers, async callbacks, template literals, string concatenation, hidden by unicode escape sequences and Reflection APIs
|
|
71
|
+
|
|
72
|
+
#### How to report the Issue
|
|
73
|
+
|
|
74
|
+
**RuleId: lws-004**
|
|
75
|
+
**level: error**
|
|
76
|
+
**message: Usage of document.write/writeln enables XSS attacks and violates LWS security policies**
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Eval and Dynamic Code Execution
|
|
81
|
+
|
|
82
|
+
#### How to Find the Issue
|
|
83
|
+
|
|
84
|
+
Flag these patterns:
|
|
85
|
+
|
|
86
|
+
- **eval**: ANY usage - code sent to JavaScript eval function is unsafe
|
|
87
|
+
- **Function** / **new Function**: ANY usage - code evaluated via string argument is unsafe
|
|
88
|
+
- **setInterval** / **setTimeout**: ONLY with string arguments (function arguments are safe)
|
|
89
|
+
|
|
90
|
+
#### How to report the Issue
|
|
91
|
+
|
|
92
|
+
**RuleId: lws-005**
|
|
93
|
+
**level: error**
|
|
94
|
+
**message: Usage of {functionName} enables arbitrary code execution**
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### Event Properties
|
|
99
|
+
|
|
100
|
+
#### How to Find the Issue
|
|
101
|
+
|
|
102
|
+
Flag ALL usage of:
|
|
103
|
+
|
|
104
|
+
- `event.originalTarget`
|
|
105
|
+
- `event.explicitOriginalTarget`
|
|
106
|
+
- `Event.prototype.originalTarget`
|
|
107
|
+
- `Event.prototype.explicitOriginalTarget`
|
|
108
|
+
|
|
109
|
+
These properties bypass Lightning Web Security's shadow DOM isolation and expose elements outside the component's security boundary.
|
|
110
|
+
|
|
111
|
+
#### How to report the Issue
|
|
112
|
+
|
|
113
|
+
**RuleId: lws-006**
|
|
114
|
+
**level: error**
|
|
115
|
+
**message: Access to {propertyName} bypasses shadow DOM isolation**
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### Fullscreen API
|
|
120
|
+
|
|
121
|
+
#### How to Find the Issue
|
|
122
|
+
|
|
123
|
+
Flag ALL usage of:
|
|
124
|
+
|
|
125
|
+
- `requestFullscreen()` - Standard method
|
|
126
|
+
- `webkitRequestFullscreen()` - WebKit prefix
|
|
127
|
+
- `mozRequestFullScreen()` - Mozilla prefix (note capital 'S' in 'Screen')
|
|
128
|
+
- `msRequestFullscreen()` - Microsoft prefix
|
|
129
|
+
- String property access containing 'fullscreen' or 'screen'
|
|
130
|
+
- All browser-prefixed versions and all access patterns (direct, dynamic, stored references)
|
|
131
|
+
|
|
132
|
+
#### How to report the Issue
|
|
133
|
+
|
|
134
|
+
**RuleId: lws-007**
|
|
135
|
+
**level: error**
|
|
136
|
+
**message: Fullscreen API usage can be exploited for phishing attacks**
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Global Object Property Assignment
|
|
141
|
+
|
|
142
|
+
#### How to Find the Issue
|
|
143
|
+
|
|
144
|
+
**CRITICAL PREREQUISITE**: Only analyze files that import from 'lwc'. If no 'lwc' import exists, return empty list. If a file has NO import statements at all, skip it entirely.
|
|
145
|
+
|
|
146
|
+
Flag property assignments to: `globalThis`, `window`, `window.top`, `window.parent`, `window.frames`, `document.defaultView`, `self`, or `this` (in global scope).
|
|
147
|
+
|
|
148
|
+
**Examples to Flag**:
|
|
149
|
+
|
|
150
|
+
- `globalThis.myVar = 'hello'`
|
|
151
|
+
- `window.config = { debug: true }`
|
|
152
|
+
- `window.top.config = { debug: true }`
|
|
153
|
+
- `self.data = []`
|
|
154
|
+
- `document.defaultView.property = value`
|
|
155
|
+
|
|
156
|
+
**Do NOT Flag**:
|
|
157
|
+
|
|
158
|
+
- Property reads: `const x = window.location`
|
|
159
|
+
- Local scope assignments: `function foo(window) { window.local = 1 }`
|
|
160
|
+
- Method calls: `window.alert('hello')`
|
|
161
|
+
- Document properties: `document.cookie = 'foo=bar'` (document is not in the flagged list)
|
|
162
|
+
|
|
163
|
+
#### How to report the Issue
|
|
164
|
+
|
|
165
|
+
**RuleId: lws-008**
|
|
166
|
+
**level: error**
|
|
167
|
+
**message: Direct property assignment to global object {objectName} pollutes global namespace**
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
### HTML Body Element Events
|
|
172
|
+
|
|
173
|
+
#### How to Find the Issue
|
|
174
|
+
|
|
175
|
+
Flag document.body event handler usage that creates security vulnerabilities:
|
|
176
|
+
|
|
177
|
+
- `document.body.addEventListener(...)` and `document.body.oneventname = ...` assignments
|
|
178
|
+
- Destructured references: `const { body } = document;` then `body.addEventListener` or `body.oneventname`
|
|
179
|
+
- Bracket notation: `document.body['on' + var]` or `body[eventName]`
|
|
180
|
+
- Unicode escapes: `document.body['\u006f\u006e...']`
|
|
181
|
+
- Reflect patterns: `Reflect.set(document.body, 'onevent', ...)` or `Reflect.apply(document.body.addEventListener, ...)`
|
|
182
|
+
- String concatenation for event names
|
|
183
|
+
|
|
184
|
+
Flag only the actual handler assignment line, not intermediate variable construction. Report ALL occurrences case-sensitively.
|
|
185
|
+
|
|
186
|
+
#### How to report the Issue
|
|
187
|
+
|
|
188
|
+
**RuleId: lws-009**
|
|
189
|
+
**level: error**
|
|
190
|
+
**message: document.body event handler usage leaks sensitive information**
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
### Nonce Access
|
|
195
|
+
|
|
196
|
+
#### How to Find the Issue
|
|
197
|
+
|
|
198
|
+
Flag ALL nonce access on HTMLElement/SVGElement objects. Nonce access enables CSP bypass attacks.
|
|
199
|
+
|
|
200
|
+
**What to Look For**:
|
|
201
|
+
|
|
202
|
+
- **Direct access**: `element.nonce`, `element['nonce']`
|
|
203
|
+
- **getAttribute methods**: `.getAttribute('nonce')`, `.getAttributeNode('nonce')`
|
|
204
|
+
- **Selectors**: `querySelector('[nonce]')`, `querySelectorAll('script[nonce]')`
|
|
205
|
+
- **Variable-based**: `element[prop]`, `getAttribute(attrName)`, string concat/templates
|
|
206
|
+
- **Storage**: `localStorage/sessionStorage.setItem()` with nonce values
|
|
207
|
+
- **Setting**: `element.nonce = value`, `setAttribute('nonce', value)`
|
|
208
|
+
- **Loops**: `forEach`, `map`, `for...of` accessing nonce
|
|
209
|
+
- **Destructuring**: `const { nonce } = element`
|
|
210
|
+
- **Conditionals**: `if (element.nonce)`, `element.nonce || default`
|
|
211
|
+
|
|
212
|
+
#### How to report the Issue
|
|
213
|
+
|
|
214
|
+
**RuleId: lws-010**
|
|
215
|
+
**level: error**
|
|
216
|
+
**message: Nonce access enables CSP bypass attacks**
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
### UIEvent Range Parent
|
|
221
|
+
|
|
222
|
+
#### How to Find the Issue
|
|
223
|
+
|
|
224
|
+
Flag ANY access to `rangeParent` property from event objects including:
|
|
225
|
+
|
|
226
|
+
- Direct access: `event.rangeParent`
|
|
227
|
+
- Chained access: `event.target.rangeParent`
|
|
228
|
+
- Destructuring, obfuscated patterns using unicode escapes, bracket notation, or Reflect APIs
|
|
229
|
+
|
|
230
|
+
#### How to report the Issue
|
|
231
|
+
|
|
232
|
+
**RuleId: lws-011**
|
|
233
|
+
**level: error**
|
|
234
|
+
**message: Access to rangeParent property is forbidden**
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### XSLT Processor
|
|
239
|
+
|
|
240
|
+
#### How to Find the Issue
|
|
241
|
+
|
|
242
|
+
Flag ALL usage of:
|
|
243
|
+
|
|
244
|
+
- `new XSLTProcessor()` - direct instantiation
|
|
245
|
+
- `window.XSLTProcessor` or `const P = XSLTProcessor` - indirect references
|
|
246
|
+
- `Reflect.construct(XSLTProcessor, [])` - reflection-based instantiation
|
|
247
|
+
- `transformToFragment()` and `transformToDocument()` - transformation methods
|
|
248
|
+
- `processor['transformToFragment']` - bracket notation
|
|
249
|
+
- `Reflect.apply()`, `.apply()`, `.call()`, `.bind()` - reflection-based method calls
|
|
250
|
+
|
|
251
|
+
XSLT transformations can generate `<script>` tags, event handlers, and bypass CSP. There is NO safe usage.
|
|
252
|
+
|
|
253
|
+
#### How to report the Issue
|
|
254
|
+
|
|
255
|
+
**RuleId: lws-012**
|
|
256
|
+
**level: error**
|
|
257
|
+
**message: XSLTProcessor usage enables XSS attacks and CSP bypass**
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
### Context Vulnerability
|
|
262
|
+
|
|
263
|
+
#### How to Find the Issue
|
|
264
|
+
|
|
265
|
+
Flag security vulnerabilities where **imported framework classes** are exploited through context manipulation.
|
|
266
|
+
|
|
267
|
+
**CRITICAL**: Imported modules expose framework internals. Static resources via loadScript() are safe.
|
|
268
|
+
|
|
269
|
+
**Patterns to Flag**:
|
|
270
|
+
|
|
271
|
+
1. **Method Context Manipulation**: `.call()`, `.apply()`, `.bind()`, `Reflect.apply()` on imported methods with external context
|
|
272
|
+
|
|
273
|
+
2. **Crafted Fake Context**: Objects mimicking framework structures passed to framework methods
|
|
274
|
+
|
|
275
|
+
3. **Component Extension**: Extending imported framework components to access inherited internals
|
|
276
|
+
|
|
277
|
+
4. **Prototype Manipulation**: `__lookupSetter__()`, `__lookupGetter__()`, `Object.getPrototypeOf()`, `Object.setPrototypeOf()`
|
|
278
|
+
|
|
279
|
+
5. **Internal Property Access**: `.helper`, `.context`, `.owner`, `.navService` on DOM elements/components
|
|
280
|
+
|
|
281
|
+
6. **Hierarchy Traversal**: `getOwner()`, `getContext()` calls or loops traversing object hierarchies
|
|
282
|
+
|
|
283
|
+
7. **Dynamic Creation with Exploited Context**: Using stolen contexts for component creation
|
|
284
|
+
|
|
285
|
+
8. **Complex Invocation Chains**: `Function.prototype.call.apply()` or `Function.prototype.apply.call()`
|
|
286
|
+
|
|
287
|
+
9. **All contexts**: Loops, conditionals, event handlers, async callbacks, template literals, string concatenation, hidden by unicode escape sequences
|
|
288
|
+
|
|
289
|
+
**What to Ignore**:
|
|
290
|
+
|
|
291
|
+
- Standard LWC lifecycle methods
|
|
292
|
+
- Event handlers with proper this binding within same component
|
|
293
|
+
- Built-in JavaScript methods without external context manipulation
|
|
294
|
+
- Code loaded via loadScript() from static resources
|
|
295
|
+
|
|
296
|
+
#### How to report the Issue
|
|
297
|
+
|
|
298
|
+
**RuleId: lws-013**
|
|
299
|
+
**level: error**
|
|
300
|
+
**message: Context manipulation attack on imported framework class**
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
### Document.execCommand
|
|
305
|
+
|
|
306
|
+
#### How to Find the Issue
|
|
307
|
+
|
|
308
|
+
Flag `document.execCommand` with ONLY these dangerous commands:
|
|
309
|
+
|
|
310
|
+
- **insertHTML** - Enables HTML injection and XSS attacks
|
|
311
|
+
- **selectAll** - Can expose sensitive content via clipboard manipulation
|
|
312
|
+
|
|
313
|
+
**Detection Patterns**:
|
|
314
|
+
|
|
315
|
+
- Direct calls: `document.execCommand('insertHTML', ...)`
|
|
316
|
+
- Variables: `document.execCommand(cmdVar, ...)` where cmdVar could be dangerous
|
|
317
|
+
- String concatenation: `'insert' + 'HTML'`
|
|
318
|
+
- Bracket notation: `document['execCommand']('selectAll')`
|
|
319
|
+
- Unicode escape sequences
|
|
320
|
+
|
|
321
|
+
Do NOT flag safe commands (copy, cut, paste, bold, italic, underline, undo, redo).
|
|
322
|
+
|
|
323
|
+
#### How to report the Issue
|
|
324
|
+
|
|
325
|
+
**RuleId: lws-014**
|
|
326
|
+
**level: error**
|
|
327
|
+
**message: document.execCommand with {commandName} enables HTML injection or unauthorized data access**
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
### Insecure HTML Injection (DOM Sinks)
|
|
332
|
+
|
|
333
|
+
#### How to Find the Issue
|
|
334
|
+
|
|
335
|
+
Flag insecure HTML injection patterns through DOM sinks on any element, shadowRoot, or document objects:
|
|
336
|
+
|
|
337
|
+
**What to Look For**:
|
|
338
|
+
|
|
339
|
+
- **innerHTML assignments**: Direct assignment of untrusted content to innerHTML
|
|
340
|
+
- **outerHTML assignments**: Direct assignment of untrusted content to outerHTML
|
|
341
|
+
- **insertAdjacentHTML calls**: Using insertAdjacentHTML with untrusted content
|
|
342
|
+
- **setHTML/setHTMLUnsafe calls**: Using these methods with untrusted content
|
|
343
|
+
- **Dangerous content patterns**:
|
|
344
|
+
- Strings containing iframe elements with srcdoc attributes
|
|
345
|
+
- Strings containing script elements
|
|
346
|
+
- Dynamic HTML construction from variables
|
|
347
|
+
- **textContent with HTML**: Setting textContent to content that contains HTML markup
|
|
348
|
+
- **Any pattern where user input or external data is directly inserted into DOM sinks without proper sanitization**
|
|
349
|
+
|
|
350
|
+
**What to Ignore**:
|
|
351
|
+
|
|
352
|
+
- Safe DOM methods like createElement, appendChild, removeChild
|
|
353
|
+
- Proper use of textContent with plain text (no HTML)
|
|
354
|
+
- LWC template rendering and data binding
|
|
355
|
+
- Standard Lightning component usage
|
|
356
|
+
|
|
357
|
+
#### How to report the Issue
|
|
358
|
+
|
|
359
|
+
**RuleId: lws-015**
|
|
360
|
+
**level: error**
|
|
361
|
+
**message: Insecure HTML injection through {sinkName} enables XSS attacks**
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
### Map and Set Misuse
|
|
366
|
+
|
|
367
|
+
#### How to Find the Issue
|
|
368
|
+
|
|
369
|
+
Flag Map and Set misuse patterns:
|
|
370
|
+
|
|
371
|
+
**Direct Property Access/Assignment (CRITICAL)**:
|
|
372
|
+
|
|
373
|
+
- Using bracket notation: `map[key]` or `set[index]`
|
|
374
|
+
- Assigning with brackets: `map[key] = value` or `set[index] = value`
|
|
375
|
+
|
|
376
|
+
**Serialization Issues**:
|
|
377
|
+
|
|
378
|
+
- Using `JSON.stringify()` on Map or Set directly
|
|
379
|
+
- Passing Map/Set in decorators (e.g., `@wire`, `@track`)
|
|
380
|
+
- Sending Map/Set in event payloads or to child components
|
|
381
|
+
|
|
382
|
+
**Prototype Modification (CRITICAL)**:
|
|
383
|
+
|
|
384
|
+
- Adding properties to `Map.prototype` or `Set.prototype`
|
|
385
|
+
|
|
386
|
+
**What to Ignore**: DOM API usage, code unrelated to Map/Set misuse.
|
|
387
|
+
|
|
388
|
+
#### How to report the Issue
|
|
389
|
+
|
|
390
|
+
**RuleId: lws-016**
|
|
391
|
+
**level: error**
|
|
392
|
+
**message: Improper Map/Set usage bypasses internal data structures**
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
### Mutating Unknown Objects
|
|
397
|
+
|
|
398
|
+
#### How to Find the Issue
|
|
399
|
+
|
|
400
|
+
Flag mutations to objects not owned by the component:
|
|
401
|
+
|
|
402
|
+
**What to Flag**:
|
|
403
|
+
|
|
404
|
+
- **Event object mutations**: `event.detail.value = 'x'`, `event.target.customProp = true`
|
|
405
|
+
- **Parameter mutations**: `processConfig(config) { config.newProp = 'value'; }`
|
|
406
|
+
- **API response mutations**: `wireData.processed = true`, `response.items.customField = 123`
|
|
407
|
+
- **Mutations to properties received via @api**: `this.recordData.processed = true` where recordData is from @api
|
|
408
|
+
- **Non-standard properties on DOM elements**: `element.customProp = 123` (use dataset API instead)
|
|
409
|
+
- **Tracked property mutations**: Mutating wire data or external objects after storing in @track
|
|
410
|
+
- **Prototype/Host Object mutations**: `Array.prototype.custom = fn`, `document.foo = 'x'`
|
|
411
|
+
- **Mutations to objects from inherited methods**: Methods not defined in this component
|
|
412
|
+
|
|
413
|
+
**What to Ignore**:
|
|
414
|
+
|
|
415
|
+
- Objects created and owned by this component (not received from external sources)
|
|
416
|
+
- Standard DOM operations (createElement, appendChild, querySelector, innerHTML, textContent, classList)
|
|
417
|
+
- Standard event handling (addEventListener, removeEventListener)
|
|
418
|
+
- Mutations to cloned/copied objects (`const local = { ...external }; local.prop = 'x';`)
|
|
419
|
+
|
|
420
|
+
#### How to report the Issue
|
|
421
|
+
|
|
422
|
+
**RuleId: lws-017**
|
|
423
|
+
**level: error**
|
|
424
|
+
**message: Mutation of object not owned by component**
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
### Trusted Type Policy Names
|
|
429
|
+
|
|
430
|
+
#### How to Find the Issue
|
|
431
|
+
|
|
432
|
+
Flag `trustedTypes.createPolicy()` with these forbidden names:
|
|
433
|
+
|
|
434
|
+
- `'default'`
|
|
435
|
+
- `''` (empty string)
|
|
436
|
+
- `'lwsInternal'`
|
|
437
|
+
- `'trusted'`
|
|
438
|
+
|
|
439
|
+
Include string literals, variables, string concatenation, computed via unicode escapes, or accessed via Reflect APIs. Ignore policy content (second argument).
|
|
440
|
+
|
|
441
|
+
#### How to report the Issue
|
|
442
|
+
|
|
443
|
+
**RuleId: lws-018**
|
|
444
|
+
**level: error**
|
|
445
|
+
**message: Forbidden Trusted Type policy name '{policyName}' used**
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
### URL.createObjectURL with Restricted MIME Types
|
|
450
|
+
|
|
451
|
+
#### How to Find the Issue
|
|
452
|
+
|
|
453
|
+
Flag `URL.createObjectURL()` with restricted MIME types:
|
|
454
|
+
|
|
455
|
+
**Critical (Blocked)**:
|
|
456
|
+
|
|
457
|
+
- `text/javascript`
|
|
458
|
+
- Empty or undefined MIME types
|
|
459
|
+
|
|
460
|
+
**Warning (Must Be Scanned)**:
|
|
461
|
+
|
|
462
|
+
- `text/html` - Must be scanned for malicious content (script tags, XSS)
|
|
463
|
+
- `image/svg+xml` - Can contain embedded JavaScript
|
|
464
|
+
- `text/xml` - Must be scanned for malicious payloads
|
|
465
|
+
|
|
466
|
+
Trace back to Blob/File creation to extract MIME type. Include variable-based types, string concatenation, and template literals.
|
|
467
|
+
|
|
468
|
+
**Safe MIME Types** (don't flag): `image/*`, `video/*`, `audio/*`, `application/pdf`
|
|
469
|
+
|
|
470
|
+
**Detect Obfuscation**: `'text/' + 'javascript'`, template literals, conditional assignments
|
|
471
|
+
|
|
472
|
+
#### How to report the Issue
|
|
473
|
+
|
|
474
|
+
**RuleId: lws-019a**
|
|
475
|
+
**level: error**
|
|
476
|
+
**message: URL.createObjectURL with blocked MIME type '{mimeType}'**
|
|
477
|
+
|
|
478
|
+
**RuleId: lws-019b**
|
|
479
|
+
**level: warning**
|
|
480
|
+
**message: URL.createObjectURL with MIME type '{mimeType}' requires content scanning**
|
|
481
|
+
|
|
482
|
+
---
|
|
483
|
+
|
|
484
|
+
### URL Schemes
|
|
485
|
+
|
|
486
|
+
#### How to Find the Issue
|
|
487
|
+
|
|
488
|
+
Only `http`, `https`, and `about:blank` are allowed. Flag all disallowed schemes:
|
|
489
|
+
|
|
490
|
+
**Disallowed Schemes**:
|
|
491
|
+
|
|
492
|
+
- **Code Execution**: `javascript:`, `vbscript:` - Code execution, XSS attacks
|
|
493
|
+
- **CSP Bypass**: `data:`, `blob:` - Bypasses CSP, executable content
|
|
494
|
+
- **File System**: `file:` - File system access
|
|
495
|
+
- **Insecure Protocols**: `ftp:`, `ws:` - Insecure protocols
|
|
496
|
+
- **Potentially Exploitable**: `tel:`, `mailto:`
|
|
497
|
+
- **Custom Schemes**: Any non-standard URI schemes
|
|
498
|
+
|
|
499
|
+
**Where to Check**: HTML attributes (href, src, action), JavaScript strings/template literals, URL constructors, window.location/open, element.setAttribute, fetch/XHR URLs.
|
|
500
|
+
|
|
501
|
+
**Important**:
|
|
502
|
+
|
|
503
|
+
- Case insensitive detection (JavaScript:, JAVASCRIPT:)
|
|
504
|
+
- Watch for obfuscated schemes (`'java' + 'script:'`)
|
|
505
|
+
- `about:blank` ONLY allowed as exact literal, not with additional content
|
|
506
|
+
|
|
507
|
+
#### How to report the Issue
|
|
508
|
+
|
|
509
|
+
**RuleId: lws-020**
|
|
510
|
+
**level: error**
|
|
511
|
+
**message: Disallowed URL scheme '{scheme}' detected**
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
### SVG Animate Element Attributes
|
|
516
|
+
|
|
517
|
+
#### How to Find the Issue
|
|
518
|
+
|
|
519
|
+
Flag SVGAnimateElement's `to`, `from`, and `values` attributes containing URL values (`url(...)`).
|
|
520
|
+
|
|
521
|
+
**What to Flag**:
|
|
522
|
+
|
|
523
|
+
- `setAttribute('to', ...)` or `setAttribute('from', ...)` or `setAttribute('values', ...)` where the value contains `url(...)`
|
|
524
|
+
- Variable or template literal values that resolve to strings containing `url(...)`
|
|
525
|
+
|
|
526
|
+
**Critical Rules**:
|
|
527
|
+
|
|
528
|
+
1. **ONLY flag SVGAnimateElement**: The element must be created with `createElementNS('http://www.w3.org/2000/svg', 'animate')`
|
|
529
|
+
2. **ONLY these 3 attributes**: `to`, `from`, `values` - ignore all other attributes
|
|
530
|
+
3. **URL pattern required**: The attribute value must contain `url(...)` pattern
|
|
531
|
+
4. **Empty array if none found**: Return [] if no matches
|
|
532
|
+
|
|
533
|
+
**Note**: Informational only - LWS automatically sanitizes these URL values.
|
|
534
|
+
|
|
535
|
+
#### How to report the Issue
|
|
536
|
+
|
|
537
|
+
**RuleId: lws-021**
|
|
538
|
+
**level: warning**
|
|
539
|
+
**message: SVGAnimateElement attribute '{attributeName}' contains URL value (auto-sanitized by LWS)**
|
|
540
|
+
|
|
541
|
+
---
|
|
542
|
+
|
|
543
|
+
### Script Elements
|
|
544
|
+
|
|
545
|
+
#### How to Find the Issue
|
|
546
|
+
|
|
547
|
+
Flag direct script element creation and manipulation that could enable XSS attacks or CSP bypasses:
|
|
548
|
+
|
|
549
|
+
**What to Look For**:
|
|
550
|
+
|
|
551
|
+
- `document.createElement('script')` or `new HTMLScriptElement()`
|
|
552
|
+
- Script injection via innerHTML/outerHTML/insertAdjacentHTML
|
|
553
|
+
- Setting script.src to dynamic/untrusted URLs, blob URLs, or data URLs
|
|
554
|
+
- Setting script.textContent, script.text, or script.innerHTML with code
|
|
555
|
+
- All contexts: Loops, conditionals, event handlers, async callbacks, template literals, string concatenation, hidden by unicode escape sequences
|
|
556
|
+
|
|
557
|
+
#### How to report the Issue
|
|
558
|
+
|
|
559
|
+
**RuleId: lws-022**
|
|
560
|
+
**level: error**
|
|
561
|
+
**message: Direct script element creation or manipulation enables XSS attacks**
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
### Iframe Security
|
|
566
|
+
|
|
567
|
+
#### How to Find the Issue
|
|
568
|
+
|
|
569
|
+
Flag insecure iframe usage that leads to XSS or mXSS attacks:
|
|
570
|
+
|
|
571
|
+
**BLOCKED - srcdoc Attribute**:
|
|
572
|
+
|
|
573
|
+
- All srcdoc usage is blocked (bypasses CSP)
|
|
574
|
+
- `element.innerHTML = '<iframe srcdoc="..."></iframe>'`
|
|
575
|
+
- `iframe.setAttribute('srcdoc', '<html>...</html>')`
|
|
576
|
+
|
|
577
|
+
**BLOCKED - Dangerous src Protocols** (only http/https allowed):
|
|
578
|
+
|
|
579
|
+
- `javascript:` - `iframe.src = 'javascript:alert(1)'`
|
|
580
|
+
- `data:` - `iframe.src = 'data:text/html,<script>alert(1)</script>'`
|
|
581
|
+
- `blob:` - `iframe.src = URL.createObjectURL(blob)`
|
|
582
|
+
- `vbscript:` - `iframe.src = 'vbscript:msgbox(1)'`
|
|
583
|
+
- `file:` - `iframe.src = 'file:///etc/passwd'`
|
|
584
|
+
|
|
585
|
+
**BLOCKED - mXSS Attacks**:
|
|
586
|
+
|
|
587
|
+
- MathML/SVG/CDATA contexts combined with iframe srcdoc
|
|
588
|
+
- `math.setHTMLUnsafe('<style><!--</style><img src="--><mi><iframe srcdoc=\'...\'></iframe>"/>')`
|
|
589
|
+
- `div.innerHTML = '<svg><desc><iframe srcdoc=\'<script>...</script>\'></iframe></desc></svg>'`
|
|
590
|
+
|
|
591
|
+
**BLOCKED - Obfuscated Protocols**:
|
|
592
|
+
|
|
593
|
+
- Unicode escapes: `iframe.src = '\u006a\u0061\u0076\u0061\u0073\u0063\u0072\u0069\u0070\u0074:alert(1)'`
|
|
594
|
+
- String concatenation: `iframe.src = ('java' + 'script:') + 'alert(1)'`
|
|
595
|
+
|
|
596
|
+
**ALLOWED**: Only http/https protocols
|
|
597
|
+
|
|
598
|
+
- `iframe.src = 'https://trusted-domain.com/content'`
|
|
599
|
+
- `div.innerHTML = '<iframe src="https://example.com"></iframe>'`
|
|
600
|
+
|
|
601
|
+
#### How to report the Issue
|
|
602
|
+
|
|
603
|
+
**RuleId: lws-023a**
|
|
604
|
+
**level: error**
|
|
605
|
+
**message: iframe srcdoc attribute usage bypasses CSP**
|
|
606
|
+
|
|
607
|
+
**RuleId: lws-023b**
|
|
608
|
+
**level: error**
|
|
609
|
+
**message: iframe src with disallowed protocol '{protocol}'**
|
|
610
|
+
|
|
611
|
+
---
|