endpoint-sentinel
Version:
User-friendly security scanner with interactive setup that scales from beginner to expert
178 lines • 6.8 kB
TypeScript
/**
* Core type definitions for Endpoint Sentinel
* Provides comprehensive typing for the security scanner system
*/
export interface ScanConfig {
target: string;
keywords?: string[];
cookie?: string;
output?: string;
consent: boolean;
rateLimit?: number;
timeout?: number;
userAgent?: string;
maxRedirects?: number;
concurrent?: number;
verbose?: boolean;
}
export interface Endpoint {
readonly url: string;
readonly method: HttpMethod;
readonly parameters?: Record<string, unknown>;
readonly headers?: Record<string, string>;
readonly discovered: Date;
readonly source: EndpointSource;
}
export interface ScanContext {
readonly config: ScanConfig;
readonly sessionId: string;
readonly startTime: Date;
readonly cookies: CookieJar;
readonly rateLimiter: RateLimiter;
readonly logger: Logger;
}
export interface HttpRequest {
readonly url: string;
readonly method: HttpMethod;
readonly headers: Record<string, string>;
readonly data?: unknown;
readonly timeout: number;
}
export interface HttpResponse {
readonly status: number;
readonly statusText: string;
readonly headers: Record<string, string>;
readonly data: string;
readonly responseTime: number;
readonly size: number;
}
export interface Finding {
readonly id: string;
readonly endpoint: string;
readonly type: VulnerabilityType;
readonly severity: Severity;
readonly confidence: Confidence;
readonly title: string;
readonly description: string;
readonly evidence: Evidence[];
readonly remediation: string;
readonly cweId?: number;
readonly cvssScore?: number;
readonly discoveredAt: Date;
}
export interface Evidence {
readonly type: EvidenceType;
readonly value: string;
readonly location?: string;
readonly context?: string;
}
export interface VulnerabilityProof {
readonly type: VulnerabilityType;
readonly severity: Severity;
readonly confidence: number;
readonly evidence: Evidence[];
readonly remediation: RemediationAdvice;
readonly exploitability: ExploitabilityLevel;
}
export interface RemediationAdvice {
readonly summary: string;
readonly steps: string[];
readonly references: string[];
readonly priority: Priority;
}
export interface ScannerModule {
readonly name: string;
readonly version: string;
readonly description: string;
readonly category: ModuleCategory;
analyze(endpoint: Endpoint, context: ScanContext): Promise<Finding[]>;
getMetadata(): ModuleMetadata;
isApplicable(endpoint: Endpoint): boolean;
}
export interface ModuleMetadata {
readonly name: string;
readonly version: string;
readonly author: string;
readonly description: string;
readonly tags: string[];
readonly vulnerabilityTypes: VulnerabilityType[];
}
export interface RateLimiter {
throttle(request: HttpRequest): Promise<void>;
getStats(): RateLimitStats;
updateLimits(requestsPerSecond: number, burstSize: number): void;
}
export interface RateLimitStats {
readonly requestsPerSecond: number;
readonly burstSize: number;
readonly tokensAvailable: number;
readonly lastRefill: Date;
readonly totalRequests: number;
readonly throttledRequests: number;
}
export interface Logger {
info(message: string, meta?: Record<string, unknown>): void;
warn(message: string, meta?: Record<string, unknown>): void;
error(message: string, error?: Error, meta?: Record<string, unknown>): void;
debug(message: string, meta?: Record<string, unknown>): void;
audit(event: AuditEvent): void;
}
export interface AuditEvent {
readonly eventType: AuditEventType;
readonly timestamp: Date;
readonly sessionId: string;
readonly target: string;
readonly details: Record<string, unknown>;
readonly userId?: string;
}
export interface CookieJar {
setCookie(cookie: string, url: string): void;
getCookies(url: string): string[];
serialize(): string;
clear(): void;
}
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
export type Severity = 'info' | 'low' | 'medium' | 'high' | 'critical';
export type Confidence = 'tentative' | 'firm' | 'certain';
export type Priority = 'low' | 'medium' | 'high' | 'urgent';
export type EndpointSource = 'html_links' | 'javascript_routes' | 'api_discovery' | 'sitemap' | 'robots_txt' | 'wordlist' | 'manual';
export type VulnerabilityType = 'missing_security_headers' | 'information_disclosure' | 'authentication_bypass' | 'authorization_failure' | 'injection_vulnerability' | 'cross_site_scripting' | 'cross_site_request_forgery' | 'insecure_direct_object_reference' | 'security_misconfiguration' | 'broken_access_control' | 'cryptographic_failure' | 'server_side_request_forgery' | 'xml_external_entity' | 'deserialization_vulnerability' | 'component_vulnerability' | 'logging_monitoring_failure' | 'business_logic_flaw';
export type EvidenceType = 'http_response' | 'http_request' | 'header_analysis' | 'content_analysis' | 'javascript_analysis' | 'redirect_chain' | 'timing_analysis' | 'error_message';
export type ExploitabilityLevel = 'low' | 'medium' | 'high' | 'critical';
export type ModuleCategory = 'discovery' | 'authentication' | 'authorization' | 'injection' | 'configuration' | 'information' | 'business_logic';
export type AuditEventType = 'scan_started' | 'scan_completed' | 'endpoint_discovered' | 'vulnerability_found' | 'error_occurred' | 'rate_limit_triggered' | 'consent_granted' | 'scan_terminated';
export type AuthScheme = 'none' | 'basic' | 'bearer_token' | 'jwt' | 'oauth2' | 'session_cookie' | 'api_key' | 'custom';
export interface ScanResults {
readonly sessionId: string;
readonly target: string;
readonly startTime: Date;
readonly endTime: Date;
readonly duration: number;
readonly endpointsDiscovered: number;
readonly findings: Finding[];
readonly summary: ScanSummary;
readonly metadata: ScanMetadata;
}
export interface ScanSummary {
readonly totalFindings: number;
readonly criticalFindings: number;
readonly highFindings: number;
readonly mediumFindings: number;
readonly lowFindings: number;
readonly infoFindings: number;
readonly falsePositiveRate: number;
}
export interface ScanMetadata {
readonly version: string;
readonly modulesUsed: string[];
readonly configUsed: Partial<ScanConfig>;
readonly performance: PerformanceMetrics;
}
export interface PerformanceMetrics {
readonly requestsSent: number;
readonly requestsPerSecond: number;
readonly averageResponseTime: number;
readonly memoryUsage: number;
readonly errorRate: number;
}
//# sourceMappingURL=scanner.d.ts.map