screwdriver-api 8.0.178 → 8.0.180

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.
Files changed (42) hide show
  1. package/package.json +1 -1
  2. package/plugins/auth/index.js +2 -2
  3. package/plugins/auth/token.js +3 -3
  4. package/plugins/buildClusters/create.js +5 -0
  5. package/plugins/buildClusters/get.js +5 -0
  6. package/plugins/buildClusters/list.js +5 -0
  7. package/plugins/buildClusters/remove.js +5 -0
  8. package/plugins/buildClusters/update.js +5 -0
  9. package/plugins/builds/artifacts/get.js +5 -0
  10. package/plugins/builds/artifacts/getAll.js +5 -0
  11. package/plugins/builds/artifacts/unzip.js +5 -0
  12. package/plugins/builds/create.js +3 -0
  13. package/plugins/builds/get.js +5 -0
  14. package/plugins/builds/getBuildStatuses.js +5 -0
  15. package/plugins/builds/listSecrets.js +5 -0
  16. package/plugins/builds/metrics.js +5 -0
  17. package/plugins/builds/steps/get.js +5 -0
  18. package/plugins/builds/steps/list.js +5 -0
  19. package/plugins/builds/steps/logs.js +5 -0
  20. package/plugins/builds/update.js +5 -0
  21. package/plugins/coverage/info.js +5 -0
  22. package/plugins/isAdmin.js +3 -0
  23. package/plugins/jobs/buildCluster/remove.js +5 -0
  24. package/plugins/jobs/buildCluster/update.js +5 -0
  25. package/plugins/jobs/get.js +5 -0
  26. package/plugins/jobs/lastSuccessfulMeta.js +5 -0
  27. package/plugins/jobs/latestBuild.js +5 -0
  28. package/plugins/jobs/listBuilds.js +5 -0
  29. package/plugins/jobs/metrics.js +5 -0
  30. package/plugins/jobs/notify.js +5 -0
  31. package/plugins/jobs/update.js +5 -0
  32. package/plugins/secrets/create.js +5 -0
  33. package/plugins/secrets/get.js +5 -0
  34. package/plugins/secrets/remove.js +5 -0
  35. package/plugins/secrets/update.js +5 -0
  36. package/plugins/stages/get.js +5 -0
  37. package/plugins/stages/stageBuilds/list.js +5 -0
  38. package/plugins/tokens/create.js +5 -0
  39. package/plugins/tokens/list.js +5 -0
  40. package/plugins/tokens/refresh.js +5 -0
  41. package/plugins/tokens/remove.js +5 -0
  42. package/plugins/tokens/update.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screwdriver-api",
3
- "version": "8.0.178",
3
+ "version": "8.0.180",
4
4
  "description": "API server for the Screwdriver.cd service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -115,13 +115,13 @@ const authPlugin = {
115
115
  throw boom.unauthorized();
116
116
  }
117
117
 
118
- const credentials = request.auth.credentials;
118
+ const { credentials } = request.auth;
119
119
 
120
120
  if (!credentials.auth || credentials.auth.type !== 'api_token') {
121
121
  return h.continue;
122
122
  }
123
123
 
124
- const apiTokenId = credentials.auth.apiTokenId;
124
+ const { apiTokenId } = credentials.auth;
125
125
 
