/** * 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: detect-non-literal-fs-filename * Detects variable in filename argument of fs calls, which might allow an attacker to access anything on your system * LLM-optimized with comprehensive path traversal prevention guidance * * @see https://owasp.org/www-community/attacks/Path_Traversal * @see https://cwe.mitre.org/data/definitions/22.html */ import type { TSESLint } from '@interlace/eslint-devkit'; type MessageIds = 'fsPathTraversal' | 'usePathResolve' | 'validatePath' | 'useBasename' | 'createSafeDir' | 'whitelistExtensions'; export interface Options { /** Allow literal strings. Default: false (stricter) */ allowLiterals?: boolean; /** Additional fs methods to check */ additionalMethods?: string[]; } type RuleOptions = [Options?]; export declare const detectNonLiteralFsFilename: TSESLint.RuleModule & { name: string; }; export {};