Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions app/cli/cmd/attestation_add.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -41,6 +41,7 @@ func newAttestationAddCmd() *cobra.Command {
var artifactCASConn *grpc.ClientConn
var annotationsFlag []string
var noStrictValidation bool
var skipSecretRedaction bool
var policyInputFromFileFlag []string
var policyInputFlag []string
var appendFlag bool
Expand DownExpand Up@@ -102,17 +103,18 @@ func newAttestationAddCmd() *cobra.Command {

a, err := action.NewAttestationAdd(
&action.AttestationAddOpts{
ActionsOpts: ActionOpts,
CASURI: viper.GetString(confOptions.CASAPI.viperKey),
CASCAPath: viper.GetString(confOptions.CASCA.viperKey),
ConnectionInsecure: apiInsecure(),
RegistryServer: registryServer,
RegistryUsername: registryUsername,
RegistryPassword: registryPassword,
LocalStatePath: attestationLocalStatePath,
NoStrictValidation: noStrictValidation,
MaxExtractEntries: maxExtractEntries,
MaxExtractSize: int64(maxExtractSizeBytes),
ActionsOpts: ActionOpts,
CASURI: viper.GetString(confOptions.CASAPI.viperKey),
CASCAPath: viper.GetString(confOptions.CASCA.viperKey),
ConnectionInsecure: apiInsecure(),
RegistryServer: registryServer,
RegistryUsername: registryUsername,
RegistryPassword: registryPassword,
LocalStatePath: attestationLocalStatePath,
NoStrictValidation: noStrictValidation,
SkipSecretRedaction: skipSecretRedaction,
MaxExtractEntries: maxExtractEntries,
MaxExtractSize: int64(maxExtractSizeBytes),
},
)
if err != nil {
Expand DownExpand Up@@ -200,6 +202,7 @@ func newAttestationAddCmd() *cobra.Command {
flagAttestationID(cmd)
cmd.Flags().StringVar(&kind, "kind", "", fmt.Sprintf("kind of the material to be recorded: %q", schemaapi.ListAvailableMaterialKind()))
cmd.Flags().BoolVar(&noStrictValidation, "no-strict-validation", false, "skip strict schema validation for structured materials (SBOM_CYCLONEDX_JSON, OPENAPI_SPEC, ASYNCAPI_SPEC, OSSF_SCORECARD_JSON)")
cmd.Flags().BoolVar(&skipSecretRedaction, "skip-secret-redaction", false, "store evidence exactly as captured, without redacting detected secrets first (CHAINLOOP_AI_CODING_SESSION). Recorded in the attestation so policies can reject it")
cmd.Flags().StringArrayVar(&policyInputFromFileFlag, "policy-input-from-file", nil, "feed a policy input from a column of a CSV or JSON file, in the format [<policy>:]<input>=<file>[:<column>] (e.g. ignored_paths=exception.csv:Path); the values are APPENDED to any contract-declared value; an optional <policy>: prefix scopes the input to a single policy (matched by name or ref), otherwise it applies to every declaring policy; <column> is a single top-level column/field name and defaults to the input name; repeatable. The file is also recorded as EVIDENCE.")
cmd.Flags().StringArrayVar(&policyInputFlag, "policy-input", nil, "set a policy input to a literal value that REPLACES (overrides) any contract-declared value for the input, in the format [<policy>:]<input>=<value> (e.g. min_iterations=10); use this to override a scalar input at run time; an optional <policy>: prefix scopes it to a single policy (matched by name or ref), otherwise it applies to every declaring policy; repeatable.")
cmd.Flags().BoolVar(&appendFlag, "append", false, "reserved for a future release: will control whether --policy-input and --policy-input-from-file append to (rather than replace) the contract-declared value; has no effect yet")
Expand Down
1 change: 1 addition & 0 deletions app/cli/documentation/cli-reference.mdx
Original file line numberDiff line numberDiff line change
Expand Up@@ -278,6 +278,7 @@ Options
--registry-password string registry password, ($CHAINLOOP_REGISTRY_PASSWORD)
--registry-server string OCI repository server, ($CHAINLOOP_REGISTRY_SERVER)
--registry-username string registry username, ($CHAINLOOP_REGISTRY_USERNAME)
--skip-secret-redaction store evidence exactly as captured, without redacting detected secrets first (CHAINLOOP_AI_CODING_SESSION). Recorded in the attestation so policies can reject it
--value string value to be recorded
```

Expand Down
7 changes: 7 additions & 0 deletions app/cli/pkg/action/attestation_add.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,6 +42,9 @@ type AttestationAddOpts struct {
LocalStatePath string
// NoStrictValidation skips strict schema validation
NoStrictValidation bool
// SkipSecretRedaction uploads evidence that would normally be scrubbed
// exactly as captured. The bypass is recorded in the attestation.
SkipSecretRedaction bool
// MaxExtractEntries limits the number of entries extracted from an archive.
// Zero defaults to materials.DefaultArchiveLimits().MaxEntries.
MaxExtractEntries int
Expand DownExpand Up@@ -76,6 +79,10 @@ func NewAttestationAdd(cfg *AttestationAddOpts) (*AttestationAdd, error) {
if cfg.NoStrictValidation {
opts = append(opts, crafter.WithNoStrictValidation(cfg.NoStrictValidation))
}
if cfg.SkipSecretRedaction {
cfg.Logger.Warn().Msg("secret redaction is disabled, evidence will be stored exactly as captured")
opts = append(opts, crafter.WithSkipSecretRedaction(cfg.SkipSecretRedaction))
}

defaults := materials.DefaultArchiveLimits()
maxEntries := cfg.MaxExtractEntries
Expand Down
34 changes: 16 additions & 18 deletions go.mod
Original file line numberDiff line numberDiff line change
Expand Up@@ -97,7 +97,6 @@ require (
github.com/sigstore/timestamp-authority/v2 v2.1.3
github.com/styrainc/regal v0.35.1
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78
github.com/zricethezav/gitleaks/v8 v8.30.1
gitlab.com/gitlab-org/security-products/analyzers/report/v5 v5.13.1
go.step.sm/crypto v0.87.0
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d
Expand All@@ -108,6 +107,7 @@ require github.com/vektah/gqlparser/v2 v2.5.36

require (
github.com/XSAM/otelsql v0.43.0
github.com/betterleaks/betterleaks v1.8.1
github.com/golang-jwt/jwt/v5 v5.3.1
github.com/moby/moby/api v1.55.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0
Expand All@@ -130,17 +130,14 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.5.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.7.2 // indirect
github.com/BobuSumisu/aho-corasick v1.0.3 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.57.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.57.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.5.0 // indirect
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/STARRY-S/zip v0.2.3 // indirect
github.com/agnivade/levenshtein v1.2.1 // indirect
github.com/anchore/go-struct-converter v0.1.0 // indirect
github.com/andybalholm/brotli v1.2.0 // indirect
github.com/andybalholm/brotli v1.2.1 // indirect
github.com/antithesishq/antithesis-sdk-go v0.7.2-default-no-op // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
Expand All@@ -151,17 +148,16 @@ require (
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.36 // indirect
github.com/aws/aws-sdk-go-v2/service/kms v1.55.0 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.5.4 // indirect
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/bahlo/generic-list-go v0.2.0 // indirect
github.com/bmatcuk/doublestar v1.3.4 // indirect
github.com/bmatcuk/doublestar/v4 v4.8.1 // indirect
github.com/bodgit/plumbing v1.3.0 // indirect
github.com/bodgit/sevenzip v1.6.1 // indirect
github.com/bodgit/sevenzip v1.6.2 // indirect
github.com/bodgit/windows v1.0.1 // indirect
github.com/buger/jsonparser v1.1.2 // indirect
github.com/casbin/govaluate v1.3.0 // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/charmbracelet/lipgloss v0.5.0 // indirect
github.com/charlievieth/fastwalk v1.0.14 // indirect
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
github.com/cncf/xds/go v0.0.0-20260202195803-dba9d589def2 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
Expand All@@ -174,13 +170,15 @@ require (
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/dlclark/regexp2 v1.12.0 // indirect
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dylibso/observe-sdk/go v0.0.0-20240819160327-2d926c5d788a // indirect
github.com/ebitengine/purego v0.10.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.37.0 // indirect
github.com/envoyproxy/protoc-gen-validate v1.3.3 // indirect
github.com/expr-lang/expr v1.17.8 // indirect
github.com/fatih/color v1.19.0 // indirect
github.com/fatih/semgroup v1.2.0 // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
Expand All@@ -206,19 +204,20 @@ require (
github.com/go-openapi/swag/typeutils v0.28.0 // indirect
github.com/go-openapi/swag/yamlutils v0.28.0 // indirect
github.com/go-playground/assert/v2 v2.2.0 // indirect
github.com/go-sprout/sprout v1.0.3 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/goccy/go-json v0.10.6 // indirect
github.com/google/cel-go v0.30.0 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/go-github/v72 v72.0.0 // indirect
github.com/google/go-github/v88 v88.0.0 // indirect
github.com/google/go-tpm v0.9.8 // indirect
github.com/google/renameio/v2 v2.0.0 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/h2non/filetype v1.1.3 // indirect
github.com/hashicorp/go-version v1.9.0 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/ianlancetaylor/demangle v0.0.0-20240805132620-81f5be970eca // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
Expand All@@ -235,23 +234,21 @@ require (
github.com/lestrrat-go/httprc/v3 v3.0.5 // indirect
github.com/lestrrat-go/jwx/v3 v3.1.1 // indirect
github.com/lestrrat-go/option/v2 v2.0.0 // indirect
github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
github.com/lufia/plan9stats v0.0.0-20260330125221-c963978e514e // indirect
github.com/mholt/archives v0.1.5 // indirect
github.com/mholt/archives v0.1.6-0.20260429171216-ef71b7a32fae // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/mikelolasagasti/xz v1.0.1 // indirect
github.com/minio/crc64nvme v1.1.1 // indirect
github.com/minio/highwayhash v1.0.4 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/minlz v1.0.1 // indirect
github.com/minio/minlz v1.1.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/moby/go-archive v0.3.0 // indirect
github.com/moby/moby/client v0.5.1 // indirect
github.com/moby/sys/user v0.4.1 // indirect
github.com/moby/sys/userns v0.1.0 // indirect
github.com/muesli/termenv v0.15.1 // indirect
github.com/natefinch/atomic v1.0.1 // indirect
github.com/nats-io/jwt/v2 v2.8.2 // indirect
github.com/nats-io/nkeys v0.4.16 // indirect
Expand All@@ -265,20 +262,23 @@ require (
github.com/pb33f/ordered-map/v2 v2.3.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/philhofer/fwd v1.2.0 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pierrec/lz4/v4 v4.1.26 // indirect
github.com/pjbgf/sha1cd v0.6.0 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/xattr v0.4.12 // indirect
github.com/pkoukk/tiktoken-go v0.1.8 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
github.com/rrethy/ahocorasick v1.0.0 // indirect
github.com/rs/xid v1.6.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/segmentio/asm v1.2.1 // indirect
github.com/sergi/go-diff v1.4.0 // indirect
github.com/shirou/gopsutil/v4 v4.26.6 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/shurcooL/githubv4 v0.0.0-20260209031235-2402fdf4a9ed // indirect
github.com/shurcooL/graphql v0.0.0-20240915155400-7ee5256398cf // indirect
github.com/sigstore/rekor-tiles/v2 v2.3.0 // indirect
github.com/skeema/knownhosts v1.3.1 // indirect
github.com/sorairolake/lzip-go v0.3.8 // indirect
Expand All@@ -296,8 +296,6 @@ require (
github.com/transparency-dev/formats v0.1.1 // indirect
github.com/ulikunitz/xz v0.5.15 // indirect
github.com/valyala/fastjson v1.6.10 // indirect
github.com/wasilibs/go-re2 v1.9.0 // indirect
github.com/wasilibs/wazero-helpers v0.0.0-20240620070341-3dff1577cd52 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
Expand All@@ -320,7 +318,7 @@ require (
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
go.yaml.in/yaml/v4 v4.0.0-rc.2 // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
go4.org v0.0.0-20260112195520-a5071408f32f // indirect
goa.design/goa/v3 v3.27.0 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/ini.v1 v1.67.3 // indirect
Expand Down
Loading
Loading