Skip to content

Commit 33b4e32

Browse files
authored
Check for relative paths or literal $ strings in environment variables (#223)
This PR adds additional validation logic for `env` conditions to prevent literal `$PATH` string abuse. e.g., ``` LD_LIBRARY_PATH=/usr/lib64:/usr/local/lib64:$LD_LIBRARY_PATH ``` is not allowed. Additionally, any relative paths are also no longer allowed. I also bumped Go to 1.24 to use `strings.SplitSeq` and bumped the deps. --------- Signed-off-by: egibs <[email protected]> Signed-off-by: Evan Gibler <[email protected]>
1 parent 6095346 commit 33b4e32

File tree

6 files changed

+198
-80
lines changed

6 files changed

+198
-80
lines changed

.github/workflows/test.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ name: Tests
55
# Optionally, you can turn it on using a schedule for regular testing.
66
on:
77
pull_request:
8-
branches: ['main']
8+
branches: ["main"]
99
paths-ignore:
10-
- 'README.md'
10+
- "README.md"
1111
push:
12-
branches: ['main']
12+
branches: ["main"]
1313
paths-ignore:
14-
- 'README.md'
14+
- "README.md"
1515

1616
# Testing only needs permissions to read the repository contents.
1717
permissions:
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2828
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
2929
with:
30-
go-version-file: 'go.mod'
30+
go-version-file: "go.mod"
3131
- run: |
3232
go mod download
3333
go build -v .
@@ -38,7 +38,7 @@ jobs:
3838
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3939
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
4040
with:
41-
go-version-file: 'go.mod'
41+
go-version-file: "go.mod"
4242
cache: true
4343
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
4444
- run: go generate ./...
@@ -58,14 +58,16 @@ jobs:
5858
matrix:
5959
# list whatever Terraform versions here you would like to support
6060
terraform:
61-
- '1.7.*'
62-
- '1.8.*'
63-
- '1.9.*'
61+
- "1.7.*"
62+
- "1.8.*"
63+
- "1.9.*"
64+
- "1.10.*"
65+
- "1.11.*"
6466
steps:
6567
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6668
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
6769
with:
68-
go-version-file: 'go.mod'
70+
go-version-file: "go.mod"
6971
cache: true
7072
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
7173
with:
@@ -84,9 +86,9 @@ jobs:
8486
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8587
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
8688
with:
87-
go-version-file: 'go.mod'
89+
go-version-file: "go.mod"
8890
cache: false
8991
- name: golangci-lint
9092
uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
9193
with:
92-
version: v1.60
94+
version: v1.64.8

go.mod

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/chainguard-dev/terraform-provider-oci
22

3-
go 1.23.2
3+
go 1.24.0
44

55
require (
66
github.com/google/go-containerregistry v0.20.3
@@ -27,10 +27,10 @@ require (
2727
github.com/bmatcuk/doublestar/v4 v4.8.1 // indirect
2828
github.com/cloudflare/circl v1.3.7 // indirect
2929
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
30-
github.com/docker/cli v27.5.0+incompatible // indirect
30+
github.com/docker/cli v28.1.1+incompatible // indirect
3131
github.com/docker/distribution v2.8.3+incompatible // indirect
32-
github.com/docker/docker-credential-helpers v0.8.2 // indirect
33-
github.com/fatih/color v1.16.0 // indirect
32+
github.com/docker/docker-credential-helpers v0.9.3 // indirect
33+
github.com/fatih/color v1.18.0 // indirect
3434
github.com/golang/protobuf v1.5.4 // indirect
3535
github.com/google/go-cmp v0.7.0 // indirect
3636
github.com/google/uuid v1.6.0 // indirect
@@ -41,7 +41,7 @@ require (
4141
github.com/hashicorp/go-cty v1.5.0 // indirect
4242
github.com/hashicorp/go-hclog v1.6.3 // indirect
4343
github.com/hashicorp/go-multierror v1.1.1 // indirect
44-
github.com/hashicorp/go-plugin v1.6.2 // indirect
44+
github.com/hashicorp/go-plugin v1.6.3 // indirect
4545
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
4646
github.com/hashicorp/go-uuid v1.0.3 // indirect
4747
github.com/hashicorp/go-version v1.7.0 // indirect
@@ -51,13 +51,13 @@ require (
5151
github.com/hashicorp/terraform-exec v0.22.0 // indirect
5252
github.com/hashicorp/terraform-json v0.24.0 // indirect
5353
github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1 // indirect
54-
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
54+
github.com/hashicorp/terraform-registry-address v0.2.5 // indirect
5555
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
56-
github.com/hashicorp/yamux v0.1.1 // indirect
56+
github.com/hashicorp/yamux v0.1.2 // indirect
5757
github.com/huandu/xstrings v1.3.3 // indirect
5858
github.com/imdario/mergo v0.3.15 // indirect
5959
github.com/inconshreveable/mousetrap v1.1.0 // indirect
60-
github.com/klauspost/compress v1.17.11 // indirect
60+
github.com/klauspost/compress v1.18.0 // indirect
6161
github.com/mattn/go-colorable v0.1.14 // indirect
6262
github.com/mattn/go-isatty v0.0.20 // indirect
6363
github.com/mattn/go-runewidth v0.0.9 // indirect
@@ -67,36 +67,36 @@ require (
6767
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
6868
github.com/mitchellh/mapstructure v1.5.0 // indirect
6969
github.com/mitchellh/reflectwalk v1.0.2 // indirect
70-
github.com/oklog/run v1.0.0 // indirect
70+
github.com/oklog/run v1.1.0 // indirect
7171
github.com/opencontainers/go-digest v1.0.0 // indirect
72-
github.com/opencontainers/image-spec v1.1.0 // indirect
72+
github.com/opencontainers/image-spec v1.1.1 // indirect
7373
github.com/pkg/errors v0.9.1 // indirect
7474
github.com/posener/complete v1.2.3 // indirect
7575
github.com/shopspring/decimal v1.3.1 // indirect
7676
github.com/sirupsen/logrus v1.9.3 // indirect
7777
github.com/spf13/cast v1.5.0 // indirect
7878
github.com/spf13/pflag v1.0.6 // indirect
79-
github.com/vbatts/tar-split v0.11.6 // indirect
79+
github.com/vbatts/tar-split v0.12.1 // indirect
8080
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
8181
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
8282
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
8383
github.com/yuin/goldmark v1.7.7 // indirect
8484
github.com/yuin/goldmark-meta v1.1.0 // indirect
8585
github.com/zclconf/go-cty v1.16.2 // indirect
8686
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
87-
golang.org/x/crypto v0.36.0 // indirect
87+
golang.org/x/crypto v0.37.0 // indirect
8888
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
8989
golang.org/x/mod v0.22.0 // indirect
90-
golang.org/x/net v0.38.0 // indirect
91-
golang.org/x/oauth2 v0.25.0 // indirect
92-
golang.org/x/sync v0.12.0 // indirect
93-
golang.org/x/sys v0.31.0 // indirect
94-
golang.org/x/text v0.23.0 // indirect
90+
golang.org/x/net v0.39.0 // indirect
91+
golang.org/x/oauth2 v0.29.0 // indirect
92+
golang.org/x/sync v0.13.0 // indirect
93+
golang.org/x/sys v0.32.0 // indirect
94+
golang.org/x/text v0.24.0 // indirect
9595
golang.org/x/tools v0.29.0 // indirect
9696
google.golang.org/appengine v1.6.8 // indirect
97-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241015192408-796eee8c2d53 // indirect
98-
google.golang.org/grpc v1.69.4 // indirect
99-
google.golang.org/protobuf v1.36.3 // indirect
97+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250421163800-61c742ae3ef0 // indirect
98+
google.golang.org/grpc v1.72.0 // indirect
99+
google.golang.org/protobuf v1.36.6 // indirect
100100
gopkg.in/yaml.v2 v2.4.0 // indirect
101101
gopkg.in/yaml.v3 v3.0.1 // indirect
102102
)

0 commit comments

Comments
 (0)