Skip to content

Commit 87431da

Browse files
committed
Test the old handle still alive when an new empty config is applied
1 parent 84396e0 commit 87431da

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,28 @@ describe('DDWAF', () => {
185185
assert.strictEqual(waf.disposed, false)
186186
})
187187

188+
it('should keep functional handle after updating an invalid configuration', () => {
189+
const waf = new DDWAF(rules, 'recommended')
190+
waf.createOrUpdateConfig({}, 'config/update')
191+
192+
assert(!waf.disposed)
193+
194+
const context = waf.createContext()
195+
const payload = {
196+
persistent: {
197+
'server.request.headers.no_cookies': 'value_ATTack'
198+
}
199+
}
200+
201+
const result = context.run(payload, TIMEOUT)
202+
203+
assert.strictEqual(result.timeout, false)
204+
assert.strictEqual(result.status, 'match')
205+
assert(result.events)
206+
assert.deepStrictEqual(result.actions, {})
207+
assert(!context.disposed)
208+
})
209+
188210
it('should return true when updating configuration', () => {
189211
const waf = new DDWAF(rules, 'recommended')
190212
const newConfig = {

0 commit comments

Comments
 (0)