@@ -21,7 +21,6 @@ import (
2121 "encoding/json"
2222 "errors"
2323 "fmt"
24- "html/template"
2524 "net/http"
2625 "net/url"
2726 "os"
@@ -32,7 +31,6 @@ import (
3231
3332 "github.com/coreos/go-oidc/v3/oidc"
3433 lru "github.com/hashicorp/golang-lru"
35- "github.com/sigstore/fulcio/pkg/certificate"
3634 fulciogrpc "github.com/sigstore/fulcio/pkg/generated/protobuf"
3735 "github.com/sigstore/fulcio/pkg/log"
3836 "github.com/spiffe/go-spiffe/v2/spiffeid"
@@ -62,33 +60,12 @@ type FulcioConfig struct {
6260 // * https://container.googleapis.com/v1/projects/mattmoor-credit/locations/us-west1-b/clusters/tenant-cluster
6361 MetaIssuers map [string ]OIDCIssuer `json:"MetaIssuers,omitempty" yaml:"meta-issuers,omitempty"`
6462
65- // It defines metadata to be used for the CIProvider identity provider principal.
66- // The CI provider has a generic logic for ci providers, this metadata is used
67- // to define the right behavior for each ci provider that is defined
68- // on the configuration file
69- CIIssuerMetadata map [string ]IssuerMetadata `json:"CIIssuerMetadata,omitempty" yaml:"ci-issuer-metadata,omitempty"`
70-
7163 // verifiers is a fixed mapping from our OIDCIssuers to their OIDC verifiers.
7264 verifiers map [string ][]* verifierWithConfig
7365 // lru is an LRU cache of recently used verifiers for our meta issuers.
7466 lru * lru.TwoQueueCache
7567}
7668
77- type IssuerMetadata struct {
78- // Defaults contains key-value pairs that can be used for filling the templates from ExtensionTemplates
79- // If a key cannot be found on the token claims, the template will use the defaults
80- DefaultTemplateValues map [string ]string `json:"DefaultTemplateValues,omitempty" yaml:"default-template-values,omitempty"`
81- // ExtensionTemplates contains a mapping between certificate extension and token claim
82- // Provide either strings following https://pkg.go.dev/text/template syntax,
83- // e.g "{{ .url }}/{{ .repository }}"
84- // or non-templated strings with token claim keys to be replaced,
85- // e.g "job_workflow_sha"
86- ExtensionTemplates certificate.Extensions `json:"ExtensionTemplates,omitempty" yaml:"extension-templates,omitempty"`
87- // Template for the Subject Alternative Name extension
88- // It's typically the same value as Build Signer URI
89- SubjectAlternativeNameTemplate string `json:"SubjectAlternativeNameTemplate,omitempty" yaml:"subject-alternative-name-template,omitempty"`
90- }
91-
9269type OIDCIssuer struct {
9370 // The expected issuer of an OIDC token
9471 IssuerURL string `json:"IssuerURL,omitempty" yaml:"issuer-url,omitempty"`
@@ -97,8 +74,6 @@ type OIDCIssuer struct {
9774 // Used to determine the subject of the certificate and if additional
9875 // certificate values are needed
9976 Type IssuerType `json:"Type" yaml:"type,omitempty"`
100- // CIProvider is an optional configuration to map token claims to extensions for CI workflows
101- CIProvider string `json:"CIProvider,omitempty" yaml:"ci-provider,omitempty"`
10277 // Optional, if the issuer is in a different claim in the OIDC token
10378 IssuerClaim string `json:"IssuerClaim,omitempty" yaml:"issuer-claim,omitempty"`
10479 // The domain that must be present in the subject for 'uri' issuer types
@@ -309,7 +284,6 @@ const (
309284 IssuerTypeSpiffe = "spiffe"
310285 IssuerTypeURI = "uri"
311286 IssuerTypeUsername = "username"
312- IssuerTypeCIProvider = "ci-provider"
313287)
314288
315289func parseConfig (b []byte ) (cfg * FulcioConfig , err error ) {
@@ -417,7 +391,7 @@ func validateConfig(conf *FulcioConfig) error {
417391 }
418392 }
419393
420- return validateCIIssuerMetadata ( conf )
394+ return nil
421395}
422396
423397var DefaultConfig = & FulcioConfig {
@@ -458,34 +432,6 @@ func FromContext(ctx context.Context) *FulcioConfig {
458432 return untyped .(* FulcioConfig )
459433}
460434
461- // It checks that the templates defined are parseable
462- // We should check it during the service bootstrap to avoid errors further
463- func validateCIIssuerMetadata (fulcioConfig * FulcioConfig ) error {
464-
465- checkParse := func (temp string ) error {
466- t := template .New ("" ).Option ("missingkey=error" )
467- _ , err := t .Parse (temp )
468- return err
469- }
470-
471- for _ , ciIssuerMetadata := range fulcioConfig .CIIssuerMetadata {
472- v := reflect .ValueOf (ciIssuerMetadata .ExtensionTemplates )
473- for i := 0 ; i < v .NumField (); i ++ {
474- s := v .Field (i ).String ()
475- err := checkParse (s )
476- if err != nil {
477- return err
478- }
479- }
480-
481- err := checkParse (ciIssuerMetadata .SubjectAlternativeNameTemplate )
482- if err != nil {
483- return err
484- }
485- }
486- return nil
487- }
488-
489435// Load a config from disk, or use defaults
490436func Load (configPath string ) (* FulcioConfig , error ) {
491437 if _ , err := os .Stat (configPath ); os .IsNotExist (err ) {
@@ -570,8 +516,6 @@ func issuerToChallengeClaim(issType IssuerType, challengeClaim string) string {
570516 return "email"
571517 case IssuerTypeGithubWorkflow :
572518 return "sub"
573- case IssuerTypeCIProvider :
574- return "sub"
575519 case IssuerTypeCodefreshWorkflow :
576520 return "sub"
577521 case IssuerTypeChainguard :
0 commit comments