Merge pull request #27170 from backstage/blam/fix-scaffolder-token

scaffolder: Fix forwarding of non-enumerable property
This commit is contained in:
Ben Lambert
2024-10-16 11:14:04 +02:00
committed by GitHub
2 changed files with 11 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend': patch
---
Fix issue with token not being available because it's now non-enumerable
@@ -493,6 +493,7 @@ export async function createRouter(
});
const credentials = await httpAuth.credentials(req);
await checkPermission({
credentials,
permissions: [taskCreatePermission],
@@ -563,7 +564,11 @@ export async function createRouter(
const secrets: InternalTaskSecrets = {
...req.body.secrets,
backstageToken: token,
__initiatorCredentials: JSON.stringify(credentials),
__initiatorCredentials: JSON.stringify({
...credentials,
// credentials.token is nonenumerable and will not be serialized, so we need to add it explicitly
token: (credentials as any).token,
}),
};
const result = await taskBroker.dispatch({