Skip to content

Commit 41ca211

Browse files
authored
Merge branch 'main' into no-panic-on-non-selectable-col
2 parents 47be8bb + edad234 commit 41ca211

File tree

10 files changed

+38
-10
lines changed

10 files changed

+38
-10
lines changed

Diff for: .github/workflows/codeql-analysis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
1414

1515
- name: Initialize CodeQL
16-
uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3
16+
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3
1717
with:
1818
languages: go
1919

2020
- name: Autobuild
21-
uses: github/codeql-action/autobuild@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3
21+
uses: github/codeql-action/autobuild@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3
2222

2323
- name: Perform CodeQL Analysis
24-
uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3
24+
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3

Diff for: .github/workflows/regression.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,28 +48,28 @@ jobs:
4848
export BUILD_TAGS=${{ matrix.build-flag }}
4949
go run mage.go coverage
5050
- name: "Codecov: General"
51-
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5
51+
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5
5252
if: ${{ matrix.go-version == '1.22.x' }}
5353
with:
5454
files: build/coverage.txt
5555
flags: default,${{ matrix.build-flag }}
5656
token: ${{ secrets.CODECOV_TOKEN }}
5757
- name: "Codecov: Examples"
58-
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5
58+
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5
5959
if: ${{ matrix.go-version == '1.22.x' }}
6060
with:
6161
files: build/coverage-examples.txt
6262
flags: examples+${{ matrix.build-flag }}
6363
token: ${{ secrets.CODECOV_TOKEN }}
6464
- name: "Codecov: FTW"
65-
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5
65+
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5
6666
if: ${{ matrix.go-version == '1.22.x' }}
6767
with:
6868
files: build/coverage-ftw.txt
6969
flags: ftw,${{ matrix.build-flag }}
7070
token: ${{ secrets.CODECOV_TOKEN }}
7171
- name: "Codecov: Tinygo"
72-
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5
72+
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5
7373
# only if coverage-tinygo.txt exists
7474
if: ${{ matrix.go-version == '1.22.x' && hashFiles('build/coverage-tinygo.txt') != '' }}
7575
with:

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require (
2727
github.com/petar-dambovaliev/aho-corasick v0.0.0-20240411101913-e07a1f0e8eb4
2828
github.com/tidwall/gjson v1.18.0
2929
github.com/valllabh/ocsf-schema-golang v1.0.3
30-
golang.org/x/net v0.32.0
30+
golang.org/x/net v0.33.0
3131
golang.org/x/sync v0.10.0
3232
rsc.io/binaryregexp v0.2.0
3333
)

Diff for: go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
5555
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
5656
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
5757
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
58+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
59+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
5860
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
5961
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
6062
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

Diff for: internal/seclang/parser.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ type Parser struct {
3434
// It will return error if any directive fails to parse
3535
// or the file does not exist.
3636
// If the path contains a *, it will be expanded to all
37-
// files in the directory matching the pattern
37+
// files in the directory matching the pattern.
38+
// It will return an error if there are no files matching the pattern.
3839
func (p *Parser) FromFile(profilePath string) error {
3940
originalDir := p.currentDir
4041

@@ -45,6 +46,9 @@ func (p *Parser) FromFile(profilePath string) error {
4546
if err != nil {
4647
return fmt.Errorf("failed to glob: %s", err.Error())
4748
}
49+
if len(files) == 0 {
50+
return fmt.Errorf("empty glob: %s does not match any file", profilePath)
51+
}
4852
} else {
4953
files = append(files, profilePath)
5054
}

Diff for: internal/seclang/parser_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ func TestLoadConfigurationFile(t *testing.T) {
102102
if err != nil {
103103
t.Errorf("unexpected error: %s", err.Error())
104104
}
105+
106+
err = p.FromFile("./testdata/glob/*.comf")
107+
if err == nil {
108+
t.Errorf("expected an error as glob does not match any file")
109+
}
105110
}
106111

107112
// Connectors are supporting embedding github.com/corazawaf/coraza-coreruleset to ease CRS integration

Diff for: internal/transformations/base64encode.go

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2024 Juan Pablo Tosso and the OWASP Coraza contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package transformations
5+
6+
import (
7+
"encoding/base64"
8+
)
9+
10+
func base64encode(data string) (string, bool, error) {
11+
src := []byte(data)
12+
13+
return base64.StdEncoding.EncodeToString(src), true, nil
14+
}

Diff for: internal/transformations/transformations.go

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ func GetTransformation(name string) (plugintypes.Transformation, error) {
3030
func init() {
3131
Register("base64Decode", base64decode)
3232
Register("base64DecodeExt", base64decodeext)
33+
Register("base64Encode", base64encode)
3334
Register("cmdLine", cmdLine)
3435
Register("compressWhitespace", compressWhitespace)
3536
Register("cssDecode", cssDecode)

Diff for: testing/coreruleset/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ require (
4747
github.com/valllabh/ocsf-schema-golang v1.0.3 // indirect
4848
github.com/yargevad/filepathx v1.0.0 // indirect
4949
golang.org/x/crypto v0.31.0 // indirect
50-
golang.org/x/net v0.32.0 // indirect
50+
golang.org/x/net v0.33.0 // indirect
5151
golang.org/x/sync v0.10.0 // indirect
5252
golang.org/x/sys v0.28.0 // indirect
5353
golang.org/x/time v0.8.0 // indirect

Diff for: testing/coreruleset/go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
109109
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
110110
golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI=
111111
golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs=
112+
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
113+
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
112114
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
113115
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
114116
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

0 commit comments

Comments
 (0)