Skip to content

Commit

Permalink
GitHub subjects look different to URIs
Browse files Browse the repository at this point in the history
  • Loading branch information
sj26 committed Jan 16, 2023
1 parent 3f76ae3 commit fd1a2f1
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/server/grpc_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,11 +711,11 @@ func TestAPIWithGitHub(t *testing.T) {
JobWorkflowRef: "job/workflow/ref",
Sha: "sha",
Trigger: "trigger",
Repository: "repo",
Repository: "sigstore/fulcio",
Workflow: "workflow",
Ref: "ref",
Ref: "refs/heads/main",
}
githubSubject := fmt.Sprintf("https://github.com/%s", claims.JobWorkflowRef)
githubSubject := fmt.Sprintf("repo:%s:ref:%s", claims.Repository, claims.Ref)

// Create an OIDC token using this issuer's signer.
tok, err := jwt.Signed(githubSigner).Claims(jwt.Claims{
Expand Down Expand Up @@ -767,12 +767,13 @@ func TestAPIWithGitHub(t *testing.T) {
if len(leafCert.URIs) != 1 {
t.Fatalf("unexpected length of leaf certificate URIs, expected 1, got %d", len(leafCert.URIs))
}
uSubject, err := url.Parse(githubSubject)
githubUrl := fmt.Sprintf("https://github.com/%s", claims.JobWorkflowRef)
githubUri, err := url.Parse(githubUrl)
if err != nil {
t.Fatalf("failed to parse subject URI")
t.Fatalf("failed to parse expected url")
}
if *leafCert.URIs[0] != *uSubject {
t.Fatalf("subjects do not match: Expected %v, got %v", uSubject, leafCert.URIs[0])
if *leafCert.URIs[0] != *githubUri {
t.Fatalf("URIs do not match: Expected %v, got %v", githubUri, leafCert.URIs[0])
}
// Verify custom OID values
triggerExt, found := findCustomExtension(leafCert, asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 57264, 1, 2})
Expand Down

0 comments on commit fd1a2f1

Please sign in to comment.