Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defaults:
env:
buildType: RelWithDebInfo
tempdir: ${{ github.workspace }}/build
libddwafVersion: 1.17.0
libddwafVersion: 1.18.0
jobs:
Coverage:
runs-on: ubuntu-22.04
Expand Down
2 changes: 1 addition & 1 deletion libddwaf
Submodule libddwaf updated 1320 files
2 changes: 1 addition & 1 deletion src/main/java/io/sqreen/powerwaf/Powerwaf.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Map;

public final class Powerwaf {
public static final String LIB_VERSION = "1.17.0";
public static final String LIB_VERSION = "1.18.0";

private static final Logger LOGGER = LoggerFactory.getLogger(Powerwaf.class);
static final boolean ENABLE_BYTE_BUFFERS;
Expand Down
32 changes: 32 additions & 0 deletions src/test/groovy/io/sqreen/powerwaf/BasicTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,38 @@ class BasicTests implements PowerwafTrait {
assertThat awd.actions.keySet(), containsInAnyOrder('aaaa', 'block_request', 'bbbb')
}

@Test
void 'test actions with various types'() {
def ruleSet = slurper.parseText(JsonOutput.toJson(ARACHNI_ATOM_BLOCK))
ruleSet.putAt('actions', [
[
id: 'block',
parameters: [
status_code: 201, // integer
type: 'auto',
grpc_status_code: '10', // string
enabled: true, // boolean
test: 'false' // string
],
type: 'block_request'
]
])
ruleSet['rules'][0]['on_match'] = ['block']

ctx = Powerwaf.createContext('test', ruleSet)

ResultWithData awd = ctx.runRules(
['server.request.headers.no_cookies': ['user-agent': 'Arachni/v1']], limits, metrics)
assertThat awd.result, is(Powerwaf.Result.MATCH)
assertThat awd.actions.keySet(), contains('block_request')

assertThat awd.actions.get('block_request').type, is('auto')
assertThat awd.actions.get('block_request').status_code, is('201')
assertThat awd.actions.get('block_request').grpc_status_code, is('10')
assertThat awd.actions.get('block_request').enabled, is('true')
assertThat awd.actions.get('block_request').test, is('false')
}

@Test
void 'test with array of string lists'() {
def ruleSet = ARACHNI_ATOM_V1_0
Expand Down