finish secrets finding work and audit remarks work save
This commit is contained in:
@@ -101,6 +101,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
request.SourceType,
|
||||
request.Configuration,
|
||||
createdBy,
|
||||
_timeProvider,
|
||||
request.Description,
|
||||
request.AuthRef,
|
||||
request.CronSchedule,
|
||||
@@ -158,7 +159,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
throw new ArgumentException($"Invalid configuration: {string.Join(", ", validationResult.Errors)}");
|
||||
}
|
||||
|
||||
source.UpdateConfiguration(request.Configuration, updatedBy);
|
||||
source.UpdateConfiguration(request.Configuration, updatedBy, _timeProvider);
|
||||
}
|
||||
|
||||
// Validate cron schedule if provided
|
||||
@@ -177,7 +178,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
}
|
||||
|
||||
source.CronSchedule = request.CronSchedule;
|
||||
source.CalculateNextScheduledRun();
|
||||
source.CalculateNextScheduledRun(_timeProvider);
|
||||
}
|
||||
|
||||
// Update simple fields via reflection (maintaining encapsulation)
|
||||
@@ -199,7 +200,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
if (request.CronTimezone != null)
|
||||
{
|
||||
source.CronTimezone = request.CronTimezone;
|
||||
source.CalculateNextScheduledRun();
|
||||
source.CalculateNextScheduledRun(_timeProvider);
|
||||
}
|
||||
|
||||
if (request.MaxScansPerHour.HasValue)
|
||||
@@ -265,6 +266,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
request.SourceType,
|
||||
request.Configuration,
|
||||
"__test__",
|
||||
_timeProvider,
|
||||
authRef: request.AuthRef);
|
||||
|
||||
return await _connectionTester.TestAsync(tempSource, request.TestCredentials, ct);
|
||||
@@ -280,7 +282,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
var source = await _sourceRepository.GetByIdAsync(tenantId, sourceId, ct)
|
||||
?? throw new KeyNotFoundException($"Source {sourceId} not found");
|
||||
|
||||
source.Pause(request.Reason, request.Ticket, pausedBy);
|
||||
source.Pause(request.Reason, request.Ticket, pausedBy, _timeProvider);
|
||||
await _sourceRepository.UpdateAsync(source, ct);
|
||||
|
||||
_logger.LogInformation(
|
||||
@@ -299,7 +301,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
var source = await _sourceRepository.GetByIdAsync(tenantId, sourceId, ct)
|
||||
?? throw new KeyNotFoundException($"Source {sourceId} not found");
|
||||
|
||||
source.Resume(resumedBy);
|
||||
source.Resume(resumedBy, _timeProvider);
|
||||
await _sourceRepository.UpdateAsync(source, ct);
|
||||
|
||||
_logger.LogInformation(
|
||||
@@ -330,7 +332,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
throw new InvalidOperationException($"Source is paused: {source.PauseReason}");
|
||||
}
|
||||
|
||||
if (source.IsRateLimited() && request?.Force != true)
|
||||
if (source.IsRateLimited(_timeProvider) && request?.Force != true)
|
||||
{
|
||||
throw new InvalidOperationException("Source is rate limited. Use force=true to override.");
|
||||
}
|
||||
@@ -341,6 +343,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
tenantId,
|
||||
SbomSourceRunTrigger.Manual,
|
||||
Guid.NewGuid().ToString("N"),
|
||||
_timeProvider,
|
||||
$"Triggered by {triggeredBy}");
|
||||
|
||||
await _runRepository.CreateAsync(run, ct);
|
||||
@@ -407,7 +410,7 @@ public sealed class SbomSourceService : ISbomSourceService
|
||||
var source = await _sourceRepository.GetByIdAsync(tenantId, sourceId, ct)
|
||||
?? throw new KeyNotFoundException($"Source {sourceId} not found");
|
||||
|
||||
source.Activate(activatedBy);
|
||||
source.Activate(activatedBy, _timeProvider);
|
||||
await _sourceRepository.UpdateAsync(source, ct);
|
||||
|
||||
_logger.LogInformation(
|
||||
|
||||
Reference in New Issue
Block a user