@@ -13,6 +13,7 @@ final class EvidenceRepository
|
||||
->where('s.status', 'approved')->where('s.purpose', 'investment_information')
|
||||
->where('s.valid_until', '>=', now()->toDateString())->where('s.source_date', '<=', now()->toDateString())
|
||||
->where('d.status', 'active')->whereNull('d.deleted_at')->whereIn('d.data_classification', ['public', 'internal'])
|
||||
->where('d.malware_scan_status', 'clean')->whereColumn('d.malware_scanned_sha256', 'd.sha256')
|
||||
->whereColumn('s.document_version', 'd.version_no')->whereColumn('s.document_checksum', 'd.sha256');
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ final class SourceIngestion
|
||||
{
|
||||
return DB::transaction(function () use ($data, $actor): string {
|
||||
$document = DB::table('documents')->where('id', $data['document_id'])->whereNull('deleted_at')->lockForUpdate()->first();
|
||||
if (! $document || $document->status !== 'active' || $document->media_type !== 'text/plain'
|
||||
if (! $document || $document->status !== 'active' || $document->malware_scan_status !== 'clean'
|
||||
|| ! hash_equals(trim($document->sha256), trim((string) $document->malware_scanned_sha256)) || $document->media_type !== 'text/plain'
|
||||
|| ! in_array($document->data_classification, ['public', 'internal'], true)) {
|
||||
throw ValidationException::withMessages(['document_id' => 'Documento activo de texto autorizado necessário; fontes confidenciais/restritas não são admitidas.']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user