Skip to content

Commit 50abb65

Browse files
Revert "If custom server url exists, use that instead of the default one. (#1…" (#1791)
This reverts commit bc852fd.
1 parent 7242408 commit 50abb65

File tree

2 files changed

+1
-56
lines changed

2 files changed

+1
-56
lines changed

pkg/identity/github/principal.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"context"
1919
"crypto/x509"
2020
"errors"
21-
"fmt"
2221
"net/url"
2322

2423
"github.com/coreos/go-oidc/v3/oidc"
@@ -106,7 +105,6 @@ func WorkflowPrincipalFromIDToken(_ context.Context, token *oidc.IDToken) (ident
106105
WorkflowSha string `json:"workflow_sha"`
107106
RunID string `json:"run_id"`
108107
RunAttempt string `json:"run_attempt"`
109-
Enterprise string `json:"enterprise"`
110108
}
111109
if err := token.Claims(&claims); err != nil {
112110
return nil, err
@@ -161,16 +159,10 @@ func WorkflowPrincipalFromIDToken(_ context.Context, token *oidc.IDToken) (ident
161159
return nil, errors.New("missing run_attempt claim in ID token")
162160
}
163161

164-
baseURL := `https://github.com/`
165-
166-
if claims.Enterprise != "" {
167-
baseURL = fmt.Sprintf("https://%s.ghe.com/", claims.Enterprise)
168-
}
169-
170162
return &workflowPrincipal{
171163
subject: token.Subject,
172164
issuer: token.Issuer,
173-
url: baseURL,
165+
url: `https://github.com/`,
174166
sha: claims.Sha,
175167
eventName: claims.EventName,
176168
repository: claims.Repository,

pkg/identity/github/principal_test.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -84,53 +84,6 @@ func TestWorkflowPrincipalFromIDToken(t *testing.T) {
8484
},
8585
WantErr: false,
8686
},
87-
`Valid token, custom base url authenticates with correct claims`: {
88-
Claims: map[string]interface{}{
89-
"aud": "sigstore",
90-
"event_name": "push",
91-
"exp": 0,
92-
"iss": "https://token.actions.githubusercontent.com",
93-
"job_workflow_ref": "sigstore/fulcio/.github/workflows/foo.yaml@refs/heads/main",
94-
"job_workflow_sha": "example-sha",
95-
"ref": "refs/heads/main",
96-
"repository": "sigstore/fulcio",
97-
"repository_id": "12345",
98-
"repository_owner": "username",
99-
"repository_owner_id": "345",
100-
"repository_visibility": "public",
101-
"run_attempt": "1",
102-
"run_id": "42",
103-
"runner_environment": "cloud-hosted",
104-
"sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
105-
"sub": "repo:sigstore/fulcio:ref:refs/heads/main",
106-
"workflow": "foo",
107-
"workflow_ref": "sigstore/other/.github/workflows/foo.yaml@refs/heads/main",
108-
"workflow_sha": "example-sha-other",
109-
"enterprise": "test",
110-
},
111-
ExpectPrincipal: workflowPrincipal{
112-
issuer: "https://token.actions.githubusercontent.com",
113-
subject: "repo:sigstore/fulcio:ref:refs/heads/main",
114-
url: "https://test.ghe.com/",
115-
jobWorkflowRef: "sigstore/fulcio/.github/workflows/foo.yaml@refs/heads/main",
116-
sha: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
117-
eventName: "push",
118-
repository: "sigstore/fulcio",
119-
workflow: "foo",
120-
ref: "refs/heads/main",
121-
jobWorkflowSha: "example-sha",
122-
runnerEnvironment: "cloud-hosted",
123-
repositoryID: "12345",
124-
repositoryOwner: "username",
125-
repositoryOwnerID: "345",
126-
repositoryVisibility: "public",
127-
workflowRef: "sigstore/other/.github/workflows/foo.yaml@refs/heads/main",
128-
workflowSha: "example-sha-other",
129-
runID: "42",
130-
runAttempt: "1",
131-
},
132-
WantErr: false,
133-
},
13487
`Token missing job_workflow_ref claim should be rejected`: {
13588
Claims: map[string]interface{}{
13689
"aud": "sigstore",

0 commit comments

Comments
 (0)