-
Notifications
You must be signed in to change notification settings - Fork 142
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
Update GitLab claim mappings for build configs #1206
Update GitLab claim mappings for build configs #1206
Conversation
Assigns new `pipeline_ref/sha` claims to `Build Config` and `Build Signer` related OIDs. Depends on https://gitlab.com/gitlab-org/gitlab/-/merge_requests/121597 Related to sigstore#1182 Signed-off-by: marshall007 <[email protected]>
e4ac946
to
2e6c0aa
Compare
@wlynch @feelepxyz I believe this captures everything we discussed in our sync call last week:
Let me know if I missed anything! |
Should we update the mapping table as part of this PR? https://github.com/sigstore/fulcio/blob/main/docs/oid-info.md#mapping-oidc-token-claims-to-fulcio-oids |
@marshall007 yes this sounds right to me! Thanks for putting this together so quick. Do you have a timeline for enabling the
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM pending Build Signer URI timing + doc updates.
@feelepxyz I responded in #1206 (comment). Should be 16.1 which is in about two weeks. |
Signed-off-by: marshall007 <[email protected]>
Let's circle back in a week or two then for approving and merging this once it's in GitLab? |
Signed-off-by: marshall007 <[email protected]>
Signed-off-by: marshall007 <[email protected]>
The corresponding change on the GitLab side has been merged: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/122373 @feelepxyz @haydentherapper we started enabling the feature flag in non-production environments today and expect rollout to production gitlab.com to be completed by the end of the week. |
Fantastic! Can you test this against the non-production environment to confirm the certificates generated contain the expected values? We'll get this merged once the change is out in production. |
Signed-off-by: marshall007 <[email protected]>
@haydentherapper do you have rights to approve the ci runs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 💯
@marshall007 Some changes are required in diff --git a/pkg/server/grpc_server_test.go b/pkg/server/grpc_server_test.go
index 854d87a..6b477b1 100644
--- a/pkg/server/grpc_server_test.go
+++ b/pkg/server/grpc_server_test.go
@@ -956,6 +956,8 @@ type gitlabClaims struct {
ProjectID string `json:"project_id"`
PipelineSource string `json:"pipeline_source"`
PipelineID string `json:"pipeline_id"`
+ CiConfigRefURI string `json:"ci_config_ref_uri"`
+ CiConfigSha string `json:"ci_config_sha"`
NamespacePath string `json:"namespace_path"`
NamespaceID string `json:"namespace_id"`
JobID string `json:"job_id"`
@@ -989,6 +991,8 @@ func TestAPIWithGitLab(t *testing.T) {
ProjectID: "42831435",
PipelineSource: "push",
PipelineID: "757451528",
+ CiConfigRefURI: "gitlab.com/cpanato/testing-cosign//.gitlab-ci.yml@refs/heads/main",
+ CiConfigSha: "714a629c0b401fdce83e847fc9589983fc6f46bc",
NamespacePath: "cpanato",
NamespaceID: "1730270",
JobID: "3659681386",
@@ -1051,7 +1055,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//.gitlab-ci.yml@refs/heads/%s", claims.ProjectPath, claims.Ref)
gitLabURI, err := url.Parse(gitLabURL)
if err != nil {
t.Fatalf("failed to parse expected url")
@@ -1061,7 +1065,8 @@ func TestAPIWithGitLab(t *testing.T) {
}
url := "https://gitlab.com/"
expectedExts := map[int]string{
- 9: url + claims.ProjectPath + "/-/jobs/" + claims.JobID,
+ 9: gitLabURL,
+ 10: claims.CiConfigSha,
11: claims.RunnerEnvironment,
12: url + claims.ProjectPath,
13: claims.Sha,
@@ -1069,8 +1074,10 @@ func TestAPIWithGitLab(t *testing.T) {
15: claims.ProjectID,
16: url + claims.NamespacePath,
17: claims.NamespaceID,
+ 18: gitLabURL,
+ 19: claims.CiConfigSha,
20: claims.PipelineSource,
- 21: url + claims.ProjectPath + "/-/pipelines/" + claims.PipelineID,
+ 21: url + claims.ProjectPath + "/-/jobs/" + claims.JobID,
}
for o, value := range expectedExts {
ext, found := findCustomExtension(leafCert, asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 57264, 1, o})
|
This change is now live on GitLab.com. |
Awesome! Excited to get this in. |
Can you check out the test failure @marshall007 ? |
Signed-off-by: marshall007 <[email protected]>
@feelepxyz @haydentherapper sorry for the delay! I was out for the holiday weekend and got sick back-to-back. I've applied @aladh's patch and the tests are passing locally.
@haydentherapper I believe last time we merged first and then tested GitLab CI against the staging Fulcio instance. Is that an option this time around? I won't have the bandwidth to standup the required infrastructure and run a manual e2e test on my own this week or next. If you insist I can see if others on my team can support that. I'm told these docs are a good starting point, is that right? https://github.com/sigstore/scaffolding |
pkg/server/grpc_server_test.go
Outdated
@@ -1051,26 +1055,29 @@ 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) | |||
baseUrl := "https://gitlab.com/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the linter isn't happy with baseUrl
, perhaps just switch to baseURL
?
I'm about to cut a new release and roll out to staging so if we can turn this around quickly it can be included in that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
baseUrl := "https://gitlab.com/" | |
baseURL := "https://gitlab.com/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marshall007 Just one question and a linter failure.
If you could update the linter failure, I'll get this merged and we'll cut a new release to test in staging.
Signed-off-by: marshall007 <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1206 +/- ##
==========================================
+ Coverage 56.18% 56.34% +0.15%
==========================================
Files 50 50
Lines 2903 2941 +38
==========================================
+ Hits 1631 1657 +26
- Misses 1129 1138 +9
- Partials 143 146 +3
|
Summary
Assigns new
pipeline_ref/sha
claims toBuild Config
andBuild Signer
related OIDs.Note this depends on addition of new claims upstream, which should land in GitLab v16.1: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/121597
Related to discussion in #1182
Release Note
Documentation