Skip to content

Commit 6fd8037

Browse files
committed
Default policy now defaults to SLSA0
Signed-off-by: Adolfo García Veytia (Puerco) <puerco@carabiner.dev>
1 parent a9b8bd7 commit 6fd8037

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

pkg/policy/policy.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func createDefaultBranchPolicy(branch *models.Branch) *ProtectedBranch {
5151
return &ProtectedBranch{
5252
Name: branch.Name,
5353
Since: timestamppb.Now(),
54-
TargetSlsaSourceLevel: string(slsa.SlsaSourceLevel1),
54+
TargetSlsaSourceLevel: string(slsa.SlsaSourceLevel0),
5555
RequireReview: false,
5656
}
5757
}
@@ -338,13 +338,22 @@ func laterTime(time1, time2 time.Time) time.Time {
338338

339339
// Computes the time since these controls have been eligible for the level, nil if not eligible.
340340
func ComputeEligibleSince(controls *slsa.ControlSet, level slsa.SlsaSourceLevel) (*time.Time, error) {
341+
// Get the required controls for the taget SLSA level
341342
requiredControls := slsa.GetRequiredControlsForLevel(level)
342343
var newestTime time.Time
344+
// Range the controls and get the latest time. This is the time when
345+
// the repo started being elegible for the target level
343346
for _, rc := range requiredControls {
344347
ac := controls.GetControl(rc)
345348
if ac == nil {
349+
// TODO(puerco): Here we should report which controls are missing
350+
// to inform the user somehow.
346351
return nil, nil
347352
}
353+
354+
// If a control is missing it since date, then ignore it for "ElegibleSince"
355+
// computation. Here we have a problem on how we compute since for provenance.
356+
// See https://github.com/slsa-framework/source-tool/issues/365
348357
since := ac.GetSince()
349358
if since == nil {
350359
continue

0 commit comments

Comments
 (0)