126
126
  if (!apiTokenId) {
127
127
  throw boom.forbidden(`Your token is invalid`);
@@ -29,13 +29,13 @@ module.exports = () => ({
29
29
  },
30
30
  handler: async (request, h) => {
31
31
  let profile = request.auth.credentials;
32
- const { scope, token, username } = profile;
32
+ const { scope, token, username, permission = 'all' } = profile;
33
33
  const { buildFactory, jobFactory, pipelineFactory } = request.server.app;
34
34
 
35
35
  // Check Build ID impersonate
36
36
  if (request.params.buildId) {
37
- if (!scope.includes('admin')) {
38
- return boom.forbidden(`User ${username} is not an admin and cannot impersonate`);
37
+ if (!scope.includes('admin') || permission !== 'all') {
38
+ return boom.forbidden(`User ${username} must be an admin with all permission to impersonate`);
39
39
  }
40
40
 
41
41
  const build = await buildFactory.get(request.params.buildId);
@@ -15,6 +15,11 @@ module.exports = () => ({
15
15
  strategies: ['token'],
16
16
  scope: ['user', '!guest']
17
17
  },
18
+ plugins: {
19
+ authorization: {
20
+ permission: 'all'
21
+ }
22
+ },
18
23
 
19
24
  handler: async (request, h) => {
20
25
  const { buildClusterFactory, bannerFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', 'build']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'read'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { name } = request.params;
@@ -15,6 +15,11 @@ module.exports = () => ({
15
15
  strategies: ['token'],
16
16
  scope: ['user', '!guest']
17
17
  },
18
+ plugins: {
19
+ authorization: {
20
+ permission: 'read'
21
+ }
22
+ },
18
23
 
19
24
  handler: async (request, h) => {
20
25
  const { buildClusterFactory } = request.server.app;
@@ -16,6 +16,11 @@ module.exports = () => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', '!guest']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'all'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (request, h) => {
21
26
  const { buildClusterFactory, userFactory, bannerFactory } = request.server.app;
@@ -16,6 +16,11 @@ module.exports = () => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', '!guest']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'all'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (request, h) => {
21
26
  const { buildClusterFactory, bannerFactory } = request.server.app;
@@ -29,6 +29,11 @@ module.exports = config => ({
29
29
  strategies: ['session', 'token'],
30
30
  scope: ['user', 'build', 'pipeline']
31
31
  },
32
+ plugins: {
33
+ authorization: {
34
+ permission: 'read'
35
+ }
36
+ },
32
37
 
33
38
  handler: async (req, h) => {
34
39
  const artifact = req.params.name;
@@ -28,6 +28,11 @@ module.exports = config => ({
28
28
  strategies: ['session', 'token'],
29
29
  scope: ['user', 'build', 'pipeline']
30
30
  },
31
+ plugins: {
32
+ authorization: {
33
+ permission: 'read'
34
+ }
35
+ },
31
36
 
32
37
  handler: async (req, h) => {
33
38
  const { name: artifact, id: buildId } = req.params;
@@ -16,6 +16,11 @@ module.exports = config => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', 'build']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'all'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (req, h) => {
21
26
  if (!req.server.app.unzipArtifacts) {
@@ -19,6 +19,9 @@ module.exports = () => ({
19
19
  'hapi-swagger': {
20
20
  security: [{ token: [] }],
21
21
  deprecated: true
22
+ },
23
+ authorization: {
24
+ permission: 'execute'
22
25
  }
23
26
  },
24
27
  handler: async (request, h) => {
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', 'build', 'pipeline']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'read'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { buildFactory } = request.server.app;
@@ -16,6 +16,11 @@ module.exports = () => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', 'build', 'pipeline']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'read'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (request, h) => {
21
26
  const { buildFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', 'build', '!guest']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'read'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const factory = request.server.app.buildFactory;
@@ -19,6 +19,11 @@ module.exports = () => ({
19
19
  strategies: ['token'],
20
20
  scope: ['user', '!guest', 'build']
21
21
  },
22
+ plugins: {
23
+ authorization: {
24
+ permission: 'read'
25
+ }
26
+ },
22
27
 
23
28
  handler: async (request, h) => {
24
29
  const factory = request.server.app.buildFactory;
@@ -15,6 +15,11 @@ module.exports = () => ({
15
15
  strategies: ['token'],
16
16
  scope: ['user', 'build', 'pipeline']
17
17
  },
18
+ plugins: {
19
+ authorization: {
20
+ permission: 'read'
21
+ }
22
+ },
18
23
 
19
24
  handler: async (request, h) => {
20
25
  const { stepFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', 'build', 'pipeline', '!guest', 'temporal']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'read'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { stepFactory } = request.server.app;
@@ -289,6 +289,11 @@ module.exports = config => ({
289
289
  strategies: ['token', 'session'],
290
290
  scope: ['user', 'pipeline', 'build']
291
291
  },
292
+ plugins: {
293
+ authorization: {
294
+ permission: 'read'
295
+ }
296
+ },
292
297
 
293
298
  handler: (req, h) => {
294
299
  const { credentials } = req.auth;
@@ -90,6 +90,11 @@ module.exports = () => ({
90
90
  strategies: ['token'],
91
91
  scope: ['build', 'pipeline', 'user', '!guest', 'temporal']
92
92
  },
93
+ plugins: {
94
+ authorization: {
95
+ permission: 'execute'
96
+ }
97
+ },
93
98
 
94
99
  handler: async (request, h) => {
95
100
  const { buildFactory } = request.server.app;
@@ -11,6 +11,11 @@ module.exports = config => ({
11
11
  strategies: ['token'],
12
12
  scope: ['user', 'build']
13
13
  },
14
+ plugins: {
15
+ authorization: {
16
+ permission: 'read'
17
+ }
18
+ },
14
19
 
15
20
  handler: async (request, h) => {
16
21
  const data = await config.coveragePlugin.getInfo(request.query);
@@ -21,6 +21,9 @@ const isAdminPlugin = {
21
21
  plugins: {
22
22
  'hapi-swagger': {
23
23
  security: [{ token: [] }]
24
+ },
25
+ authorization: {
26
+ permission: 'read'
24
27
  }
25
28
  },
26
29
  handler: async (request, h) =>
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', '!guest']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'all'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { jobFactory, bannerFactory, userFactory, pipelineFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', '!guest']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'all'
23
+ }
24
+ },
20
25
  handler: async (request, h) => {
21
26
  const adminAnnotation = 'screwdriver.cd/sdAdminBuildClusterOverride';
22
27
  const { payload } = request;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', 'build', 'pipeline']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'read'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const factory = request.server.app.jobFactory;
@@ -16,6 +16,11 @@ module.exports = () => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', 'build', 'pipeline']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'read'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (request, h) => {
21
26
  const factory = request.server.app.jobFactory;
@@ -18,6 +18,11 @@ module.exports = () => ({
18
18
  strategies: ['token'],
19
19
  scope: ['user', 'build', 'pipeline']
20
20
  },
21
+ plugins: {
22
+ authorization: {
23
+ permission: 'read'
24
+ }
25
+ },
21
26
 
22
27
  handler: async (request, h) => {
23
28
  const { jobFactory } = request.server.app;
@@ -18,6 +18,11 @@ module.exports = () => ({
18
18
  strategies: ['token'],
19
19
  scope: ['user', 'pipeline', 'build']
20
20
  },
21
+ plugins: {
22
+ authorization: {
23
+ permission: 'read'
24
+ }
25
+ },
21
26
 
22
27
  handler: async (request, h) => {
23
28
  const factory = request.server.app.jobFactory;
@@ -19,6 +19,11 @@ module.exports = () => ({
19
19
  strategies: ['token'],
20
20
  scope: ['user', '!guest', 'pipeline']
21
21
  },
22
+ plugins: {
23
+ authorization: {
24
+ permission: 'read'
25
+ }
26
+ },
22
27
 
23
28
  handler: async (request, h) => {
24
29
  const factory = request.server.app.jobFactory;
@@ -18,6 +18,11 @@ module.exports = () => ({
18
18
  strategies: ['token'],
19
19
  scope: ['pipeline']
20
20
  },
21
+ plugins: {
22
+ authorization: {
23
+ permission: 'all'
24
+ }
25
+ },
21
26
 
22
27
  handler: async (request, h) => {
23
28
  const { jobFactory, pipelineFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', '!guest', 'pipeline']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'write'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { jobFactory, pipelineFactory, userFactory, bannerFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', '!guest', 'pipeline']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'all'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { pipelineFactory, secretFactory, userFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', 'build', '!guest']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'read'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { secretFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', '!guest', 'pipeline']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'all'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { secretFactory } = request.server.app;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', '!guest', 'pipeline']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'all'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const factory = request.server.app.secretFactory;
@@ -17,6 +17,11 @@ module.exports = () => ({
17
17
  strategies: ['token'],
18
18
  scope: ['user', 'build', 'pipeline']
19
19
  },
20
+ plugins: {
21
+ authorization: {
22
+ permission: 'read'
23
+ }
24
+ },
20
25
 
21
26
  handler: async (request, h) => {
22
27
  const { stageFactory } = request.server.app;
@@ -18,6 +18,11 @@ module.exports = () => ({
18
18
  strategies: ['token'],
19
19
  scope: ['user', '!guest']
20
20
  },
21
+ plugins: {
22
+ authorization: {
23
+ permission: 'read'
24
+ }
25
+ },
21
26
 
22
27
  handler: async (request, h) => {
23
28
  const { stageFactory, stageBuildFactory } = request.server.app;
@@ -15,6 +15,11 @@ module.exports = () => ({
15
15
  strategies: ['token'],
16
16
  scope: ['user', '!guest']
17
17
  },
18
+ plugins: {
19
+ authorization: {
20
+ permission: 'all'
21
+ }
22
+ },
18
23
 
19
24
  handler: async (request, h) => {
20
25
  const { tokenFactory } = request.server.app;
@@ -16,6 +16,11 @@ module.exports = () => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', '!guest']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'read'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (request, h) => {
21
26
  const { userFactory } = request.server.app;
@@ -16,6 +16,11 @@ module.exports = () => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', '!guest']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'all'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (request, h) => {
21
26
  const { tokenFactory } = request.server.app;
@@ -16,6 +16,11 @@ module.exports = () => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', '!guest']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'all'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (request, h) => {
21
26
  const { tokenFactory } = request.server.app;
@@ -16,6 +16,11 @@ module.exports = () => ({
16
16
  strategies: ['token'],
17
17
  scope: ['user', '!guest']
18
18
  },
19
+ plugins: {
20
+ authorization: {
21
+ permission: 'all'
22
+ }
23
+ },
19
24
 
20
25
  handler: async (request, h) => {
21
26
  const { tokenFactory } = request.server.app;