Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundleVerified Flag Not Set After Successful Rekor Online Verification in Cosign #3740

Closed
maxlambrecht opened this issue Jun 18, 2024 · 0 comments · Fixed by #3745
Closed
Labels
bug Something isn't working

Comments

@maxlambrecht
Copy link
Contributor

maxlambrecht commented Jun 18, 2024

Description

The bundleVerified flag is not being set to true following a successful online verification using Rekor, as seen in the code snippet below.

if !co.IgnoreTlog {
    bundleVerified, err = VerifyBundle(sig, co)
    if err != nil {
        return false, fmt.Errorf("error verifying bundle: %w", err)
    }

    if bundleVerified {
        // Update with the verified bundle's integrated time.
        t, err := getBundleIntegratedTime(sig)
        if err != nil {
            return false, fmt.Errorf("error getting bundle integrated time: %w", err)
        }
        acceptableRekorBundleTime = &t
    } else {
        // If the --offline flag was specified, fail here. bundleVerified returns false with
        // no error when there was no bundle provided.
        if co.Offline {
            return false, fmt.Errorf("offline verification failed")
        }

        // no Rekor client provided for an online lookup
        if co.RekorClient == nil {
            return false, fmt.Errorf("rekor client not provided for online verification")
        }

        pemBytes, err := keyBytes(sig, co)
        if err != nil {
            return false, err
        }

        e, err := tlogValidateEntry(ctx, co.RekorClient, co.RekorPubKeys, sig, pemBytes)
        if err != nil {
            return false, err
        }
        t := time.Unix(*e.IntegratedTime, 0)
        acceptableRekorBundleTime = &t
    }
}

Expected Behavior:
In the else branch of the verification logic, if the Rekor verification succeeds, the bundleVerified should be set to true.

Version

2.2.4

@maxlambrecht maxlambrecht added the bug Something isn't working label Jun 18, 2024
@maxlambrecht maxlambrecht changed the title Clarification on bundleVerified Logic in Cosign Verification bundleVerified Flag Not Set After Successful Rekor Online Verification in Cosign Jun 22, 2024
maxlambrecht added a commit to maxlambrecht/cosign that referenced this issue Jun 22, 2024
…e#3740)

Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
maxlambrecht added a commit to maxlambrecht/cosign that referenced this issue Jun 29, 2024
…e#3740)

Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant