Skip to content

Commit ab4fe82

Browse files
authored
chore: don't bake-in the default ruleset on Windows (#139)
This avoids risking to carry a large embedded JSON object on Windows binaries where it'll never be of any use. The DefaultRuleset function remains "live" because it's used by the Builder API which is part of the surface that is not / cannot be gated by a build tag.
1 parent b25467a commit ab4fe82

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

.github/workflows/_test_bare_metal.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
go-version: ${{ fromJson(needs.go-versions-matrix.outputs.json) }}
3333
include:
3434
# Test with DD_APPSEC_WAF_LOG_LEVEL (only latest go version)
35-
- go-version: oldstable
35+
- go-version: stable
3636
waf-log-level: TRACE
3737
name: ${{ matrix.runs-on }} ${{ matrix.go-version }}${{ matrix.waf-log-level && format(' (DD_APPSEC_WAF_LOG_LEVEL={0})', matrix.waf-log-level) || '' }}
3838
runs-on: ${{ matrix.runs-on }}

internal/ruleset/ruleset.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// This product includes software developed at Datadog (https://www.datadoghq.com/).
44
// Copyright 2016-present Datadog, Inc.
55

6+
//go:build linux || darwin
7+
68
package ruleset
79

810
import (

internal/ruleset/ruleset_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// This product includes software developed at Datadog (https://www.datadoghq.com/).
44
// Copyright 2016-present Datadog, Inc.
55

6+
//go:build linux || darwin
7+
68
package ruleset
79

810
import (
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed
2+
// under the Apache License Version 2.0.
3+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
// Copyright 2016-present Datadog, Inc.
5+
6+
//go:build !(linux || darwin)
7+
8+
package ruleset
9+
10+
import (
11+
"errors"
12+
"runtime"
13+
14+
"github.com/DataDog/go-libddwaf/v4/internal/bindings"
15+
)
16+
17+
func DefaultRuleset(pinner *runtime.Pinner) (bindings.WAFObject, error) {
18+
return bindings.WAFObject{}, errors.New("the default ruleset is not available on unsupported platforms")
19+
}

0 commit comments

Comments
 (0)