Skip to content

Commit

Permalink
appsec: enable API Security by default (#2557)
Browse files Browse the repository at this point in the history
Signed-off-by: Eliott Bouhana <eliott.bouhana@datadoghq.com>
  • Loading branch information
eliottness authored and darccio committed Feb 13, 2024
1 parent 5b421aa commit 18f7c90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/appsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ on:
- 'internal/appsec/**'
- 'appsec/**'
- 'contrib/**/appsec.go'
- '**/go.mod'
merge_group: # on merge groups touching appsec files
paths:
- '.github/workflows/appsec.yml'
- 'internal/appsec/**'
- 'appsec/**'
- 'contrib/**/appsec.go'
- '**/go.mod'
push:
branches: release-v*
env:
Expand Down
7 changes: 4 additions & 3 deletions internal/appsec/waf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"strings"
"testing"

internal "github.com/DataDog/appsec-internal-go/appsec"
waf "github.com/DataDog/go-libddwaf/v2"
pAppsec "gopkg.in/DataDog/dd-trace-go.v1/appsec"
httptrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/net/http"
Expand Down Expand Up @@ -448,8 +449,8 @@ func TestAPISecurity(t *testing.T) {
require.NoError(t, err)

t.Run("enabled", func(t *testing.T) {
t.Setenv("DD_EXPERIMENTAL_API_SECURITY_ENABLED", "true")
t.Setenv("DD_API_SECURITY_REQUEST_SAMPLE_RATE", "1.0")
t.Setenv(internal.EnvAPISecEnabled, "true")
t.Setenv(internal.EnvAPISecSampleRate, "1.0")
appsec.Start()
require.True(t, appsec.Enabled())
defer appsec.Stop()
Expand All @@ -470,7 +471,7 @@ func TestAPISecurity(t *testing.T) {
})

t.Run("disabled", func(t *testing.T) {
t.Setenv("DD_EXPERIMENTAL_API_SECURITY_ENABLED", "false")
t.Setenv(internal.EnvAPISecEnabled, "false")
appsec.Start()
require.True(t, appsec.Enabled())
defer appsec.Stop()
Expand Down

0 comments on commit 18f7c90

Please sign in to comment.