Skip to content
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

SEC-090: Automated trusted workflow pinning (2024-08-19) #228

Merged
merged 2 commits into from
Aug 20, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- run: go mod download
- run: go test -coverprofile=coverage.out ./...
- run: go tool cover -html=coverage.out -o coverage.html
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: go-${{ matrix.go-version }}-coverage
path: coverage.html
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ linters:
- unconvert
- unparam
- unused
- vet
- govet
4 changes: 2 additions & 2 deletions float32validator/at_least.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func (validator atLeastValidator) ValidateFloat32(ctx context.Context, request v
// - Is greater than or equal to the given minimum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func AtLeast(min float32) validator.Float32 {
func AtLeast(minVal float32) validator.Float32 {
return atLeastValidator{
min: min,
min: minVal,
}
}
4 changes: 2 additions & 2 deletions float32validator/at_most.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func (v atMostValidator) ValidateFloat32(ctx context.Context, request validator.
// - Is less than or equal to the given maximum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func AtMost(max float32) validator.Float32 {
func AtMost(maxVal float32) validator.Float32 {
return atMostValidator{
max: max,
max: maxVal,
}
}
8 changes: 4 additions & 4 deletions float32validator/between.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func (v betweenValidator) ValidateFloat32(ctx context.Context, request validator
// - Is greater than or equal to the given minimum and less than or equal to the given maximum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func Between(min, max float32) validator.Float32 {
if min > max {
func Between(minVal, maxVal float32) validator.Float32 {
if minVal > maxVal {
return nil
}

return betweenValidator{
min: min,
max: max,
min: minVal,
max: maxVal,
}
}
4 changes: 2 additions & 2 deletions float64validator/at_least.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func (validator atLeastValidator) ValidateFloat64(ctx context.Context, request v
// - Is greater than or equal to the given minimum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func AtLeast(min float64) validator.Float64 {
func AtLeast(minVal float64) validator.Float64 {
return atLeastValidator{
min: min,
min: minVal,
}
}
4 changes: 2 additions & 2 deletions float64validator/at_most.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ func (v atMostValidator) ValidateFloat64(ctx context.Context, request validator.
// - Is less than or equal to the given maximum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func AtMost(max float64) validator.Float64 {
func AtMost(maxVal float64) validator.Float64 {
return atMostValidator{
max: max,
max: maxVal,
}
}
8 changes: 4 additions & 4 deletions float64validator/between.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func (v betweenValidator) ValidateFloat64(ctx context.Context, request validator
// - Is greater than or equal to the given minimum and less than or equal to the given maximum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func Between(min, max float64) validator.Float64 {
if min > max {
func Between(minVal, maxVal float64) validator.Float64 {
if minVal > maxVal {
return nil
}

return betweenValidator{
min: min,
max: max,
min: minVal,
max: maxVal,
}
}
4 changes: 2 additions & 2 deletions int32validator/at_least.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (v atLeastValidator) ValidateInt32(ctx context.Context, request validator.I
// - Is greater than or equal to the given minimum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func AtLeast(min int32) validator.Int32 {
func AtLeast(minVal int32) validator.Int32 {
return atLeastValidator{
min: min,
min: minVal,
}
}
4 changes: 2 additions & 2 deletions int32validator/at_most.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (v atMostValidator) ValidateInt32(ctx context.Context, request validator.In
// - Is less than or equal to the given maximum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func AtMost(max int32) validator.Int32 {
func AtMost(maxVal int32) validator.Int32 {
return atMostValidator{
max: max,
max: maxVal,
}
}
8 changes: 4 additions & 4 deletions int32validator/between.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ func (v betweenValidator) ValidateInt32(ctx context.Context, request validator.I
// - Is greater than or equal to the given minimum and less than or equal to the given maximum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func Between(min, max int32) validator.Int32 {
if min > max {
func Between(minVal, maxVal int32) validator.Int32 {
if minVal > maxVal {
return nil
}

return betweenValidator{
min: min,
max: max,
min: minVal,
max: maxVal,
}
}
4 changes: 2 additions & 2 deletions int64validator/at_least.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (v atLeastValidator) ValidateInt64(ctx context.Context, request validator.I
// - Is greater than or equal to the given minimum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func AtLeast(min int64) validator.Int64 {
func AtLeast(minVal int64) validator.Int64 {
return atLeastValidator{
min: min,
min: minVal,
}
}
4 changes: 2 additions & 2 deletions int64validator/at_most.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (v atMostValidator) ValidateInt64(ctx context.Context, request validator.In
// - Is less than or equal to the given maximum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func AtMost(max int64) validator.Int64 {
func AtMost(maxVal int64) validator.Int64 {
return atMostValidator{
max: max,
max: maxVal,
}
}
8 changes: 4 additions & 4 deletions int64validator/between.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ func (v betweenValidator) ValidateInt64(ctx context.Context, request validator.I
// - Is greater than or equal to the given minimum and less than or equal to the given maximum.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func Between(min, max int64) validator.Int64 {
if min > max {
func Between(minVal, maxVal int64) validator.Int64 {
if minVal > maxVal {
return nil
}

return betweenValidator{
min: min,
max: max,
min: minVal,
max: maxVal,
}
}
7 changes: 4 additions & 3 deletions listvalidator/size_at_least.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.List = sizeAtLeastValidator{}
Expand Down Expand Up @@ -52,8 +53,8 @@ func (v sizeAtLeastValidator) ValidateList(ctx context.Context, req validator.Li
// - Contains at least min elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeAtLeast(min int) validator.List {
func SizeAtLeast(minVal int) validator.List {
return sizeAtLeastValidator{
min: min,
min: minVal,
}
}
7 changes: 4 additions & 3 deletions listvalidator/size_at_most.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.List = sizeAtMostValidator{}
Expand Down Expand Up @@ -52,8 +53,8 @@ func (v sizeAtMostValidator) ValidateList(ctx context.Context, req validator.Lis
// - Contains at most max elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeAtMost(max int) validator.List {
func SizeAtMost(maxVal int) validator.List {
return sizeAtMostValidator{
max: max,
max: maxVal,
}
}
9 changes: 5 additions & 4 deletions listvalidator/size_between.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.List = sizeBetweenValidator{}
Expand Down Expand Up @@ -54,9 +55,9 @@ func (v sizeBetweenValidator) ValidateList(ctx context.Context, req validator.Li
// - Contains at least min elements and at most max elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeBetween(min, max int) validator.List {
func SizeBetween(minVal, maxVal int) validator.List {
return sizeBetweenValidator{
min: min,
max: max,
min: minVal,
max: maxVal,
}
}
7 changes: 4 additions & 3 deletions mapvalidator/size_at_least.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.Map = sizeAtLeastValidator{}
Expand Down Expand Up @@ -52,8 +53,8 @@ func (v sizeAtLeastValidator) ValidateMap(ctx context.Context, req validator.Map
// - Contains at least min elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeAtLeast(min int) validator.Map {
func SizeAtLeast(minVal int) validator.Map {
return sizeAtLeastValidator{
min: min,
min: minVal,
}
}
7 changes: 4 additions & 3 deletions mapvalidator/size_at_most.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.Map = sizeAtMostValidator{}
Expand Down Expand Up @@ -52,8 +53,8 @@ func (v sizeAtMostValidator) ValidateMap(ctx context.Context, req validator.MapR
// - Contains at most max elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeAtMost(max int) validator.Map {
func SizeAtMost(maxVal int) validator.Map {
return sizeAtMostValidator{
max: max,
max: maxVal,
}
}
9 changes: 5 additions & 4 deletions mapvalidator/size_between.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.Map = sizeBetweenValidator{}
Expand Down Expand Up @@ -54,9 +55,9 @@ func (v sizeBetweenValidator) ValidateMap(ctx context.Context, req validator.Map
// - Contains at least min elements and at most max elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeBetween(min, max int) validator.Map {
func SizeBetween(minVal, maxVal int) validator.Map {
return sizeBetweenValidator{
min: min,
max: max,
min: minVal,
max: maxVal,
}
}
7 changes: 4 additions & 3 deletions setvalidator/size_at_least.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.Set = sizeAtLeastValidator{}
Expand Down Expand Up @@ -52,8 +53,8 @@ func (v sizeAtLeastValidator) ValidateSet(ctx context.Context, req validator.Set
// - Contains at least min elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeAtLeast(min int) validator.Set {
func SizeAtLeast(minVal int) validator.Set {
return sizeAtLeastValidator{
min: min,
min: minVal,
}
}
7 changes: 4 additions & 3 deletions setvalidator/size_at_most.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.Set = sizeAtMostValidator{}
Expand Down Expand Up @@ -52,8 +53,8 @@ func (v sizeAtMostValidator) ValidateSet(ctx context.Context, req validator.SetR
// - Contains at most max elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeAtMost(max int) validator.Set {
func SizeAtMost(maxVal int) validator.Set {
return sizeAtMostValidator{
max: max,
max: maxVal,
}
}
9 changes: 5 additions & 4 deletions setvalidator/size_between.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import (
"context"
"fmt"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"

"github.com/hashicorp/terraform-plugin-framework-validators/helpers/validatordiag"
)

var _ validator.Set = sizeBetweenValidator{}
Expand Down Expand Up @@ -54,9 +55,9 @@ func (v sizeBetweenValidator) ValidateSet(ctx context.Context, req validator.Set
// - Contains at least min elements and at most max elements.
//
// Null (unconfigured) and unknown (known after apply) values are skipped.
func SizeBetween(min, max int) validator.Set {
func SizeBetween(minVal, maxVal int) validator.Set {
return sizeBetweenValidator{
min: min,
max: max,
min: minVal,
max: maxVal,
}
}