Skip to content

Commit

Permalink
Merge pull request #10 from neuroforgede/wip/setup_registry_auth#main
Browse files Browse the repository at this point in the history
use base64url encoding for registry auth
  • Loading branch information
s4ke authored Aug 9, 2024
2 parents 0e0b5e4 + b3e7b73 commit d52cb22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions swarmgate/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export function setupRoutes(tenantLabelValue: string) {
if (registryAuth) {
// make base auth header by using the username and password and base64 encoding them
// like with basic auth
headers['x-registry-auth'] = btoa(`${registryAuth.username}:${registryAuth.password}`);
headers['x-registry-auth'] = Buffer.from(`${registryAuth.username}:${registryAuth.password}`).toString("base64url");
}

const options = {
Expand Down Expand Up @@ -362,7 +362,7 @@ export function setupRoutes(tenantLabelValue: string) {

const permissionCheckResult = await checkPermissionsOnDockerImage(taskTemplate.ContainerSpec!.Image, registryAuth.auth);
if (!permissionCheckResult.success) {
res.status(403).send(permissionCheckResult.errorMessage);
res.status(403).send("Permission check failed, Error:" + permissionCheckResult.errorMessage);
return;
}

Expand Down

0 comments on commit d52cb22

Please sign in to comment.