@heroku/skynet 1.13.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/allowlist/add.d.ts +11 -0
- package/dist/commands/allowlist/add.js +34 -0
- package/dist/commands/allowlist/remove.d.ts +10 -0
- package/dist/commands/allowlist/remove.js +27 -0
- package/dist/commands/allowlists.d.ts +7 -0
- package/dist/commands/allowlists.js +24 -0
- package/dist/commands/categories/add.d.ts +10 -0
- package/dist/commands/categories/add.js +33 -0
- package/dist/commands/categories/get.d.ts +7 -0
- package/dist/commands/categories/get.js +19 -0
- package/dist/commands/categories/remove.d.ts +9 -0
- package/dist/commands/categories/remove.js +26 -0
- package/dist/commands/deprovision.d.ts +14 -0
- package/dist/commands/deprovision.js +80 -0
- package/dist/commands/suspend/app-owner.d.ts +15 -0
- package/dist/commands/suspend/app-owner.js +87 -0
- package/dist/commands/suspend/apps.d.ts +13 -0
- package/dist/commands/suspend/apps.js +54 -0
- package/dist/commands/suspend/user.d.ts +17 -0
- package/dist/commands/suspend/user.js +110 -0
- package/dist/commands/suspensions.d.ts +9 -0
- package/dist/commands/suspensions.js +25 -0
- package/dist/commands/unsuspend/apps.d.ts +11 -0
- package/dist/commands/unsuspend/apps.js +48 -0
- package/dist/commands/unsuspend/user.d.ts +11 -0
- package/dist/commands/unsuspend/user.js +49 -0
- package/dist/commands/userpass/add.d.ts +10 -0
- package/dist/commands/userpass/add.js +33 -0
- package/dist/commands/userpass/remove.d.ts +10 -0
- package/dist/commands/userpass/remove.js +33 -0
- package/dist/lib/heroku.d.ts +13 -0
- package/dist/lib/heroku.js +32 -0
- package/dist/lib/skynet.d.ts +32 -0
- package/dist/lib/skynet.js +215 -0
- package/dist/lib/sudo.d.ts +1 -0
- package/dist/lib/sudo.js +7 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +57 -0
- package/oclif.manifest.json +730 -0
- package/package.json +61 -23
- package/commands/allowlist/add.js +0 -38
- package/commands/allowlist/remove.js +0 -29
- package/commands/allowlists.js +0 -30
- package/commands/categories/add.js +0 -40
- package/commands/categories/get.js +0 -27
- package/commands/categories/remove.js +0 -33
- package/commands/deprovision.js +0 -42
- package/commands/suspend/app-owner.js +0 -58
- package/commands/suspend/apps.js +0 -34
- package/commands/suspend/user.js +0 -80
- package/commands/suspensions.js +0 -24
- package/commands/unsuspend/apps.js +0 -33
- package/commands/unsuspend/user.js +0 -33
- package/commands/userpass/add.js +0 -21
- package/commands/userpass/remove.js +0 -21
- package/index.js +0 -23
- package/lib/command.js +0 -12
- package/lib/heroku.js +0 -30
- package/lib/notifyOption.js +0 -24
- package/lib/skynet.js +0 -218
- package/lib/sudo.js +0 -5
- package/lib/utils.js +0 -35
package/package.json
CHANGED
|
@@ -1,42 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroku/skynet",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "use Skynet from Heroku CLI",
|
|
5
|
-
"
|
|
6
|
-
"author": "Bob Argenbright @byt3smith",
|
|
5
|
+
"type": "module",
|
|
7
6
|
"repository": "heroku/heroku-skynet-cli",
|
|
8
|
-
"bugs": {
|
|
9
|
-
"url": "https://github.com/heroku/heroku-skynet/issues"
|
|
10
|
-
},
|
|
11
7
|
"keywords": [
|
|
12
8
|
"heroku-plugin"
|
|
13
9
|
],
|
|
14
10
|
"files": [
|
|
15
|
-
"/
|
|
16
|
-
"/
|
|
17
|
-
"
|
|
11
|
+
"/dist",
|
|
12
|
+
"/oclif.manifest.json",
|
|
13
|
+
"README.md"
|
|
18
14
|
],
|
|
19
15
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
16
|
+
"node": ">=23",
|
|
21
17
|
"npm": ">=10"
|
|
22
18
|
},
|
|
23
19
|
"dependencies": {
|
|
24
|
-
"@heroku
|
|
25
|
-
"
|
|
26
|
-
"
|
|
20
|
+
"@heroku-cli/color": "^2.0.4",
|
|
21
|
+
"@heroku-cli/command": "^11.8.0",
|
|
22
|
+
"@heroku/heroku-cli-util": "^10.1.2",
|
|
23
|
+
"@oclif/plugin-help": "^6.2.32",
|
|
24
|
+
"form-data": "^4.0.4",
|
|
25
|
+
"got": "^14.6.0",
|
|
26
|
+
"split": "^1.0.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
29
|
+
"@types/form-data": "^2.5.2",
|
|
30
|
+
"@types/mocha": "^10.0.10",
|
|
31
|
+
"@types/node": "^24.9.2",
|
|
32
|
+
"@types/split": "^1.0.5",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^8.44.0",
|
|
34
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
35
|
+
"c8": "^10.1.3",
|
|
36
|
+
"eslint": "^8.57.1",
|
|
37
|
+
"eslint-plugin-import": "^2.32.0",
|
|
38
|
+
"eslint-plugin-mocha": "^10.4.3",
|
|
39
|
+
"mocha": "^11.7.4",
|
|
40
|
+
"nock": "^14.0.5",
|
|
41
|
+
"np": "^10.2.0",
|
|
42
|
+
"oclif": "^4.22.18",
|
|
43
|
+
"ts-node": "^10.9.2",
|
|
44
|
+
"tsx": "^4.20.6",
|
|
45
|
+
"typescript": "^5.9.3",
|
|
46
|
+
"unexpected": "^13.2.1"
|
|
47
|
+
},
|
|
48
|
+
"oclif": {
|
|
49
|
+
"bin": "heroku",
|
|
50
|
+
"commands": "./dist/commands",
|
|
51
|
+
"devPlugins": [
|
|
52
|
+
"@oclif/plugin-help"
|
|
53
|
+
],
|
|
54
|
+
"topics": {
|
|
55
|
+
"sleuth": {
|
|
56
|
+
"description": "Codescan commands"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"tsc": false,
|
|
60
|
+
"manifest": "./oclif.manifest.json",
|
|
61
|
+
"flexibleTaxonomy": false,
|
|
62
|
+
"tsNodeEnabled": false
|
|
37
63
|
},
|
|
38
64
|
"scripts": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
65
|
+
"build": "rm -rf dist && tsc -b",
|
|
66
|
+
"build:dev": "rm -rf dist && tsc -b --sourcemap",
|
|
67
|
+
"build:full": "rm -rf dist && tsc -b && npm run manifest && npm run readme",
|
|
68
|
+
"manifest": "oclif manifest",
|
|
69
|
+
"readme": "echo 'README generation skipped for legacy plugin format'",
|
|
70
|
+
"release": "np --no-yarn --any-branch",
|
|
71
|
+
"lint": "eslint . --ext .ts --config .eslintrc.json",
|
|
72
|
+
"lint:fix": "eslint . --ext .ts --config .eslintrc.json --fix",
|
|
73
|
+
"posttest": "npm run lint",
|
|
74
|
+
"test": "c8 mocha --forbid-only 'test/**/*.ts'",
|
|
75
|
+
"test:local": "c8 mocha 'test/**/*.ts'",
|
|
76
|
+
"version": "echo 'Version update completed'",
|
|
77
|
+
"prepare": "npm run build && npm run manifest",
|
|
78
|
+
"link": "npm run build && npm run manifest && heroku plugins:link ."
|
|
41
79
|
}
|
|
42
80
|
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
4
|
-
|
|
5
|
-
async function run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
-
await cli.action(
|
|
8
|
-
`adding ${cli.color.cyan(
|
|
9
|
-
context.flags.value
|
|
10
|
-
)} to allowlist with ${cli.color.cyan(context.flags.notes)}`,
|
|
11
|
-
skynet.addAllowlist(context.flags.value, context.flags.notes)
|
|
12
|
-
)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports = {
|
|
16
|
-
topic: 'skynet',
|
|
17
|
-
command: 'allowlist:add',
|
|
18
|
-
description: 'adds an app or user to the allowlist',
|
|
19
|
-
help: `Examples:
|
|
20
|
-
$ heroku skynet:allowlist:add -v foo@bar.com -n Additional info`,
|
|
21
|
-
flags: [
|
|
22
|
-
{
|
|
23
|
-
name: 'value',
|
|
24
|
-
char: 'v',
|
|
25
|
-
description: 'app name or user email to allowlist',
|
|
26
|
-
hasValue: true,
|
|
27
|
-
required: true
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'notes',
|
|
31
|
-
char: 'n',
|
|
32
|
-
description: 'additional information for the allowlist entry',
|
|
33
|
-
hasValue: true,
|
|
34
|
-
required: true
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
run: command(run)
|
|
38
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
4
|
-
|
|
5
|
-
async function run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
-
await cli.action(
|
|
8
|
-
`removing ${cli.color.cyan(context.flags.value)} from allowlist`,
|
|
9
|
-
skynet.removeAllowlist(context.flags.value)
|
|
10
|
-
)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = {
|
|
14
|
-
topic: 'skynet',
|
|
15
|
-
command: 'allowlist:remove',
|
|
16
|
-
description: 'Remove user or app from the allowlist',
|
|
17
|
-
help: `Examples:
|
|
18
|
-
$ heroku skynet:allowlist:remove -v foo@bar.com`,
|
|
19
|
-
flags: [
|
|
20
|
-
{
|
|
21
|
-
name: 'value',
|
|
22
|
-
char: 'v',
|
|
23
|
-
description: 'app name or user email to remove from allowlist',
|
|
24
|
-
hasValue: true,
|
|
25
|
-
required: true
|
|
26
|
-
}
|
|
27
|
-
],
|
|
28
|
-
run: command(run)
|
|
29
|
-
}
|
package/commands/allowlists.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../lib/command')
|
|
3
|
-
const SkynetAPI = require('../lib/skynet')
|
|
4
|
-
|
|
5
|
-
async function run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
-
let response = await skynet.allowlists()
|
|
8
|
-
response = JSON.parse(response)
|
|
9
|
-
if (Object.keys(response).length > 0) {
|
|
10
|
-
cli.table(response, {
|
|
11
|
-
columns: [
|
|
12
|
-
{ key: 'Value' },
|
|
13
|
-
{ key: 'Notes' },
|
|
14
|
-
{ key: 'CreatedAt' },
|
|
15
|
-
{ key: 'UpdatedAt' },
|
|
16
|
-
{ key: 'DeletedAt' }
|
|
17
|
-
]
|
|
18
|
-
})
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
module.exports = {
|
|
23
|
-
topic: 'skynet',
|
|
24
|
-
command: 'allowlists',
|
|
25
|
-
description: 'allowlists used by skynet',
|
|
26
|
-
help: `Examples:
|
|
27
|
-
$ heroku skynet:allowlists`,
|
|
28
|
-
flags: [],
|
|
29
|
-
run: command(run)
|
|
30
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const sudo = require('../../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
5
|
-
|
|
6
|
-
async function run (context) {
|
|
7
|
-
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
await cli.action(
|
|
10
|
-
`adding ${cli.color.cyan(
|
|
11
|
-
context.flags.name
|
|
12
|
-
)} to categories`,
|
|
13
|
-
skynet.addCategory(context.flags.name, context.flags.description)
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
topic: 'skynet',
|
|
19
|
-
command: 'categories:add',
|
|
20
|
-
description: '(requires sudo) Adds a category for use when suspending or deprovisioning',
|
|
21
|
-
help: `Examples:
|
|
22
|
-
$ heroku skynet:add -n Cryptominer -d Abusers running cryptomining on the platform`,
|
|
23
|
-
flags: [
|
|
24
|
-
{
|
|
25
|
-
name: 'name',
|
|
26
|
-
char: 'n',
|
|
27
|
-
description: 'The name of the category',
|
|
28
|
-
hasValue: true,
|
|
29
|
-
required: true
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: 'description',
|
|
33
|
-
char: 'd',
|
|
34
|
-
description: 'The description of the category',
|
|
35
|
-
hasValue: true,
|
|
36
|
-
required: true
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
run: command(run)
|
|
40
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const sudo = require('../../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
5
|
-
|
|
6
|
-
async function run (context) {
|
|
7
|
-
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
let response = await skynet.categories()
|
|
10
|
-
response = JSON.parse(response)
|
|
11
|
-
cli.table(response, {
|
|
12
|
-
columns: [
|
|
13
|
-
{ key: 'Category' },
|
|
14
|
-
{ key: 'Description' }
|
|
15
|
-
]
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
topic: 'skynet',
|
|
21
|
-
command: 'categories',
|
|
22
|
-
description: '(requires sudo) categories to use for suspension and deprovisions',
|
|
23
|
-
help: `Examples:
|
|
24
|
-
$ heroku skynet:categories`,
|
|
25
|
-
flags: [],
|
|
26
|
-
run: command(run)
|
|
27
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const sudo = require('../../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
5
|
-
|
|
6
|
-
async function run (context) {
|
|
7
|
-
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
await cli.action(
|
|
10
|
-
`removing ${cli.color.cyan(
|
|
11
|
-
context.flags.name
|
|
12
|
-
)} from categories`,
|
|
13
|
-
skynet.removeCategory(context.flags.name)
|
|
14
|
-
)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
topic: 'skynet',
|
|
19
|
-
command: 'categories:remove',
|
|
20
|
-
description: '(requires sudo) Removes a category from Skynet',
|
|
21
|
-
help: `Examples:
|
|
22
|
-
$ heroku skynet:add -n Cryptominer`,
|
|
23
|
-
flags: [
|
|
24
|
-
{
|
|
25
|
-
name: 'name',
|
|
26
|
-
char: 'n',
|
|
27
|
-
description: 'The name of the category',
|
|
28
|
-
hasValue: true,
|
|
29
|
-
required: true
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
run: command(run)
|
|
33
|
-
}
|
package/commands/deprovision.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../lib/command')
|
|
3
|
-
const sudo = require('../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../lib/skynet')
|
|
5
|
-
const notifyOption = require('../lib/notifyOption')
|
|
6
|
-
|
|
7
|
-
async function run (context) {
|
|
8
|
-
sudo()
|
|
9
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
10
|
-
const user = context.flags.user || process.env.HEROKU_USER
|
|
11
|
-
const notes = context.flags.notes
|
|
12
|
-
const category = context.flags.category
|
|
13
|
-
const force = context.flags.bypass || process.env.HEROKU_FORCE === '1'
|
|
14
|
-
|
|
15
|
-
const notify = notifyOption.set(context.flags.notify, context.flags['no-notify'])
|
|
16
|
-
const notificationStatus = (notify) ? 'enabled' : 'disabled'
|
|
17
|
-
|
|
18
|
-
if (!user) {
|
|
19
|
-
throw new Error('Required flag: --user USER')
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let response = await cli.action(`Deprovisioning ${cli.color.cyan(user)}`, skynet.deprovision(user, notes, category, notify, force))
|
|
23
|
-
response = JSON.parse(response)
|
|
24
|
-
cli.log(`${cli.color.cyan(response.status)}. ${response.message}. Notification ${notificationStatus}`)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
module.exports = {
|
|
28
|
-
topic: 'skynet',
|
|
29
|
-
command: 'deprovision',
|
|
30
|
-
description: '(requires sudo) suspends a user and deprovisions all addons',
|
|
31
|
-
help: `Examples:
|
|
32
|
-
$ heroku skynet:deprovision -u foo@bar.com -n "helpful suspend message" -c "spam"`,
|
|
33
|
-
flags: [
|
|
34
|
-
{ name: 'user', char: 'u', description: 'user to deprovision', hasValue: true },
|
|
35
|
-
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
36
|
-
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
37
|
-
{ name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false },
|
|
38
|
-
{ name: 'notify', description: 'send user suspension email notification', hasValue: false, required: false },
|
|
39
|
-
{ name: 'no-notify', description: 'skip user suspension email notification', hasValue: false, required: false }
|
|
40
|
-
],
|
|
41
|
-
run: command(run)
|
|
42
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const sudo = require('../../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
5
|
-
const utils = require('../../lib/utils')
|
|
6
|
-
const chunkSize = 5
|
|
7
|
-
|
|
8
|
-
async function run (context) {
|
|
9
|
-
sudo()
|
|
10
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
11
|
-
const app = context.flags.app
|
|
12
|
-
const file = context.flags.infile
|
|
13
|
-
const notes = context.flags.notes
|
|
14
|
-
const category = context.flags.category
|
|
15
|
-
const force = context.flags.bypass || process.env.HEROKU_FORCE === '1'
|
|
16
|
-
const deprovision = context.flags.deprovision
|
|
17
|
-
|
|
18
|
-
if (app && file) {
|
|
19
|
-
throw new Error('Either --app or --infile must be passed, but not both')
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (file) {
|
|
23
|
-
const apps = await utils.readlines(file)
|
|
24
|
-
const chunks = utils.arrayChunks(apps, chunkSize)
|
|
25
|
-
for (const chunk of chunks) {
|
|
26
|
-
cli.log('Suspending app owners: ' + chunk.join())
|
|
27
|
-
const response = await skynet.bulkSuspendAppOwner(apps.join(), notes, category, deprovision)
|
|
28
|
-
cli.log(`${cli.color.cyan(response.status)}. ${response.message}`)
|
|
29
|
-
cli.log()
|
|
30
|
-
}
|
|
31
|
-
} else {
|
|
32
|
-
if (!app) {
|
|
33
|
-
throw new Error('Required flag: --owner OWNER or --infile FILE')
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
let response = await cli.action(`Suspending app owner of ${cli.color.cyan(app)}`,
|
|
37
|
-
skynet.suspendAppOwner(app, notes, category, force, deprovision))
|
|
38
|
-
response = JSON.parse(response)
|
|
39
|
-
cli.log(`${cli.color.cyan(response.status)}. ${response.message}`)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
module.exports = {
|
|
44
|
-
topic: 'skynet',
|
|
45
|
-
command: 'suspend:app-owner',
|
|
46
|
-
description: '(requires sudo) suspends the owner of a given app',
|
|
47
|
-
help: `Examples:
|
|
48
|
-
$ heroku skynet:suspend:app-owner -a foobar -n "helpful suspend message" -c "ddos"`,
|
|
49
|
-
flags: [
|
|
50
|
-
{ name: 'app', char: 'a', description: 'app that requires owner suspension', hasValue: true },
|
|
51
|
-
{ name: 'infile', char: 'i', description: 'file of apps that require owner suspension', hasValue: true },
|
|
52
|
-
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
53
|
-
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
54
|
-
{ name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false },
|
|
55
|
-
{ name: 'deprovision', char: 'd', description: 'put user into the fast resource deletion flow', hasValue: false, required: false }
|
|
56
|
-
],
|
|
57
|
-
run: command(run)
|
|
58
|
-
}
|
package/commands/suspend/apps.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const sudo = require('../../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
5
|
-
|
|
6
|
-
async function run (context) {
|
|
7
|
-
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
let response = await skynet.suspendApp(
|
|
10
|
-
context.flags.app,
|
|
11
|
-
context.flags.notes,
|
|
12
|
-
context.flags.category,
|
|
13
|
-
context.flags.bypass || process.env.HEROKU_FORCE === '1'
|
|
14
|
-
)
|
|
15
|
-
response = JSON.parse(response)
|
|
16
|
-
cli.log(
|
|
17
|
-
`Suspending app ${context.flags.app}...\n${cli.color.cyan(response.status)}. ${response.message}`
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = {
|
|
22
|
-
topic: 'skynet',
|
|
23
|
-
command: 'suspend:app',
|
|
24
|
-
description: '(requires sudo) suspends an app',
|
|
25
|
-
help: `Examples:
|
|
26
|
-
$ heroku skynet:suspend:app -a test-app -c "category" -n "helpful suspend message"`,
|
|
27
|
-
flags: [
|
|
28
|
-
{ name: 'app', char: 'a', description: 'app to suspend', hasValue: true, required: true },
|
|
29
|
-
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
30
|
-
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
31
|
-
{ name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false }
|
|
32
|
-
],
|
|
33
|
-
run: command(run)
|
|
34
|
-
}
|
package/commands/suspend/user.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const sudo = require('../../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
5
|
-
const HerokuAPI = require('../../lib/heroku')
|
|
6
|
-
const notifyOption = require('../../lib/notifyOption')
|
|
7
|
-
const utils = require('../../lib/utils')
|
|
8
|
-
const chunkSize = 5
|
|
9
|
-
|
|
10
|
-
async function unverifyUser (api, user) {
|
|
11
|
-
const resMsg = await api.unverifyUser(user)
|
|
12
|
-
cli.log('Unverify ' + user + ': ' + resMsg)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async function run (context) {
|
|
16
|
-
sudo()
|
|
17
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
18
|
-
const api = new HerokuAPI(context.auth.password)
|
|
19
|
-
const user = context.flags.user || process.env.HEROKU_USER
|
|
20
|
-
const file = context.flags.infile
|
|
21
|
-
const notes = context.flags.notes
|
|
22
|
-
const category = context.flags.category
|
|
23
|
-
const force = context.flags.bypass || process.env.HEROKU_FORCE === '1'
|
|
24
|
-
const unverify = context.flags.unverify
|
|
25
|
-
const deprovision = context.flags.deprovision
|
|
26
|
-
|
|
27
|
-
const notify = notifyOption.set(context.flags.notify, context.flags['no-notify'])
|
|
28
|
-
const notificationStatus = (notify) ? 'enabled' : 'disabled'
|
|
29
|
-
|
|
30
|
-
if (user && file) {
|
|
31
|
-
throw new Error('Either --user USER or --infile must be passed, but not both')
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (file) {
|
|
35
|
-
const users = await utils.readlines(file)
|
|
36
|
-
const chunks = utils.arrayChunks(users, chunkSize)
|
|
37
|
-
for (const chunk of chunks) {
|
|
38
|
-
cli.log('Suspending users: ' + chunk.join())
|
|
39
|
-
const response = await skynet.bulkSuspendUsers(chunk.join(), notes, category, notify, force, deprovision)
|
|
40
|
-
cli.log(`${response}. Notification ${notificationStatus}`)
|
|
41
|
-
cli.log()
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (unverify) {
|
|
45
|
-
users.forEach(item => unverifyUser(api, item))
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
if (!user) {
|
|
49
|
-
throw new Error('Required flag: --user USER or --infile FILE')
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let response = await skynet.suspendUser(user, notes, category, notify, force, deprovision)
|
|
53
|
-
response = JSON.parse(response)
|
|
54
|
-
cli.log(`Suspending user ${user}...\n${response.status}. ${response.message}. Notification ${notificationStatus}`)
|
|
55
|
-
|
|
56
|
-
if (unverify) {
|
|
57
|
-
unverifyUser(api, user)
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
module.exports = {
|
|
63
|
-
topic: 'skynet',
|
|
64
|
-
command: 'suspend:user',
|
|
65
|
-
description: '(requires sudo) suspends a user',
|
|
66
|
-
help: `Examples:
|
|
67
|
-
$ heroku sudo skynet:suspend:user -u foo@bar.com -n "helpful suspend message" -c "ddos"`,
|
|
68
|
-
flags: [
|
|
69
|
-
{ name: 'user', char: 'u', description: 'user to suspend', hasValue: true },
|
|
70
|
-
{ name: 'infile', char: 'i', description: 'file of users to suspend', hasValue: true },
|
|
71
|
-
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
72
|
-
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
73
|
-
{ name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false },
|
|
74
|
-
{ name: 'no-notify', description: 'skip user suspension email notification', hasValue: false, required: false },
|
|
75
|
-
{ name: 'notify', description: 'send user suspension email notification', hasValue: false, required: false },
|
|
76
|
-
{ name: 'unverify', description: 'unverifies a user account, removes all billing info', hasValue: false, required: false },
|
|
77
|
-
{ name: 'deprovision', char: 'd', description: 'put user into the fast resource deletion flow', hasValue: false, required: false }
|
|
78
|
-
],
|
|
79
|
-
run: command(run)
|
|
80
|
-
}
|
package/commands/suspensions.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../lib/command')
|
|
3
|
-
const sudo = require('../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../lib/skynet')
|
|
5
|
-
|
|
6
|
-
async function run (context) {
|
|
7
|
-
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
let response = await skynet.suspensions(context.flags.account)
|
|
10
|
-
response = JSON.parse(response)
|
|
11
|
-
cli.log(response)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
module.exports = {
|
|
15
|
-
topic: 'skynet',
|
|
16
|
-
command: 'suspensions',
|
|
17
|
-
description: '(requires sudo) suspension history of the given user account',
|
|
18
|
-
help: `Examples:
|
|
19
|
-
$ heroku skynet:suspensions -a [user account]`,
|
|
20
|
-
flags: [
|
|
21
|
-
{ name: 'account', char: 'a', description: 'user account email', hasValue: true, required: true }
|
|
22
|
-
],
|
|
23
|
-
run: command(run)
|
|
24
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const sudo = require('../../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
5
|
-
|
|
6
|
-
async function run (context) {
|
|
7
|
-
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
const app = context.flags.app
|
|
10
|
-
const category = context.flags.category
|
|
11
|
-
const notes = context.flags.notes
|
|
12
|
-
|
|
13
|
-
if (!app) {
|
|
14
|
-
throw new Error('Required flag: --app APP')
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const response = await skynet.unsuspendApp(app, category, notes)
|
|
18
|
-
cli.log(`Unsuspending app ${app}...\n${cli.color.cyan(response.status)}. ${response.message}`)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = {
|
|
22
|
-
topic: 'skynet',
|
|
23
|
-
command: 'unsuspend:app',
|
|
24
|
-
description: '(requires sudo) unsuspends an app',
|
|
25
|
-
help: `Examples:
|
|
26
|
-
$ heroku skynet:unsuspend:app -a test-app -n "helpful unsuspend message" -c "unsuspend-apology"`,
|
|
27
|
-
flags: [
|
|
28
|
-
{ name: 'app', char: 'a', description: 'app to unsuspend', hasValue: true, required: true },
|
|
29
|
-
{ name: 'category', char: 'c', description: 'unsuspension category', hasValue: true, required: true },
|
|
30
|
-
{ name: 'notes', char: 'n', description: 'unsuspend notes', hasValue: true, required: true }
|
|
31
|
-
],
|
|
32
|
-
run: command(run)
|
|
33
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const sudo = require('../../lib/sudo')
|
|
4
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
5
|
-
|
|
6
|
-
async function run (context) {
|
|
7
|
-
sudo()
|
|
8
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
9
|
-
const user = context.flags.user || process.env.HEROKU_USER
|
|
10
|
-
const category = context.flags.category
|
|
11
|
-
const notes = context.flags.notes
|
|
12
|
-
|
|
13
|
-
if (!user) {
|
|
14
|
-
throw new Error('Required flag: --user USER')
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const response = await cli.action(`Unsuspending ${cli.color.cyan(user)}`, skynet.unsuspendUser(user, category, notes))
|
|
18
|
-
cli.log(`${cli.color.cyan(response.status)}. ${response.message}`)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = {
|
|
22
|
-
topic: 'skynet',
|
|
23
|
-
command: 'unsuspend:user',
|
|
24
|
-
description: '(requires sudo) unsuspends a user',
|
|
25
|
-
help: `Examples:
|
|
26
|
-
$ heroku skynet:unsuspend:user -u foo@bar.com -n "helpful unsuspend message" -c "unsuspend-account-recovery""`,
|
|
27
|
-
flags: [
|
|
28
|
-
{ name: 'user', char: 'u', description: 'user to unsuspend', hasValue: true },
|
|
29
|
-
{ name: 'category', char: 'c', description: 'unsuspension category', hasValue: true, required: true },
|
|
30
|
-
{ name: 'notes', char: 'n', description: 'unsuspend notes', hasValue: true, required: true }
|
|
31
|
-
],
|
|
32
|
-
run: command(run)
|
|
33
|
-
}
|
package/commands/userpass/add.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
4
|
-
|
|
5
|
-
async function run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
-
await cli.action(`adding ${cli.color.cyan(context.flags.flag)} to ${cli.color.cyan(context.flags.user)}`, skynet.addUserpass(context.flags.user, context.flags.flag))
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
topic: 'skynet',
|
|
12
|
-
command: 'userpass:add',
|
|
13
|
-
description: 'adds a userpass flag to a given user',
|
|
14
|
-
help: `Examples:
|
|
15
|
-
$ heroku skynet:userpass:add -u foo@bar.com -f cant-install-abused-addons`,
|
|
16
|
-
flags: [
|
|
17
|
-
{ name: 'user', char: 'u', description: 'user to apply userpass flag to', hasValue: true, required: true },
|
|
18
|
-
{ name: 'flag', char: 'f', description: 'flag to add to the given user', hasValue: true, required: true }
|
|
19
|
-
],
|
|
20
|
-
run: command(run)
|
|
21
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const cli = require('@heroku/heroku-cli-util')
|
|
2
|
-
const command = require('../../lib/command')
|
|
3
|
-
const SkynetAPI = require('../../lib/skynet')
|
|
4
|
-
|
|
5
|
-
async function run (context) {
|
|
6
|
-
const skynet = new SkynetAPI(context.auth.password)
|
|
7
|
-
await cli.action(`removing ${cli.color.cyan(context.flags.flag)} from ${cli.color.cyan(context.flags.user)}`, skynet.removeUserpass(context.flags.user, context.flags.flag))
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
topic: 'skynet',
|
|
12
|
-
command: 'userpass:remove',
|
|
13
|
-
description: 'removes given flag from a given user',
|
|
14
|
-
help: `Examples:
|
|
15
|
-
$ heroku skynet:userpass:remove -u foo@bar.com -f cant-install-abused-addons`,
|
|
16
|
-
flags: [
|
|
17
|
-
{ name: 'user', char: 'u', description: 'user to remove user_pass from', hasValue: true, required: true },
|
|
18
|
-
{ name: 'flag', char: 'f', description: 'flag to remove from given user', hasValue: true, required: true }
|
|
19
|
-
],
|
|
20
|
-
run: command(run)
|
|
21
|
-
}
|