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

appsec: update event rules 1.7.1 -> 1.8.0 #8

Merged
merged 3 commits into from
Oct 26, 2023
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
11 changes: 6 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
native:
strategy:
matrix:
runs-on: [ macos-13, macos-12, macos-11, ubuntu-22.04, ubuntu-20.04, ubuntu-18.04, windows-latest ]
runs-on: [ macos-13, macos-12, macos-11, ubuntu-22.04, ubuntu-20.04, windows-latest ]
go-version: [ "1.21", "1.20", "1.19" ]
cgo_enabled: # test it compiles with and without cgo
- 0
Expand Down Expand Up @@ -50,10 +50,11 @@ jobs:
strategy:
matrix:
go-version: [ "1.21", "1.20", "1.19" ]
distribution: [ bullseye, buster, alpine ]
cgo_enabled: # test it compiles with and without cgo
- 0
- 1
distribution: [ bookworm, bullseye, buster, alpine ]
cgo_enabled: [ "0", "1" ] # test it compiles with and without cgo
exclude:
- go-version: 1.21
distribution: buster
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion _tools/rules-updater/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang as go-format
FROM golang:1.21 as go-format
ARG version
ENV VERSION=$version
ADD https://raw.githubusercontent.com/DataDog/appsec-event-rules/$version/build/recommended.json /home/rules.json
Expand Down
18 changes: 10 additions & 8 deletions _tools/rules-updater/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@
# Example: ./update.sh 1.2.5
#

set -eux
set -eu

[ $# -ne 1 ] && echo "Usage: $0 \"version\"" >&2 && exit 1

echo "================ Minifying ================"

tmpDir=$(mktemp -d /tmp/rule-update-XXXXXXXXX)
scriptDir=$PWD/$(dirname $0)
tmpDir="$(mktemp -d /tmp/rule-update-XXXXXXXXX)"
scriptPath="$(readlink -f $0)"
scriptDir="$(dirname $scriptPath)"
destDir="$(readlink -f "$scriptDir/../../appsec/")"

trap "rm -rf $tmpDir" EXIT
trap "rm -r $tmpDir" EXIT

DOCKER_BUILDKIT=1 docker build -o type=local,dest=$tmpDir --build-arg version=$1 --no-cache $scriptDir
DOCKER_BUILDKIT=1 docker build -o type=local,dest="$tmpDir" --build-arg version="$1" --no-cache "$scriptDir"
echo "================ Done ================"
cp -v $tmpDir/rules.go ../../appsec/
cp -v $tmpDir/rules.json ../../appsec/
echo "Output written to ../../appsec/rules.go and ../../appsec/rules.json"
cp -v $tmpDir/rules.go "$destDir"
cp -v $tmpDir/rules.json "$destDir"
echo "Output written to $destDir"
6 changes: 3 additions & 3 deletions appsec/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

package appsec

import _ "embed"
import _ "embed" // Blank import comment for golint compliance

// StaticRecommendedRules holds the recommended AppSec security rules (v1.7.1)
// Source: https://github.com/DataDog/appsec-event-rules/blob/1.7.1/build/recommended.json
// StaticRecommendedRules holds the recommended AppSec security rules (v1.8.0)
// Source: https://github.com/DataDog/appsec-event-rules/blob/1.8.0/build/recommended.json
//
//go:embed rules.json
var StaticRecommendedRules string
Loading
Loading