Skip to content

Linter: Implement html-validate-elements-attributes linter rule#357

Draft
marcoroth wants to merge 1 commit intomainfrom
html-validate-elements-attributes
Draft

Linter: Implement html-validate-elements-attributes linter rule#357
marcoroth wants to merge 1 commit intomainfrom
html-validate-elements-attributes

Conversation

@marcoroth
Copy link
Owner

No description provided.

@marcoroth marcoroth force-pushed the html-validate-elements-attributes branch 2 times, most recently from a98b1c1 to d406431 Compare August 8, 2025 21:41
@marcoroth marcoroth force-pushed the html-validate-elements-attributes branch from d406431 to de72fe1 Compare August 14, 2025 11:38
}

if (value.startsWith('mailto:') || value.startsWith('tel:') || value.startsWith('sms:') ||
value.startsWith('data:') || value.startsWith('javascript:')) {

Check failure

Code scanning / CodeQL

Incomplete URL scheme check High

This check does not consider vbscript:.

Copilot Autofix

AI 7 months ago

To fix the problem, we should update the conditional on line 159-160 to include vbscript: in the list of schemes that are considered valid. This means adding value.startsWith('vbscript:') to the conditional. This change should be made in the file javascript/packages/linter/src/rules/utils/html-attribute-value-validators.ts, specifically in the block starting at line 159. No additional imports or definitions are required, as this is a simple string comparison.

Suggested changeset 1
javascript/packages/linter/src/rules/utils/html-attribute-value-validators.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/javascript/packages/linter/src/rules/utils/html-attribute-value-validators.ts b/javascript/packages/linter/src/rules/utils/html-attribute-value-validators.ts
--- a/javascript/packages/linter/src/rules/utils/html-attribute-value-validators.ts
+++ b/javascript/packages/linter/src/rules/utils/html-attribute-value-validators.ts
@@ -157,7 +157,7 @@
     }
 
     if (value.startsWith('mailto:') || value.startsWith('tel:') || value.startsWith('sms:') ||
-        value.startsWith('data:') || value.startsWith('javascript:')) {
+        value.startsWith('data:') || value.startsWith('javascript:') || value.startsWith('vbscript:')) {
       return { valid: true }
     }
 
EOF
@@ -157,7 +157,7 @@
}

if (value.startsWith('mailto:') || value.startsWith('tel:') || value.startsWith('sms:') ||
value.startsWith('data:') || value.startsWith('javascript:')) {
value.startsWith('data:') || value.startsWith('javascript:') || value.startsWith('vbscript:')) {
return { valid: true }
}

Copilot is powered by AI and may make mistakes. Always verify output.
@marcoroth marcoroth changed the title Add html-validate-elements-attributes linter rule Linter: Add html-validate-elements-attributes linter rule Oct 8, 2025
@marcoroth marcoroth changed the title Linter: Add html-validate-elements-attributes linter rule Linter: Implement html-validate-elements-attributes linter rule Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant