Skip to content

Commit

Permalink
fix cert.URIs (#1144)
Browse files Browse the repository at this point in the history
Signed-off-by: cpanato <ctadeu@gmail.com>
  • Loading branch information
cpanato committed May 3, 2023
1 parent 13dcf39 commit 3d45d3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/identity/gitlabcom/principal.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (p jobPrincipal) Embed(_ context.Context, cert *x509.Certificate) error {
}

// Set workflow ref URL to SubjectAlternativeName on certificate
cert.URIs = []*url.URL{baseURL.JoinPath(p.repository, "@", p.ref)}
cert.URIs = []*url.URL{baseURL.JoinPath(fmt.Sprintf("%s@%s", p.repository, p.ref))}

// Embed additional information into custom extensions
cert.ExtraExtensions, err = certificate.Extensions{
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/grpc_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ func TestAPIWithGitLab(t *testing.T) {
t.Fatalf("unexpected length of leaf certificate URIs, expected 1, got %d", len(leafCert.URIs))
}

gitLabURL := fmt.Sprintf("https://gitlab.com/%s/@/refs/heads/%s", claims.ProjectPath, claims.Ref)
gitLabURL := fmt.Sprintf("https://gitlab.com/%s@refs/heads/%s", claims.ProjectPath, claims.Ref)
gitLabURI, err := url.Parse(gitLabURL)
if err != nil {
t.Fatalf("failed to parse expected url")
Expand Down

0 comments on commit 3d45d3e

Please sign in to comment.