fase(5): findings module complete
Some checks failed
ABE Exploratory Testing / explore (push) Has been cancelled

This commit is contained in:
debian
2026-03-05 04:06:45 -05:00
parent 96bf6e5097
commit d62bd615bf
55 changed files with 2424 additions and 48 deletions

View File

@@ -0,0 +1,33 @@
import { ValueObject } from '../../../../shared/domain/ValueObject';
import { IHttpResponse } from '../../../../core/interfaces';
interface EvidenceProps {
screenshotPath?: string;
domSnapshotPath?: string;
httpLog?: IHttpResponse[];
rawErrors?: string[];
}
export class Evidence extends ValueObject<EvidenceProps> {
static create(props: EvidenceProps): Evidence {
return new Evidence(props);
}
static empty(): Evidence {
return new Evidence({});
}
get screenshotPath(): string | undefined { return this.props.screenshotPath; }
get domSnapshotPath(): string | undefined { return this.props.domSnapshotPath; }
get httpLog(): IHttpResponse[] { return this.props.httpLog ?? []; }
get rawErrors(): string[] { return this.props.rawErrors ?? []; }
toJSON(): EvidenceProps {
return {
screenshotPath: this.props.screenshotPath,
domSnapshotPath: this.props.domSnapshotPath,
httpLog: this.props.httpLog,
rawErrors: this.props.rawErrors,
};
}
}

View File

@@ -0,0 +1,28 @@
import { ValueObject } from '../../../../shared/domain/ValueObject';
type StatusValue = 'open' | 'investigating' | 'resolved' | 'closed';
interface FindingStatusProps {
value: StatusValue;
}
export class FindingStatus extends ValueObject<FindingStatusProps> {
static readonly VALUES: StatusValue[] = ['open', 'investigating', 'resolved', 'closed'];
static open(): FindingStatus { return new FindingStatus({ value: 'open' }); }
static investigating(): FindingStatus { return new FindingStatus({ value: 'investigating' }); }
static resolved(): FindingStatus { return new FindingStatus({ value: 'resolved' }); }
static closed(): FindingStatus { return new FindingStatus({ value: 'closed' }); }
static fromString(s: string): FindingStatus {
if (!FindingStatus.VALUES.includes(s as StatusValue)) {
throw new Error(`Invalid finding status: ${s}`);
}
return new FindingStatus({ value: s as StatusValue });
}
get value(): StatusValue { return this.props.value; }
isOpen(): boolean { return this.props.value === 'open'; }
isResolved(): boolean { return this.props.value === 'resolved'; }
}

View File

@@ -0,0 +1,36 @@
import { ValueObject } from '../../../../shared/domain/ValueObject';
import { AnomalyType } from '../../../../core/interfaces';
interface FindingTypeProps {
value: AnomalyType;
}
export class FindingType extends ValueObject<FindingTypeProps> {
static readonly TYPES: AnomalyType[] = [
'http_error',
'js_exception',
'console_error',
'navigation_fail',
'element_missing',
'timeout',
'validation_bypass',
'server_error_on_fuzz',
'xss_reflection',
'visual_regression',
'accessibility_violation',
'mobile_layout_issue',
'performance_degradation',
'offline_handling_missing',
'slow_network_no_feedback',
'external_service_crash',
];
static fromString(s: string): FindingType {
if (!FindingType.TYPES.includes(s as AnomalyType)) {
throw new Error(`Invalid finding type: ${s}`);
}
return new FindingType({ value: s as AnomalyType });
}
get value(): AnomalyType { return this.props.value; }
}

View File

@@ -0,0 +1,25 @@
import { ValueObject } from '../../../../shared/domain/ValueObject';
type SeverityLevel = 'low' | 'medium' | 'high' | 'critical';
interface SeverityProps {
value: SeverityLevel;
}
export class Severity extends ValueObject<SeverityProps> {
static readonly LEVELS: SeverityLevel[] = ['low', 'medium', 'high', 'critical'];
static low(): Severity { return new Severity({ value: 'low' }); }
static medium(): Severity { return new Severity({ value: 'medium' }); }
static high(): Severity { return new Severity({ value: 'high' }); }
static critical(): Severity { return new Severity({ value: 'critical' }); }
static fromString(s: string): Severity {
if (!Severity.LEVELS.includes(s as SeverityLevel)) {
throw new Error(`Invalid severity: ${s}`);
}
return new Severity({ value: s as SeverityLevel });
}
get value(): SeverityLevel { return this.props.value; }
}