/** * 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-unlimited-resource-allocation * Detects unlimited resource allocation vulnerabilities (CWE-770) * * Unlimited resource allocation can cause denial of service by exhausting * system resources like memory, file handles, or network connections. * This rule detects patterns where resources are allocated without limits. * * False Positive Reduction: * This rule uses security utilities to reduce false positives by detecting: * - Safe resource allocation patterns * - Proper resource limits * - JSDoc annotations (@limited-resource, @safe-allocation) * - Resource cleanup patterns */ import type { TSESLint } from '@interlace/eslint-devkit'; import { type SecurityRuleOptions } from '@interlace/eslint-devkit'; type MessageIds = 'unlimitedResourceAllocation' | 'unlimitedBufferAllocation' | 'unlimitedFileOperations' | 'unlimitedNetworkConnections' | 'unlimitedMemoryAllocation' | 'userControlledResourceSize' | 'missingResourceLimits' | 'resourceAllocationInLoop' | 'implementResourceLimits' | 'validateResourceSize' | 'useResourcePools' | 'strategyResourceManagement' | 'strategyRateLimiting' | 'strategyResourceCleanup'; export interface Options extends SecurityRuleOptions { /** Maximum allowed resource size for static analysis */ maxResourceSize?: number; /** Variables that contain user input */ userInputVariables?: string[]; /** Safe resource allocation functions */ safeResourceFunctions?: string[]; /** Require resource validation */ requireResourceValidation?: boolean; } type RuleOptions = [Options?]; export declare const noUnlimitedResourceAllocation: TSESLint.RuleModule & { name: string; }; export {};