@flamesshield/rules-engine
Version:
Independent rules engine for security analysis of Firebase
72 lines • 2.31 kB
TypeScript
/**
* RuleValidator - Phase 1 Implementation
*
* Validates rules against EnrichedProjectInformation to ensure:
* - Rules reference valid paths
* - Rules use correct operators
*
* Following TDD approach with minimal implementation to pass initial tests.
*/
import type { ValidationResult } from '../types/validation.js';
import type { EnrichedProjectInformation } from '../types/index.js';
export declare class FactPathValidator {
validateFactPaths(rules: any[], facts: any): ({
ruleId: any;
status: string;
error: string;
} | {
ruleId: any;
status: string;
error?: never;
})[];
}
export declare class RuleValidator {
/**
* Validates a rule against the given project information
*/
validateRule(rule: any, projectInfo: EnrichedProjectInformation): ValidationResult;
/**
* Creates validation context from project information
*/
private createValidationContext;
/**
* Recursively adds paths from an object to the available paths set
*/
private addPathsFromObject;
/**
* Validates paths in a condition string
*/
private validateConditionPaths;
/**
* Check for deprecated paths in condition string
*/
private checkDeprecatedPaths;
/**
* Validates json-rules-engine conditions object (with 'all' or 'any' arrays)
*/
private validateConditionsObject;
/**
* Validates a single condition object with fact, operator, value
*/
private validateSingleCondition;
/**
* Check for deprecated paths in conditions object
*/
private checkDeprecatedPathsInConditions;
/**
* Discovers all available paths from project structure
* Phase 2: Public method for path discovery
*/
discoverPaths(projectInfo: EnrichedProjectInformation): Set<string>;
/**
* Gets type information for all discovered paths
* Phase 2: Public method for type mapping
*/
getPathTypeMap(projectInfo: EnrichedProjectInformation): Map<string, string>;
/**
* Identifies deprecated direct access paths
* Phase 2: Public method for deprecated path detection
*/
getDeprecatedPaths(projectInfo: EnrichedProjectInformation): Set<string>;
}
//# sourceMappingURL=rule-validator.d.ts.map