import { ConformancePatternRule , ErrorCode , PatternKind } from '../../third_party/tsetse/rules/conformance_pattern_rule' ; import { RuleConfiguration } from '../../rule_configuration' ; let errMsg = 'Do not modify HTMLBaseElement#href elements, as this can compromise all other efforts to sanitize unsafe URLs and lead to XSS.' ; /**
 * A Rule that looks for dynamic assignments to HTMLBaseElement#href property.
 * With this property modified, every URL in the page becomes unsafe.
 * Developers should avoid writing to this property.
 */ export class Rule extends ConformancePatternRule { static readonly RULE_NAME = 'ban-base-href-assignments' ; constructor ( configuration = { } ) { super ( { errorCode : ErrorCode . CONFORMANCE_PATTERN , errorMessage : errMsg , kind : PatternKind . BANNED_PROPERTY_WRITE , values : [ 'HTMLBaseElement.prototype.href' ] , name : Rule . RULE_NAME , ... configuration } ) ; } }