Skip to content

Commit 6d9d672

Browse files
committed
Reverted conditional logic
1 parent decbd68 commit 6d9d672

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

plugins/azure/applicationGateway/agRequestBodySize.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ module.exports = {
4747
for (let policy of wafPolicies.data) {
4848
if (!policy.id) continue;
4949
var maxRequestBodySize = config.max_request_body_size;
50-
if (policy.policySettings && policy.policySettings.maxRequestBodySizeInKb && policy.policySettings.maxRequestBodySizeInKb >= maxRequestBodySize) {
51-
helpers.addResult(results, 0, `Application gateway WAF policy has max request body size of ${policy.policySettings.maxRequestBodySizeInKb} which is greater than or equal to ${maxRequestBodySize}`, location, policy.id);
50+
if (policy.policySettings && policy.policySettings.maxRequestBodySizeInKb && policy.policySettings.maxRequestBodySizeInKb <= maxRequestBodySize) {
51+
helpers.addResult(results, 0, `Application gateway WAF policy has max request body size of ${policy.policySettings.maxRequestBodySizeInKb} which is less than or equal to ${maxRequestBodySize}`, location, policy.id);
5252
} else {
53-
helpers.addResult(results, 2, `Application gateway WAF policy has max request body size of ${policy.policySettings.maxRequestBodySizeInKb} which is less than ${maxRequestBodySize}`, location, policy.id);
53+
helpers.addResult(results, 2, `Application gateway WAF policy has max request body size of ${policy.policySettings.maxRequestBodySizeInKb} which is greater than ${maxRequestBodySize}`, location, policy.id);
5454
}
5555
}
5656

plugins/azure/applicationGateway/agRequestBodySize.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const wafPolicy = [
2929
"policySettings":{
3030
"mode": "prevention",
3131
"requestBodyCheck": true,
32-
"maxRequestBodySizeInKb": 200
32+
"maxRequestBodySizeInKb": 800
3333

3434
}
3535
},
@@ -102,18 +102,18 @@ describe('agRequestBodySize', function() {
102102
agRequestBodySize.run(cache, {}, (err, results) => {
103103
expect(results.length).to.equal(1);
104104
expect(results[0].status).to.equal(0);
105-
expect(results[0].message).to.include('Application gateway WAF policy has max request body size of 128 which is greater than or equal to 128');
105+
expect(results[0].message).to.include('Application gateway WAF policy has max request body size of 128 which is less than or equal to 128');
106106
expect(results[0].region).to.equal('eastus');
107107
done();
108108
});
109109
});
110110

111-
it('should give failing result if Application gateway WAF policy has max request body size less than 500 - with setting', function(done) {
111+
it('should give failing result if Application gateway WAF policy has max request body size greater than 500 - with setting', function(done) {
112112
const cache = createCache([wafPolicy[1]]);
113113
agRequestBodySize.run(cache, {max_request_body_size: 500}, (err, results) => {
114114
expect(results.length).to.equal(1);
115115
expect(results[0].status).to.equal(2);
116-
expect(results[0].message).to.include('Application gateway WAF policy has max request body size of 200 which is less than 500');
116+
expect(results[0].message).to.include('Application gateway WAF policy has max request body size of 800 which is greater than 500');
117117
expect(results[0].region).to.equal('eastus');
118118
done();
119119
});

0 commit comments

Comments
 (0)