-
Notifications
You must be signed in to change notification settings - Fork 1.8k
FIPS Compliance: Refactor Entrypoint, Remove zap Dependency & Update Build Checks #8544
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
Merged
tekton-robot
merged 4 commits into
tektoncd:main
from
PuneetPunamiya:remove-zap-logger-from-entrypoint
Mar 19, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
760e3ad
cleanup: remove zap and dependency where k8s api are included
PuneetPunamiya d996aef
cleanup: move pipeline types
PuneetPunamiya 391e29b
cleanup: refactor to disable metrics
PuneetPunamiya 93d3b76
Adds a build check in Github Actions CI workflow
PuneetPunamiya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//go:build !disable_tls | ||
|
||
/* | ||
Copyright 2021 The Tekton Authors | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build disable_tls | ||
|
||
package config | ||
|
||
// GetMetricsConfigName returns the name of the configmap containing all | ||
// customizations for the storage bucket. | ||
func GetMetricsConfigName() string { panic("not supported when tls is disabled") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//go:build !disable_tls | ||
|
||
package config | ||
|
||
import ( | ||
"context" | ||
|
||
corev1 "k8s.io/api/core/v1" | ||
"knative.dev/pkg/metrics" | ||
) | ||
|
||
// GetMetricsConfigName returns the name of the configmap containing all | ||
// customizations for the storage bucket. | ||
func GetMetricsConfigName() string { | ||
return metrics.ConfigMapName() | ||
} | ||
|
||
// NewFeatureFlagsFromConfigMap returns a Config for the given configmap | ||
func NewFeatureFlagsFromConfigMap(config *corev1.ConfigMap) (*FeatureFlags, error) { | ||
return NewFeatureFlagsFromMap(config.Data) | ||
} | ||
|
||
// GetVerificationNoMatchPolicy returns the "trusted-resources-verification-no-match-policy" value | ||
func GetVerificationNoMatchPolicy(ctx context.Context) string { | ||
return FromContextOrDefaults(ctx).FeatureFlags.VerificationNoMatchPolicy | ||
} | ||
|
||
// IsSpireEnabled checks if non-falsifiable provenance is enforced through SPIRE | ||
func IsSpireEnabled(ctx context.Context) bool { | ||
return FromContextOrDefaults(ctx).FeatureFlags.EnforceNonfalsifiability == EnforceNonfalsifiabilityWithSpire | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//go:build !disable_tls | ||
|
||
/* | ||
Copyright 2022 The Tekton Authors | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//go:build !disable_tls | ||
|
||
/* | ||
Copyright 2022 The Tekton Authors | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
//go:build !disable_tls | ||
|
||
/* | ||
Copyright 2019 The Tekton Authors | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/* | ||
Copyright 2025 The Tekton Authors | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package types | ||
|
||
import ( | ||
"github.com/google/go-cmp/cmp" | ||
) | ||
|
||
// Algorithm Standard cryptographic hash algorithm | ||
type Algorithm string | ||
|
||
// Artifact represents an artifact within a system, potentially containing multiple values | ||
// associated with it. | ||
type Artifact struct { | ||
// The artifact's identifying category name | ||
Name string `json:"name,omitempty"` | ||
// A collection of values related to the artifact | ||
Values []ArtifactValue `json:"values,omitempty"` | ||
// Indicate if the artifact is a build output or a by-product | ||
BuildOutput bool `json:"buildOutput,omitempty"` | ||
} | ||
|
||
// ArtifactValue represents a specific value or data element within an Artifact. | ||
type ArtifactValue struct { | ||
Digest map[Algorithm]string `json:"digest,omitempty"` // Algorithm-specific digests for verifying the content (e.g., SHA256) | ||
Uri string `json:"uri,omitempty"` // Location where the artifact value can be retrieved | ||
} | ||
|
||
// TaskRunStepArtifact represents an artifact produced or used by a step within a task run. | ||
// It directly uses the Artifact type for its structure. | ||
type TaskRunStepArtifact = Artifact | ||
|
||
// Artifacts represents the collection of input and output artifacts associated with | ||
// a task run or a similar process. Artifacts in this context are units of data or resources | ||
// that the process either consumes as input or produces as output. | ||
type Artifacts struct { | ||
Inputs []Artifact `json:"inputs,omitempty"` | ||
Outputs []Artifact `json:"outputs,omitempty"` | ||
} | ||
|
||
func (a *Artifacts) Merge(another *Artifacts) { | ||
inputMap := make(map[string][]ArtifactValue) | ||
var newInputs []Artifact | ||
|
||
for _, v := range a.Inputs { | ||
inputMap[v.Name] = v.Values | ||
} | ||
if another != nil { | ||
for _, v := range another.Inputs { | ||
_, ok := inputMap[v.Name] | ||
if !ok { | ||
inputMap[v.Name] = []ArtifactValue{} | ||
} | ||
for _, vv := range v.Values { | ||
exists := false | ||
for _, av := range inputMap[v.Name] { | ||
if cmp.Equal(vv, av) { | ||
exists = true | ||
break | ||
} | ||
} | ||
if !exists { | ||
inputMap[v.Name] = append(inputMap[v.Name], vv) | ||
} | ||
} | ||
} | ||
} | ||
|
||
for k, v := range inputMap { | ||
newInputs = append(newInputs, Artifact{ | ||
Name: k, | ||
Values: v, | ||
}) | ||
} | ||
|
||
outputMap := make(map[string]Artifact) | ||
var newOutputs []Artifact | ||
for _, v := range a.Outputs { | ||
outputMap[v.Name] = v | ||
} | ||
|
||
if another != nil { | ||
for _, v := range another.Outputs { | ||
_, ok := outputMap[v.Name] | ||
if !ok { | ||
outputMap[v.Name] = Artifact{Name: v.Name, Values: []ArtifactValue{}, BuildOutput: v.BuildOutput} | ||
} | ||
// only update buildOutput to true. | ||
// Do not convert to false if it was true before. | ||
if v.BuildOutput { | ||
art := outputMap[v.Name] | ||
art.BuildOutput = v.BuildOutput | ||
outputMap[v.Name] = art | ||
} | ||
for _, vv := range v.Values { | ||
exists := false | ||
for _, av := range outputMap[v.Name].Values { | ||
if cmp.Equal(vv, av) { | ||
exists = true | ||
break | ||
} | ||
} | ||
if !exists { | ||
art := outputMap[v.Name] | ||
art.Values = append(art.Values, vv) | ||
outputMap[v.Name] = art | ||
} | ||
} | ||
} | ||
} | ||
|
||
for _, v := range outputMap { | ||
newOutputs = append(newOutputs, Artifact{ | ||
Name: v.Name, | ||
Values: v.Values, | ||
BuildOutput: v.BuildOutput, | ||
}) | ||
} | ||
a.Inputs = newInputs | ||
a.Outputs = newOutputs | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
maye be we can check the build for tls symbols ?
go tool nm bin/entrypoint | grep -E 'tls'
Or may be we need to check for crypto once Vibhav PR is merged
go tool nm bin/entrypoint | grep -E 'crypto|tls'
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.
@jkhelil yeah I think we could do that in a follow-up PR.