screwdriver-api 8.0.193 → 8.0.195
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/package.json
CHANGED
|
@@ -56,7 +56,6 @@ module.exports = () => ({
|
|
|
56
56
|
const { commandFactory, commandTagFactory } = request.server.app;
|
|
57
57
|
const { canRemove } = request.server.plugins.commands;
|
|
58
58
|
const storeUrl = request.server.app.ecosystem.store;
|
|
59
|
-
const authToken = request.headers.authorization;
|
|
60
59
|
|
|
61
60
|
return Promise.all([
|
|
62
61
|
commandFactory.list({ params: { namespace, name } }),
|
|
@@ -69,6 +68,21 @@ module.exports = () => ({
|
|
|
69
68
|
|
|
70
69
|
return canRemove(credentials, commands[0], 'admin', request.server.app)
|
|
71
70
|
.then(() => {
|
|
71
|
+
// Delegate to the store with a service token that attests the
|
|
72
|
+
// ownership check just performed, instead of forwarding the
|
|
73
|
+
// caller's own token. The store has no visibility into SCM
|
|
74
|
+
// permissions and cannot re-derive this decision, so forwarding a
|
|
75
|
+
// bare user/guest-scope token let a caller reach the store
|
|
76
|
+
// directly and skip this check entirely.
|
|
77
|
+
const storeToken = request.server.plugins.auth.generateToken(
|
|
78
|
+
request.server.plugins.auth.generateProfile({
|
|
79
|
+
scope: ['sdapi'],
|
|
80
|
+
metadata: { pipelineId: commands[0].pipelineId, namespace, name },
|
|
81
|
+
auth: { type: 'temporary' }
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
const authToken = `Bearer ${storeToken}`;
|
|
85
|
+
|
|
72
86
|
const commandPromises = commands.map(command =>
|
|
73
87
|
removeCommand(command, storeUrl, authToken)
|
|
74
88
|
);
|
package/plugins/events/create.js
CHANGED
|
@@ -295,10 +295,6 @@ module.exports = () => ({
|
|
|
295
295
|
|
|
296
296
|
const event = await createEvent(payload, request.server);
|
|
297
297
|
|
|
298
|
-
if (event.builds === null) {
|
|
299
|
-
return boom.notFound('No jobs to start.');
|
|
300
|
-
}
|
|
301
|
-
|
|
302
298
|
// everything succeeded, inform the user
|
|
303
299
|
const location = urlLib.format({
|
|
304
300
|
host: request.headers.host,
|
|
@@ -307,6 +303,15 @@ module.exports = () => ({
|
|
|
307
303
|
pathname: `${request.path}/${event.id}`
|
|
308
304
|
});
|
|
309
305
|
|
|
306
|
+
if (event.builds === null) {
|
|
307
|
+
return h
|
|
308
|
+
.response(event.toJson())
|
|
309
|
+
.header('X-Status-Message', 'No jobs to start.')
|
|
310
|
+
.header('Access-Control-Expose-Headers', 'X-Status-Message')
|
|
311
|
+
.header('Location', location)
|
|
312
|
+
.code(201);
|
|
313
|
+
}
|
|
314
|
+
|
|
310
315
|
return h.response(event.toJson()).header('Location', location).code(201);
|
|
311
316
|
},
|
|
312
317
|
validate: {
|