the validationlab.eu marketing site: 3 audience pages (en) + legal skeletons, i18n scaffold (25 locales, subdirectory scheme), structured frontmatter blocks, Zoho Flow lead forms with capability tagging + honeypot, sitemap/hreflang/JSON-LD/robots, cookie-gated analytics plumbing
This commit is contained in:
1 parent
95af7107d0
commit
477bf5114f
1076 files changed
+227743
-110
No files matched your search
+136
@@ -0,0 +1,136 @@
|
||||
/*!
|
||||
* Sitemap
|
||||
* Copyright(c) 2011 Eugene Kalinin
|
||||
* MIT Licensed
|
||||
*/
|
||||
import { ErrorLevel, EnumChangefreq, EnumYesNo, EnumAllowDeny } from './types.js';
|
||||
import type { SitemapItem, PriceType, Resolution, ErrorHandler, LinkItem } from './types.js';
|
||||
export declare const validators: {
|
||||
[index: string]: RegExp;
|
||||
};
|
||||
/**
|
||||
* Type guard to check if a string is a valid price type
|
||||
*/
|
||||
export declare function isPriceType(pt: string | PriceType): pt is PriceType;
|
||||
/**
|
||||
* Type guard to check if a string is a valid resolution
|
||||
*/
|
||||
export declare function isResolution(res: string): res is Resolution;
|
||||
export declare function isValidChangeFreq(freq: string): freq is EnumChangefreq;
|
||||
/**
|
||||
* Type guard to check if a string is a valid yes/no value
|
||||
*/
|
||||
export declare function isValidYesNo(yn: string): yn is EnumYesNo;
|
||||
/**
|
||||
* Checks that a priority is a finite number within sitemaps.org bounds (0–1)
|
||||
*/
|
||||
export declare function isValidPriority(priority: unknown): boolean;
|
||||
/**
|
||||
* Checks that a video duration is a finite number of seconds within Google's
|
||||
* video sitemap bounds (0–28800)
|
||||
*/
|
||||
export declare function isValidVideoDuration(duration: number): boolean;
|
||||
/**
|
||||
* Checks that a video rating is a finite number within Google's video sitemap
|
||||
* bounds (0–5)
|
||||
*/
|
||||
export declare function isValidVideoRating(rating: number): boolean;
|
||||
/**
|
||||
* Checks that a video view count is a finite, non-negative number
|
||||
*/
|
||||
export declare function isValidVideoViewCount(count: number): boolean;
|
||||
/**
|
||||
* Checks that a date string is in ISO 8601 / W3C format
|
||||
*/
|
||||
export declare function isValidISODate(date: string): boolean;
|
||||
/**
|
||||
* Returns an alternate link's language (`lang`, else `hreflang`), or
|
||||
* `undefined` when neither is a non-empty string. Validation reports such a
|
||||
* link, and the writer drops it.
|
||||
*/
|
||||
export declare function getLinkHreflang(link: LinkItem): string | undefined;
|
||||
/**
|
||||
* Type guard to check if a string is a valid allow/deny value
|
||||
*/
|
||||
export declare function isAllowDeny(ad: string): ad is EnumAllowDeny;
|
||||
/**
|
||||
* Validates that a URL is well-formed and meets security requirements
|
||||
*
|
||||
* Security: This function enforces that URLs use safe protocols (http/https),
|
||||
* are within reasonable length limits (2048 chars per sitemaps.org spec),
|
||||
* and can be properly parsed. This prevents protocol injection attacks and
|
||||
* ensures compliance with sitemap specifications.
|
||||
*
|
||||
* @param url - The URL to validate
|
||||
* @param paramName - The parameter name for error messages
|
||||
* @throws {InvalidURLError} If the URL is invalid (a subclass of InvalidHostnameError)
|
||||
*/
|
||||
export declare function validateURL(url: string, paramName: string): void;
|
||||
/**
|
||||
* Runs validateURL and returns its error message instead of throwing, for
|
||||
* parsers that report invalid values and keep going.
|
||||
*
|
||||
* @returns The validation error message, or undefined if the URL is valid
|
||||
*/
|
||||
export declare function getURLError(url: string, paramName: string): string | undefined;
|
||||
/**
|
||||
* Validates that a path doesn't contain path traversal sequences
|
||||
*
|
||||
* Security: This function prevents path traversal attacks by detecting
|
||||
* any occurrence of '..' in the path, whether it appears as '../', '/..',
|
||||
* or standalone. This prevents attackers from accessing files outside
|
||||
* the intended directory structure.
|
||||
*
|
||||
* @param path - The path to validate
|
||||
* @param paramName - The parameter name for error messages
|
||||
* @throws {InvalidPathError} If the path contains traversal sequences
|
||||
*/
|
||||
export declare function validatePath(path: string, paramName: string): void;
|
||||
/**
|
||||
* Validates that a public base path is safe for URL construction
|
||||
*
|
||||
* Security: This function prevents path traversal attacks and validates
|
||||
* that the path is safe for use in URL construction within sitemap indexes.
|
||||
* It checks for '..' sequences, null bytes, and invalid whitespace that
|
||||
* could be used to manipulate URL structure or inject malicious content.
|
||||
*
|
||||
* @param publicBasePath - The public base path to validate
|
||||
* @throws {InvalidPublicBasePathError} If the path is invalid
|
||||
*/
|
||||
export declare function validatePublicBasePath(publicBasePath: string): void;
|
||||
/**
|
||||
* Validates that a limit is within acceptable range per sitemaps.org spec
|
||||
*
|
||||
* Security: This function enforces sitemap size limits (1-50,000 URLs per
|
||||
* sitemap) as specified by sitemaps.org. This prevents resource exhaustion
|
||||
* attacks and ensures compliance with search engine requirements.
|
||||
*
|
||||
* @param limit - The limit to validate
|
||||
* @throws {InvalidLimitError} If the limit is out of range
|
||||
*/
|
||||
export declare function validateLimit(limit: number): void;
|
||||
/**
|
||||
* Whether `n` is a valid parser entry cap: a non-negative integer, or
|
||||
* `Infinity` for no cap. Unlike validateLimit, 0 and values above the
|
||||
* sitemaps.org limit are allowed.
|
||||
*/
|
||||
export declare function isValidMaxEntries(n: number): boolean;
|
||||
/**
|
||||
* Validates that an XSL URL is safe and well-formed
|
||||
*
|
||||
* Security: This function validates XSL stylesheet URLs to prevent
|
||||
* injection attacks. It blocks dangerous protocols and content patterns
|
||||
* that could be used for XSS or other attacks. The validation uses
|
||||
* case-insensitive matching to catch obfuscated attacks.
|
||||
*
|
||||
* @param xslUrl - The XSL URL to validate
|
||||
* @throws {InvalidXSLUrlError} If the URL is invalid
|
||||
*/
|
||||
export declare function validateXSLUrl(xslUrl: string): void;
|
||||
/**
|
||||
* Verifies all data passed in will comply with sitemap spec.
|
||||
* @param conf Options to validate
|
||||
* @param level logging level
|
||||
* @param errorHandler error handling func
|
||||
*/
|
||||
export declare function validateSMIOptions(conf: SitemapItem, level?: ErrorLevel, errorHandler?: ErrorHandler): SitemapItem;
|
||||
Reference in new issue
Block a user