Skip to content

Commit

Permalink
Merge pull request #35 from akamai/release/2.4.0
Browse files Browse the repository at this point in the history
Release/2.4.0 => master
  • Loading branch information
atuljain16 authored Aug 23, 2021
2 parents 8715861 + 3bf0673 commit 921689b
Show file tree
Hide file tree
Showing 17 changed files with 426 additions and 147 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
## 2.4.0 (August Release)
- New Command:
- `recommendations` command displays recommendations in a policy
- `accept-recommendation` command accepts a recommendation
- `decline-recommendation` command declines a recommendation
- `reset-recommendation` command resets a recommendation
- Renaming `start-eval` command parameter - `mode` to `eval-mode`

## 2.3.0 (July Release)

- WAP Plus support for selected-hostnames, modify-hostnames, and network-lists
- Added "mode" parameter to support ASE (Auto and Manual) for the "start-eval" command
- Added "threat-intel", "enable-threat-intel", and "disable-threat-intel" commands
- Support for including hostnames ("--include-hostnames) and contract-group ("--include-contract-group") in the "configs" command
- Support for including hostnames ("--include-hostnames") and contract-group ("--include-contract-group") in the "configs" command

## 2.2.0 (May Release)

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ Commands:
version-notes Display the version notes.
modify-version-notes Update the version notes.
modify-hostnames Modify hostnames for the configuration version.
recommendations Display recommendations in a policy.
accept-recommendation Accept a recommendation.
decline-recommendation Decline a recommendation.
reset-recommendation Reset a recommendation.
Command options:
--json Print the raw json response. All commands respect this option. [boolean]
Expand Down
6 changes: 3 additions & 3 deletions bin/commands/eval.start.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ class EnableEvalRuleCommand {
group: 'Optional:',
required: false
})
.string('--mode <mode>', {
.string('--eval-mode <mode>', {
desc:
'Evaluation mode KRS2_AUTO or KRS2_MANUAL. Used only for ASE(KRS 2) evaluation rulesets. Defaults to KRS2_MANUAL',
'Evaluation mode ASE_AUTO or ASE_MANUAL. Used only for ASE evaluation rulesets. Defaults to ASE_MANUAL',
group: 'Optional:',
required: false
})
;
}

run(options) {
options.mode = options['mode'];
options.mode = options['eval-mode'];

out.print({
promise: new EvalRules(options).startEval(),
Expand Down
2 changes: 1 addition & 1 deletion bin/commands/mode.set.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SetModeCommand {
setup(sywac) {
sywac
.positional('<mode>', {
paramsDesc: 'The mode to be set to.'
paramsDesc: 'The mode to be set to. Supported values are ASE_AUTO, ASE_MANUAL, AAG, KRS'
})
.number('--config <id>', {
desc: 'Configuration ID. Mandatory if you have more than one configuration.',
Expand Down
54 changes: 54 additions & 0 deletions bin/commands/recommendation.accept.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
let Recommendations = require('../../src/recommendations').recommendations;
let out = require('./lib/out');

class RecommendationsCommand {
constructor() {
this.flags = 'accept-recommendation';
this.desc = 'Accept Recommendation';
this.setup = this.setup.bind(this);
this.run = this.run.bind(this);
}

setup(sywac) {
sywac
.usage('Usage: akamai-appsec accept-recommendation --selector <selectorId> [options]')
.number('--selector <selectorId>', {
desc: 'Selector ID',
group: 'Required:',
required: true
})
.number('--config <id>', {
desc: 'Configuration ID. Mandatory if you have more than one configuration.',
group: 'Optional:',
required: false
})
.string('--version <id>', {
desc:
"Version Number. It can also take the values 'PROD' or 'PRODUCTION' or 'STAGING'. If not provided, latest version is assumed.",
group: 'Optional:',
required: false
})

.string('--policy <id>', {
desc:
'Policy ID. If not provided, we try to use the policy available on file. If you have more than one policy, this option must be provided.',
group: 'Optional:',
required: false
});
}

run(options) {
options.action = 'ACCEPT';
options.selectorId = options['selector'];

out.print({
promise: new Recommendations(options).postRecommendation(),
args: options,
success: (args, data) => {
return JSON.stringify(data);
}
});
}
}

module.exports = new RecommendationsCommand();
55 changes: 55 additions & 0 deletions bin/commands/recommendation.decline.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
let Recommendations = require('../../src/recommendations').recommendations;
let out = require('./lib/out');

class RecommendationsCommand {
constructor() {
this.flags = 'decline-recommendation';
this.desc = 'Decline Recommendation';
this.setup = this.setup.bind(this);
this.run = this.run.bind(this);
}

setup(sywac) {
sywac
.usage('Usage: akamai-appsec accept-recommendation --selector <selectorId> [options]')
.number('--selector <selectorId>', {
desc: "Selector ID",
group: 'Required:',
required: true
})
.number('--config <id>', {
desc: 'Configuration ID. Mandatory if you have more than one configuration.',
group: 'Optional:',
required: false
})
.string('--version <id>', {
desc:
"Version Number. It can also take the values 'PROD' or 'PRODUCTION' or 'STAGING'. If not provided, latest version is assumed.",
group: 'Optional:',
required: false
})

.string('--policy <id>', {
desc:
'Policy ID. If not provided, we try to use the policy available on file. If you have more than one policy, this option must be provided.',
group: 'Optional:',
required: false
});
}

run(options) {
options.action = 'DECLINE';
options.selectorId = options['selector'];

out.print({
promise: new Recommendations(options).postRecommendation(),
args: options,
success: (args, data) => {
return JSON.stringify(data);
}
})
;
}
}

module.exports = new RecommendationsCommand();
55 changes: 55 additions & 0 deletions bin/commands/recommendation.reset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
let Recommendations = require('../../src/recommendations').recommendations;
let out = require('./lib/out');

class RecommendationsCommand {
constructor() {
this.flags = 'reset-recommendation';
this.desc = 'Reset Recommendation';
this.setup = this.setup.bind(this);
this.run = this.run.bind(this);
}

setup(sywac) {
sywac
.usage('Usage: akamai-appsec accept-recommendation --selector <selectorId> [options]')
.number('--selector <selectorId>', {
desc: "Selector ID",
group: 'Required:',
required: true
})
.number('--config <id>', {
desc: 'Configuration ID. Mandatory if you have more than one configuration.',
group: 'Optional:',
required: false
})
.string('--version <id>', {
desc:
"Version Number. It can also take the values 'PROD' or 'PRODUCTION' or 'STAGING'. If not provided, latest version is assumed.",
group: 'Optional:',
required: false
})

.string('--policy <id>', {
desc:
'Policy ID. If not provided, we try to use the policy available on file. If you have more than one policy, this option must be provided.',
group: 'Optional:',
required: false
});
}

run(options) {
options.action = 'RESET';
options.selectorId = options['selector'];

out.print({
promise: new Recommendations(options).postRecommendation(),
args: options,
success: (args, data) => {
return JSON.stringify(data);
}
})
;
}
}

module.exports = new RecommendationsCommand();
52 changes: 52 additions & 0 deletions bin/commands/recommendations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
let Recommendations = require('../../src/recommendations').recommendations;
let out = require('./lib/out');

class RecommendationsCommand {
constructor() {
this.flags = 'recommendations';
this.desc = 'Display Recommendations';
this.setup = this.setup.bind(this);
this.run = this.run.bind(this);
}

setup(sywac) {
sywac
.positional('[attack-group-name]', {
paramsDesc: 'The attack group name.'
})
.number('--config <id>', {
desc: 'Configuration ID. Mandatory if you have more than one configuration.',
group: 'Optional:',
required: false
})
.string('--version <id>', {
desc:
"Version Number. It can also take the values 'PROD' or 'PRODUCTION' or 'STAGING'. If not provided, latest version is assumed.",
group: 'Optional:',
required: false
})
.string('--policy <id>', {
desc:
'Policy ID. If not provided, we try to use the policy available on file. If you have more than one policy, this option must be provided.',
group: 'Optional:',
required: false
});
}

run(options) {
options.group = options['attack-group-name'];
const promise =
options.group != null
? new Recommendations(options).getGroupRecommendations()
: new Recommendations(options).getRecommendations();
out.print({
promise,
args: options,
success: (args, data) => {
return JSON.stringify(data);
}
});
}
}

module.exports = new RecommendationsCommand();
2 changes: 1 addition & 1 deletion bin/commands/rule.upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class RuleActionsCommand {
})
.string('--mode <id>', {
desc:
'Ruleset upgrade mode KRS2_AUTO or KRS2_MANUAL. If mode is not provided, KRS 1.0 ruleset is assumed',
'Ruleset upgrade mode ASE_AUTO or ASE_MANUAL. If mode is not provided, KRS 1.0 ruleset is assumed',
group: 'Optional:',
required: false
});
Expand Down
2 changes: 1 addition & 1 deletion cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"commands": [
{
"name": "appsec",
"version": "2.3.0",
"version": "2.4.0",
"description": "Akamai Security tools for protecting websites."
}
]
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "akamaicliappsec",
"version": "2.3.0",
"version": "2.4.0",
"description": "A wrapping development kit to interface common tasks with akamai's Security {OPEN} API.",
"repository": "https://github.com/akamai/cli-appsec",
"license": "Apache-2.0",
Expand Down
Loading

0 comments on commit 921689b

Please sign in to comment.