@heroku/skynet 1.11.0 → 1.12.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/commands/allowlist/add.js +1 -1
- package/commands/allowlist/remove.js +1 -1
- package/commands/allowlists.js +1 -1
- package/commands/categories/add.js +40 -0
- package/commands/{categories.js → categories/get.js} +4 -4
- package/commands/categories/remove.js +33 -0
- package/commands/deprovision.js +3 -3
- package/commands/suspend/app-owner.js +3 -3
- package/commands/suspend/apps.js +6 -29
- package/commands/suspend/user.js +3 -3
- package/commands/suspensions.js +1 -1
- package/commands/unsuspend/apps.js +1 -1
- package/commands/unsuspend/user.js +1 -1
- package/commands/userpass/add.js +1 -1
- package/commands/userpass/remove.js +1 -1
- package/index.js +3 -1
- package/lib/command.js +1 -1
- package/lib/skynet.js +29 -24
- package/package.json +4 -4
package/commands/allowlists.js
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
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,7 +1,7 @@
|
|
|
1
|
-
const cli = require('heroku-cli-util')
|
|
2
|
-
const command = require('
|
|
3
|
-
const sudo = require('
|
|
4
|
-
const SkynetAPI = require('
|
|
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
5
|
|
|
6
6
|
async function run (context) {
|
|
7
7
|
sudo()
|
|
@@ -0,0 +1,33 @@
|
|
|
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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const cli = require('heroku-cli-util')
|
|
1
|
+
const cli = require('@heroku/heroku-cli-util')
|
|
2
2
|
const command = require('../lib/command')
|
|
3
3
|
const sudo = require('../lib/sudo')
|
|
4
4
|
const SkynetAPI = require('../lib/skynet')
|
|
@@ -10,7 +10,7 @@ async function run (context) {
|
|
|
10
10
|
const user = context.flags.user || process.env.HEROKU_USER
|
|
11
11
|
const notes = context.flags.notes
|
|
12
12
|
const category = context.flags.category
|
|
13
|
-
const force = context.flags.bypass
|
|
13
|
+
const force = context.flags.bypass || process.env.HEROKU_FORCE === '1'
|
|
14
14
|
|
|
15
15
|
const notify = notifyOption.set(context.flags.notify, context.flags['no-notify'])
|
|
16
16
|
const notificationStatus = (notify) ? 'enabled' : 'disabled'
|
|
@@ -34,7 +34,7 @@ module.exports = {
|
|
|
34
34
|
{ name: 'user', char: 'u', description: 'user to deprovision', hasValue: true },
|
|
35
35
|
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
36
36
|
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
37
|
-
{ name: 'bypass', description: '
|
|
37
|
+
{ name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false },
|
|
38
38
|
{ name: 'notify', description: 'send user suspension email notification', hasValue: false, required: false },
|
|
39
39
|
{ name: 'no-notify', description: 'skip user suspension email notification', hasValue: false, required: false }
|
|
40
40
|
],
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const cli = require('heroku-cli-util')
|
|
1
|
+
const cli = require('@heroku/heroku-cli-util')
|
|
2
2
|
const command = require('../../lib/command')
|
|
3
3
|
const sudo = require('../../lib/sudo')
|
|
4
4
|
const SkynetAPI = require('../../lib/skynet')
|
|
@@ -12,7 +12,7 @@ async function run (context) {
|
|
|
12
12
|
const file = context.flags.infile
|
|
13
13
|
const notes = context.flags.notes
|
|
14
14
|
const category = context.flags.category
|
|
15
|
-
const force = context.flags.bypass
|
|
15
|
+
const force = context.flags.bypass || process.env.HEROKU_FORCE === '1'
|
|
16
16
|
|
|
17
17
|
if (app && file) {
|
|
18
18
|
throw new Error('Either --app or --infile must be passed, but not both')
|
|
@@ -50,7 +50,7 @@ module.exports = {
|
|
|
50
50
|
{ name: 'infile', char: 'i', description: 'file of apps that require owner suspension', hasValue: true },
|
|
51
51
|
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
52
52
|
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
53
|
-
{ name: 'bypass', description: '
|
|
53
|
+
{ name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false }
|
|
54
54
|
],
|
|
55
55
|
run: command(run)
|
|
56
56
|
}
|
package/commands/suspend/apps.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const cli = require('heroku-cli-util')
|
|
1
|
+
const cli = require('@heroku/heroku-cli-util')
|
|
2
2
|
const command = require('../../lib/command')
|
|
3
3
|
const sudo = require('../../lib/sudo')
|
|
4
4
|
const SkynetAPI = require('../../lib/skynet')
|
|
@@ -10,7 +10,7 @@ async function run (context) {
|
|
|
10
10
|
context.flags.app,
|
|
11
11
|
context.flags.notes,
|
|
12
12
|
context.flags.category,
|
|
13
|
-
context.flags.bypass
|
|
13
|
+
context.flags.bypass || process.env.HEROKU_FORCE === '1'
|
|
14
14
|
)
|
|
15
15
|
response = JSON.parse(response)
|
|
16
16
|
cli.log(
|
|
@@ -25,33 +25,10 @@ module.exports = {
|
|
|
25
25
|
help: `Examples:
|
|
26
26
|
$ heroku skynet:suspend:app -a test-app -c "category" -n "helpful suspend message"`,
|
|
27
27
|
flags: [
|
|
28
|
-
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
hasValue: true,
|
|
33
|
-
required: true
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'notes',
|
|
37
|
-
char: 'n',
|
|
38
|
-
description: 'suspend notes',
|
|
39
|
-
hasValue: true,
|
|
40
|
-
required: true
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: 'category',
|
|
44
|
-
char: 'c',
|
|
45
|
-
description: 'suspension category',
|
|
46
|
-
hasValue: true,
|
|
47
|
-
required: true
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'bypass',
|
|
51
|
-
description: 'force suspension',
|
|
52
|
-
hasValue: false,
|
|
53
|
-
required: false
|
|
54
|
-
}
|
|
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 }
|
|
55
32
|
],
|
|
56
33
|
run: command(run)
|
|
57
34
|
}
|
package/commands/suspend/user.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const cli = require('heroku-cli-util')
|
|
1
|
+
const cli = require('@heroku/heroku-cli-util')
|
|
2
2
|
const command = require('../../lib/command')
|
|
3
3
|
const sudo = require('../../lib/sudo')
|
|
4
4
|
const SkynetAPI = require('../../lib/skynet')
|
|
@@ -20,7 +20,7 @@ async function run (context) {
|
|
|
20
20
|
const file = context.flags.infile
|
|
21
21
|
const notes = context.flags.notes
|
|
22
22
|
const category = context.flags.category
|
|
23
|
-
const force = context.flags.bypass
|
|
23
|
+
const force = context.flags.bypass || process.env.HEROKU_FORCE === '1'
|
|
24
24
|
const unverify = context.flags.unverify
|
|
25
25
|
|
|
26
26
|
const notify = notifyOption.set(context.flags.notify, context.flags['no-notify'])
|
|
@@ -69,7 +69,7 @@ module.exports = {
|
|
|
69
69
|
{ name: 'infile', char: 'i', description: 'file of users to suspend', hasValue: true },
|
|
70
70
|
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
71
71
|
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
72
|
-
{ name: 'bypass', description: '
|
|
72
|
+
{ name: 'bypass', description: 'force suspension, bypassing skynet safety checks', hasValue: false, required: false },
|
|
73
73
|
{ name: 'no-notify', description: 'skip user suspension email notification', hasValue: false, required: false },
|
|
74
74
|
{ name: 'notify', description: 'send user suspension email notification', hasValue: false, required: false },
|
|
75
75
|
{ name: 'unverify', description: 'unverifies a user account, removes all billing info', hasValue: false, required: false }
|
package/commands/suspensions.js
CHANGED
package/commands/userpass/add.js
CHANGED
package/index.js
CHANGED
|
@@ -13,7 +13,9 @@ exports.commands = [
|
|
|
13
13
|
require('./commands/unsuspend/apps.js'),
|
|
14
14
|
require('./commands/unsuspend/user.js'),
|
|
15
15
|
require('./commands/deprovision.js'),
|
|
16
|
-
require('./commands/categories.js'),
|
|
16
|
+
require('./commands/categories/add.js'),
|
|
17
|
+
require('./commands/categories/get.js'),
|
|
18
|
+
require('./commands/categories/remove.js'),
|
|
17
19
|
require('./commands/allowlist/add.js'),
|
|
18
20
|
require('./commands/allowlist/remove.js'),
|
|
19
21
|
require('./commands/allowlists.js'),
|
package/lib/command.js
CHANGED
package/lib/skynet.js
CHANGED
|
@@ -32,6 +32,23 @@ module.exports = class SkynetAPI {
|
|
|
32
32
|
})
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
addCategory (name, description) {
|
|
36
|
+
const body = {
|
|
37
|
+
category: name,
|
|
38
|
+
description: description
|
|
39
|
+
}
|
|
40
|
+
return this.request('/categories', {
|
|
41
|
+
method: 'POST',
|
|
42
|
+
form: body
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
removeCategory (name) {
|
|
47
|
+
return this.request(`/categories/${name}`, {
|
|
48
|
+
method: 'DELETE'
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
35
52
|
allowlists () {
|
|
36
53
|
return this.request('/whitelist', {
|
|
37
54
|
method: 'GET'
|
|
@@ -46,16 +63,14 @@ module.exports = class SkynetAPI {
|
|
|
46
63
|
|
|
47
64
|
return this.request('/whitelist', {
|
|
48
65
|
method: 'POST',
|
|
49
|
-
|
|
50
|
-
form: true
|
|
66
|
+
form: body
|
|
51
67
|
})
|
|
52
68
|
}
|
|
53
69
|
|
|
54
70
|
removeAllowlist (appOrUserEmail) {
|
|
55
71
|
return this.request(`/whitelist/${appOrUserEmail}`, {
|
|
56
72
|
method: 'DELETE',
|
|
57
|
-
|
|
58
|
-
json: true
|
|
73
|
+
json: {}
|
|
59
74
|
})
|
|
60
75
|
}
|
|
61
76
|
|
|
@@ -67,8 +82,7 @@ module.exports = class SkynetAPI {
|
|
|
67
82
|
|
|
68
83
|
return this.request('/userpass/remove', {
|
|
69
84
|
method: 'POST',
|
|
70
|
-
|
|
71
|
-
form: true
|
|
85
|
+
form: body
|
|
72
86
|
})
|
|
73
87
|
}
|
|
74
88
|
|
|
@@ -80,8 +94,7 @@ module.exports = class SkynetAPI {
|
|
|
80
94
|
|
|
81
95
|
return this.request('/userpass/add', {
|
|
82
96
|
method: 'POST',
|
|
83
|
-
|
|
84
|
-
form: true
|
|
97
|
+
form: body
|
|
85
98
|
})
|
|
86
99
|
}
|
|
87
100
|
|
|
@@ -96,8 +109,7 @@ module.exports = class SkynetAPI {
|
|
|
96
109
|
|
|
97
110
|
return this.request('/suspend/app-owner', {
|
|
98
111
|
method: 'POST',
|
|
99
|
-
|
|
100
|
-
form: true
|
|
112
|
+
form: body
|
|
101
113
|
})
|
|
102
114
|
}
|
|
103
115
|
|
|
@@ -112,16 +124,14 @@ module.exports = class SkynetAPI {
|
|
|
112
124
|
|
|
113
125
|
return this.request('/suspend/app', {
|
|
114
126
|
method: 'POST',
|
|
115
|
-
|
|
116
|
-
form: true
|
|
127
|
+
form: body
|
|
117
128
|
})
|
|
118
129
|
}
|
|
119
130
|
|
|
120
131
|
unsuspendApp (app, category, notes) {
|
|
121
132
|
return this.request(`/suspensions/app/${app}?category=${category}&reason=${notes}`, {
|
|
122
133
|
method: 'DELETE',
|
|
123
|
-
|
|
124
|
-
json: true
|
|
134
|
+
json: {}
|
|
125
135
|
})
|
|
126
136
|
}
|
|
127
137
|
|
|
@@ -137,16 +147,14 @@ module.exports = class SkynetAPI {
|
|
|
137
147
|
|
|
138
148
|
return this.request('/suspend/user', {
|
|
139
149
|
method: 'POST',
|
|
140
|
-
|
|
141
|
-
form: true
|
|
150
|
+
form: body
|
|
142
151
|
})
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
unsuspendUser (user, category, notes) {
|
|
146
155
|
return this.request(`/suspensions/user/${user}?category=${category}&reason=${notes}`, {
|
|
147
156
|
method: 'DELETE',
|
|
148
|
-
|
|
149
|
-
json: true
|
|
157
|
+
json: {}
|
|
150
158
|
})
|
|
151
159
|
}
|
|
152
160
|
|
|
@@ -163,8 +171,7 @@ module.exports = class SkynetAPI {
|
|
|
163
171
|
|
|
164
172
|
return this.request('/suspend/user', {
|
|
165
173
|
method: 'POST',
|
|
166
|
-
|
|
167
|
-
form: true
|
|
174
|
+
form: body
|
|
168
175
|
})
|
|
169
176
|
}
|
|
170
177
|
|
|
@@ -179,8 +186,7 @@ module.exports = class SkynetAPI {
|
|
|
179
186
|
|
|
180
187
|
return this.request('/suspend/app-owner', {
|
|
181
188
|
method: 'POST',
|
|
182
|
-
|
|
183
|
-
form: true
|
|
189
|
+
form: body
|
|
184
190
|
})
|
|
185
191
|
}
|
|
186
192
|
|
|
@@ -196,8 +202,7 @@ module.exports = class SkynetAPI {
|
|
|
196
202
|
|
|
197
203
|
return this.request('/deprovision', {
|
|
198
204
|
method: 'POST',
|
|
199
|
-
|
|
200
|
-
form: true
|
|
205
|
+
form: body
|
|
201
206
|
})
|
|
202
207
|
}
|
|
203
208
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heroku/skynet",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "use Skynet from Heroku CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "Bob Argenbright @byt3smith",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"npm": ">=10"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
24
|
+
"@heroku/heroku-cli-util": "^8.0.12",
|
|
25
|
+
"got": "^11.8.5",
|
|
26
26
|
"split": "^1.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"mocha": "^9.2.2",
|
|
32
32
|
"mockdate": "^2.0.1",
|
|
33
33
|
"nock": "^12.0.3",
|
|
34
|
-
"np": "^
|
|
34
|
+
"np": "^10.0.5",
|
|
35
35
|
"standard": "^16.0.4",
|
|
36
36
|
"unexpected": "^12.0.3"
|
|
37
37
|
},
|