nehonix-uri-processor
Version:
A powerful URI processor for encoding, decoding, and analyzing URI data securely.
41 lines • 1.22 kB
TypeScript
import { ShieldRule } from "./types/ShieldTypes";
export declare class NSHParser {
private static readonly RULE_SEPARATOR;
private static readonly COMMENT_PREFIX;
private static readonly KNOWN_PROPERTIES;
private static readonly KNOWN_TYPES;
private static readonly KNOWN_CONDITION_TYPES;
private static readonly KNOWN_ACTION_TYPES;
/**
* Parse a .nsh file into ShieldRules
* Example .nsh file format:
*
* # CSP Rule
* type: csp
* priority: 100
* condition:
* type: match_path
* value: /api/*
* action:
* type: modify
* value:
* directive: script-src
* sources: ['https://api.example.com']
* ---
* # CSRF Rule
* type: csrf
* priority: 90
* condition:
* type: match_path
* value: /public/*
* action:
* type: allow
*/
static parseFile(filePath: string): ShieldRule[];
static parseContent(content: string, filePath?: string): ShieldRule[];
private static parseRuleBlock;
private static parseValue;
private static validateRule;
static loadDirectory(dirPath: string): Promise<ShieldRule[]>;
}
//# sourceMappingURL=NSHParser.d.ts.map