/** * Copyright (c) 2025 Ofri Peretz * Licensed under the MIT License. Use of this source code is governed by the * MIT license that can be found in the LICENSE file. */ /** * ESLint Rule: no-improper-type-validation * Detects improper type validation in user input handling (CWE-1287) * * Improper type validation can lead to security vulnerabilities when * user input is not properly validated, allowing attackers to bypass * security checks or cause unexpected behavior. * * False Positive Reduction: * This rule uses security utilities to reduce false positives by detecting: * - Safe type checking patterns * - TypeScript type guards * - Proper validation functions * - JSDoc annotations (@validated, @type-checked) */ import type { TSESLint } from '@interlace/eslint-devkit'; import { type SecurityRuleOptions } from '@interlace/eslint-devkit'; type MessageIds = 'improperTypeValidation' | 'unsafeTypeofCheck' | 'unsafeInstanceofUsage' | 'looseEqualityTypeCheck' | 'missingNullCheck' | 'unreliableConstructorCheck' | 'incompleteTypeValidation' | 'useTypeofCorrectly' | 'useProperTypeGuards' | 'validateUserInput' | 'strategyTypeGuards' | 'strategySchemaValidation' | 'strategyDefensiveProgramming'; export interface Options extends SecurityRuleOptions { /** Variables that contain user input and should be validated */ userInputVariables?: string[]; /** Safe type checking functions */ safeTypeCheckFunctions?: string[]; /** Whether to allow instanceof in same-realm contexts */ allowInstanceofSameRealm?: boolean; } type RuleOptions = [Options?]; export declare const noImproperTypeValidation: TSESLint.RuleModule & { name: string; }; export {};