From 6a9a63e958ecfd3000995bdfb24aca6c6d4a9876 Mon Sep 17 00:00:00 2001 From: jrtilak Date: Tue, 17 Nov 2026 23:33:58 +0545 Subject: [PATCH] feat: add attr-no-protocol-relative-url rule - warn on protocol-relative URLs in src and href - register the optional rule and configuration type - add regression tests and rule documentation - update the tracked build output Fixes #348 --- dist/core/rules/index.js | 6 +- .../rules/attr-no-protocol-relative-url.ts | 31 +++++ src/core/rules/index.ts | 1 + src/core/types.ts | 1 + .../attr-no-protocol-relative-url.spec.js | 126 ++++++++++++++++++ website/src/content/docs/configuration.md | 1 + .../rules/attr-no-protocol-relative-url.mdx | 41 ++++++ website/src/content/docs/rules/index.mdx | 1 + 8 files changed, 206 insertions(+), 2 deletions(-) create mode 100644 src/core/rules/attr-no-protocol-relative-url.ts create mode 100644 test/rules/attr-no-protocol-relative-url.spec.js create mode 100644 website/src/content/docs/rules/attr-no-protocol-relative-url.mdx diff --git a/dist/core/rules/index.js b/dist/core/rules/index.js index 24102c576..4c40a1085 100644 --- a/dist/core/rules/index.js +++ b/dist/core/rules/index.js @@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.titleRequire = exports.tagSelfClose = exports.tagsCheck = exports.tagPair = exports.tagnameSpecialChars = exports.tagnameLowercase = exports.tagNoObsolete = exports.styleDisabled = exports.srcNotEmpty = exports.specCharEscape = exports.spaceTabMixedDisabled = exports.scriptDisabled = exports.metaViewportRequire = exports.metaDescriptionRequire = exports.metaCharsetRequire = exports.mainRequire = exports.linkRelCanonicalRequire = exports.inputRequiresLabel = exports.inlineStyleDisabled = exports.inlineScriptDisabled = exports.idUnique = exports.idClassValue = exports.idClassAdDisabled = exports.htmlLangRequire = exports.hrefAbsOrRel = exports.headScriptDisabled = exports.h1Require = exports.frameTitleRequire = exports.formMethodRequire = exports.emptyTagNotSelfClosed = exports.doctypeHTML5 = exports.doctypeFirst = exports.buttonTypeRequire = exports.attrWhitespace = exports.attrValueSingleQuotes = exports.attrValueNotEmpty = exports.attrValueDoubleQuotes = exports.attrUnsafeChars = exports.attrSort = exports.attrValueNoDuplication = exports.attrNoUnnecessaryWhitespace = exports.attrNoDuplication = exports.attrLowercase = exports.altRequire = void 0; +exports.titleRequire = exports.tagSelfClose = exports.tagsCheck = exports.tagPair = exports.tagnameSpecialChars = exports.tagnameLowercase = exports.tagNoObsolete = exports.styleDisabled = exports.srcNotEmpty = exports.specCharEscape = exports.spaceTabMixedDisabled = exports.scriptDisabled = exports.metaViewportRequire = exports.metaDescriptionRequire = exports.metaCharsetRequire = exports.mainRequire = exports.linkRelCanonicalRequire = exports.inputRequiresLabel = exports.inlineStyleDisabled = exports.inlineScriptDisabled = exports.idUnique = exports.idClassValue = exports.idClassAdDisabled = exports.htmlLangRequire = exports.hrefAbsOrRel = exports.headScriptDisabled = exports.h1Require = exports.frameTitleRequire = exports.formMethodRequire = exports.emptyTagNotSelfClosed = exports.doctypeHTML5 = exports.doctypeFirst = exports.buttonTypeRequire = exports.attrWhitespace = exports.attrValueSingleQuotes = exports.attrValueNotEmpty = exports.attrValueDoubleQuotes = exports.attrUnsafeChars = exports.attrSort = exports.attrValueNoDuplication = exports.attrNoUnnecessaryWhitespace = exports.attrNoProtocolRelativeUrl = exports.attrNoDuplication = exports.attrLowercase = exports.altRequire = void 0; var alt_require_1 = require("./alt-require"); Object.defineProperty(exports, "altRequire", { enumerable: true, get: function () { return __importDefault(alt_require_1).default; } }); var attr_lowercase_1 = require("./attr-lowercase"); Object.defineProperty(exports, "attrLowercase", { enumerable: true, get: function () { return __importDefault(attr_lowercase_1).default; } }); var attr_no_duplication_1 = require("./attr-no-duplication"); Object.defineProperty(exports, "attrNoDuplication", { enumerable: true, get: function () { return __importDefault(attr_no_duplication_1).default; } }); +var attr_no_protocol_relative_url_1 = require("./attr-no-protocol-relative-url"); +Object.defineProperty(exports, "attrNoProtocolRelativeUrl", { enumerable: true, get: function () { return __importDefault(attr_no_protocol_relative_url_1).default; } }); var attr_no_unnecessary_whitespace_1 = require("./attr-no-unnecessary-whitespace"); Object.defineProperty(exports, "attrNoUnnecessaryWhitespace", { enumerable: true, get: function () { return __importDefault(attr_no_unnecessary_whitespace_1).default; } }); var attr_value_no_duplication_1 = require("./attr-value-no-duplication"); @@ -92,4 +94,4 @@ var tag_self_close_1 = require("./tag-self-close"); Object.defineProperty(exports, "tagSelfClose", { enumerable: true, get: function () { return __importDefault(tag_self_close_1).default; } }); var title_require_1 = require("./title-require"); Object.defineProperty(exports, "titleRequire", { enumerable: true, get: function () { return __importDefault(title_require_1).default; } }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29yZS9ydWxlcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSw2Q0FBcUQ7QUFBNUMsMEhBQUEsT0FBTyxPQUFjO0FBQzlCLG1EQUEyRDtBQUFsRCxnSUFBQSxPQUFPLE9BQWlCO0FBQ2pDLDZEQUFvRTtBQUEzRCx5SUFBQSxPQUFPLE9BQXFCO0FBQ3JDLG1GQUF5RjtBQUFoRiw4SkFBQSxPQUFPLE9BQStCO0FBQy9DLHlFQUErRTtBQUF0RSxvSkFBQSxPQUFPLE9BQTBCO0FBQzFDLDZDQUFtRDtBQUExQyx3SEFBQSxPQUFPLE9BQVk7QUFDNUIseURBQWdFO0FBQXZELHFJQUFBLE9BQU8sT0FBbUI7QUFDbkMsdUVBQTZFO0FBQXBFLGtKQUFBLE9BQU8sT0FBeUI7QUFDekMsK0RBQXFFO0FBQTVELDBJQUFBLE9BQU8sT0FBcUI7QUFDckMsdUVBQTZFO0FBQXBFLGtKQUFBLE9BQU8sT0FBeUI7QUFDekMscURBQTZEO0FBQXBELGtJQUFBLE9BQU8sT0FBa0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tBQUF4RSxzSkFBQSxPQUFPLE9BQTJCO0FBQzNDLCtDQUF1RDtBQUE5Qyw0SEFBQSxPQUFPLE9BQWU7QUFDL0IsK0RBQXNFO0FBQTdELDJJQUFBLE9BQU8sT0FBc0I7QUFDdEMsdUVBQThFO0FBQXJFLG1KQUFBLE9BQU8sT0FBMEI7QUFDMUMsaUVBQXdFO0FBQS9ELDZJQUFBLE9BQU8sT0FBdUI7QUFDdkMscURBQTZEO0FBQXBELGtJQUFBLE9BQU8sT0FBa0I7QUFDbEMsdUVBQTZFO0FBQXBFLGtKQUFBLE9BQU8sT0FBeUI7QUFDekMsdURBQThEO0FBQXJELG1JQUFBLE9BQU8sT0FBa0I7QUFDbEMsaURBQXdEO0FBQS9DLDZIQUFBLE9BQU8sT0FBZTtBQUMvQixtREFBMkQ7QUFBbEQsZ0lBQUEsT0FBTyxPQUFpQjtBQUNqQyxxREFBNEQ7QUFBbkQsaUlBQUEsT0FBTyxPQUFpQjtBQUNqQyx5REFBaUU7QUFBeEQsc0lBQUEsT0FBTyxPQUFvQjtBQUNwQywrREFBdUU7QUFBOUQsNElBQUEsT0FBTyxPQUF1QjtBQUN2Qyx1Q0FBK0M7QUFBdEMsb0hBQUEsT0FBTyxPQUFXO0FBQzNCLDJDQUFtRDtBQUExQyx3SEFBQSxPQUFPLE9BQWE7QUFDN0IsbURBQTBEO0FBQWpELCtIQUFBLE9BQU8sT0FBZ0I7QUFDaEMsaURBQXlEO0FBQWhELDhIQUFBLE9BQU8sT0FBZ0IifQ== \ No newline at end of file diff --git a/src/core/rules/attr-no-protocol-relative-url.ts b/src/core/rules/attr-no-protocol-relative-url.ts new file mode 100644 index 000000000..e59d47e3f --- /dev/null +++ b/src/core/rules/attr-no-protocol-relative-url.ts @@ -0,0 +1,31 @@ +import { Rule } from '../types' + +export default { + id: 'attr-no-protocol-relative-url', + description: + 'The src and href attributes must not use protocol-relative URLs.', + init(parser, reporter) { + parser.addListener('tagstart', (event) => { + const col = event.col + event.tagName.length + 1 + + for (const attr of event.attrs) { + const attrName = attr.name.toLowerCase() + + if ( + (attrName === 'src' || attrName === 'href') && + // Match // after optional leading whitespace, e.g. "//cdn.example.com" + // or " //cdn.example.com", but not "https://cdn.example.com" or "/app.js". + /^\s*\/\//.test(attr.value) + ) { + reporter.warn( + `The ${attr.name} attribute must use an explicit protocol instead of a protocol-relative URL.`, + event.line, + col + attr.index, + this, + attr.raw + ) + } + } + }) + }, +} as Rule diff --git a/src/core/rules/index.ts b/src/core/rules/index.ts index 3669d4244..e0bc2a0ed 100644 --- a/src/core/rules/index.ts +++ b/src/core/rules/index.ts @@ -1,6 +1,7 @@ export { default as altRequire } from './alt-require' export { default as attrLowercase } from './attr-lowercase' export { default as attrNoDuplication } from './attr-no-duplication' +export { default as attrNoProtocolRelativeUrl } from './attr-no-protocol-relative-url' export { default as attrNoUnnecessaryWhitespace } from './attr-no-unnecessary-whitespace' export { default as attrValueNoDuplication } from './attr-value-no-duplication' export { default as attrSort } from './attr-sorted' diff --git a/src/core/types.ts b/src/core/types.ts index e4b6d83fd..97005d697 100644 --- a/src/core/types.ts +++ b/src/core/types.ts @@ -11,6 +11,7 @@ export interface Ruleset { 'alt-require'?: boolean 'attr-lowercase'?: boolean | Array 'attr-no-duplication'?: boolean + 'attr-no-protocol-relative-url'?: boolean 'attr-no-unnecessary-whitespace'?: boolean 'attr-sorted'?: boolean 'attr-unsafe-chars'?: boolean diff --git a/test/rules/attr-no-protocol-relative-url.spec.js b/test/rules/attr-no-protocol-relative-url.spec.js new file mode 100644 index 000000000..40a27c62d --- /dev/null +++ b/test/rules/attr-no-protocol-relative-url.spec.js @@ -0,0 +1,126 @@ +const HTMLHint = require('../../dist/htmlhint.js').HTMLHint + +const ruleId = 'attr-no-protocol-relative-url' +const ruleOptions = { [ruleId]: true } + +describe(`Rules: ${ruleId}`, () => { + it('warns for the script and stylesheet examples from issue #348', () => { + const code = + '\n' + + '' + const messages = HTMLHint.verify(code, ruleOptions) + + expect(messages).toHaveLength(2) + expect(messages[0]).toMatchObject({ + type: 'warning', + line: 1, + col: 8, + rule: { id: ruleId }, + raw: ' src="//ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"', + message: + 'The src attribute must use an explicit protocol instead of a protocol-relative URL.', + }) + expect(messages[1]).toMatchObject({ + type: 'warning', + line: 2, + col: 23, + rule: { id: ruleId }, + }) + }) + + it.each(['src', 'SRC', 'sRc', 'href', 'HREF', 'hReF'])( + 'checks the %s attribute regardless of case', + (name) => { + const messages = HTMLHint.verify( + ``, + ruleOptions + ) + expect(messages).toHaveLength(1) + expect(messages[0].rule.id).toBe(ruleId) + } + ) + + it.each([' ', '\t', '\n', '\r\n', '\f', ' \t\n '])( + 'warns with leading whitespace %j', + (whitespace) => { + const code = `` + expect(HTMLHint.verify(code, ruleOptions)).toHaveLength(1) + } + ) + + it.each([ + '', + "Link", + ])('checks single-quoted and unquoted values: %s', (code) => { + expect(HTMLHint.verify(code, ruleOptions)).toHaveLength(1) + }) + + describe.each(['src', 'href'])('allowed %s values', (name) => { + it.each([ + 'https://example.com/app.js', + 'http://example.com/app.js', + '/assets/app.js', + './app.js', + '../app.js', + 'app.js', + '#content', + '?page=2', + 'mailto:hello@example.com', + 'tel:123456789', + 'data:image/png;base64,AA', + '/redirect?url=//example.com', + ' https://example.com/app.js', + '', + ' ', + ])('allows %j', (value) => { + const code = `` + expect(HTMLHint.verify(code, ruleOptions)).toHaveLength(0) + }) + }) + + it('allows missing attributes and attributes without values', () => { + expect(HTMLHint.verify('', ruleOptions)).toHaveLength( + 0 + ) + }) + + it('ignores other attributes and CSS URLs', () => { + const code = + '' + + '
' + + '
' + + '' + expect(HTMLHint.verify(code, ruleOptions)).toHaveLength(0) + }) + + it('reports every offending attribute', () => { + const code = + 'Link' + const messages = HTMLHint.verify(code, ruleOptions) + expect(messages).toHaveLength(2) + expect(messages[0].raw).toBe(' src="//example.com/a.jpg"') + expect(messages[1].raw).toBe(' href="//example.com"') + }) + + it('reports the location of an attribute on a multiline tag', () => { + const code = '' + const messages = HTMLHint.verify(code, ruleOptions) + expect(messages).toHaveLength(1) + expect(messages[0]).toMatchObject({ + line: 3, + col: 1, + rule: { id: ruleId }, + }) + }) + + it('can be disabled explicitly', () => { + const code = '' + expect(HTMLHint.verify(code, { [ruleId]: false })).toHaveLength(0) + }) + + it('is disabled by default', () => { + const code = '' + const messages = HTMLHint.verify(code) + expect(messages.some((message) => message.rule.id === ruleId)).toBe(false) + }) +}) diff --git a/website/src/content/docs/configuration.md b/website/src/content/docs/configuration.md index 6511869c3..026305db2 100644 --- a/website/src/content/docs/configuration.md +++ b/website/src/content/docs/configuration.md @@ -105,6 +105,7 @@ An example configuration file (with all rules disabled): "alt-require": false, "attr-lowercase": false, "attr-no-duplication": false, + "attr-no-protocol-relative-url": false, "attr-no-unnecessary-whitespace": false, "attr-sorted": false, "attr-unsafe-chars": false, diff --git a/website/src/content/docs/rules/attr-no-protocol-relative-url.mdx b/website/src/content/docs/rules/attr-no-protocol-relative-url.mdx new file mode 100644 index 000000000..bd4a5d074 --- /dev/null +++ b/website/src/content/docs/rules/attr-no-protocol-relative-url.mdx @@ -0,0 +1,41 @@ +--- +id: attr-no-protocol-relative-url +title: attr-no-protocol-relative-url +description: Disallows protocol-relative URLs in src and href attributes. +pagefind: false +sidebar: + badge: New +--- + +import { Badge } from '@astrojs/starlight/components'; + +The `src` and `href` attributes must not use URLs starting with `//`, including after leading whitespace. + +Level: + +## Config value + +- `true`: enable rule +- `false`: disable rule (default) + +### The following patterns are **not** considered rule violations + +```html + + +About +``` + +### The following patterns are considered rule violations + +```html + + +``` + +## Why this rule is important + +Protocol-relative URLs can load resources over HTTP. The [Google HTML/CSS Style Guide](https://google.github.io/styleguide/htmlcssguide.html#Protocol) recommends explicit HTTPS URLs when available. diff --git a/website/src/content/docs/rules/index.mdx b/website/src/content/docs/rules/index.mdx index 9cc32a4ab..ee8e9598f 100644 --- a/website/src/content/docs/rules/index.mdx +++ b/website/src/content/docs/rules/index.mdx @@ -22,6 +22,7 @@ description: A complete list of all the rules for HTMLHint - [`alt-require`](alt-require/): The alt attribute of an img element must be present and alt attribute of area[href] and input[type=image] must have a value. - [`attr-lowercase`](attr-lowercase/): All attribute names must be in lowercase. - [`attr-no-duplication`](attr-no-duplication/): Elements cannot have duplicate attributes. +- [`attr-no-protocol-relative-url`](attr-no-protocol-relative-url/): The src and href attributes must not use protocol-relative URLs. - [`attr-no-unnecessary-whitespace`](attr-no-unnecessary-whitespace/): No spaces between attribute names and values. - [`attr-sorted`](attr-sorted/): Attributes should be sorted in order. - [`attr-unsafe-chars`](attr-unsafe-chars/): Attribute values cannot contain unsafe chars.