Skip to content

Commit 28fe65c

Browse files
committed
Correct for the backend returning tokens as passwords
1 parent 9281048 commit 28fe65c

File tree

6 files changed

+78
-6
lines changed

6 files changed

+78
-6
lines changed

lib/start-proxy.js

Lines changed: 17 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy.test.js

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/start-proxy.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start-proxy.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,28 @@ test("getCredentials throws an error when non-printable characters are used", as
159159
);
160160
}
161161
});
162+
163+
test("getCredentials corrects for the backend returning tokens as passwords", async (t) => {
164+
const tokenCredentials = [
165+
{
166+
type: "npm_registry",
167+
host: "npm.pkg.github.com",
168+
password: "abc",
169+
},
170+
{ type: "maven_repository", host: "maven.pkg.github.com", token: "def" },
171+
{ type: "nuget_feed", host: "nuget.pkg.github.com", password: "ghi" },
172+
{ type: "goproxy_server", host: "goproxy.example.com", token: "jkl" },
173+
];
174+
const credentialsInput = toEncodedJSON(tokenCredentials);
175+
176+
const credentials = startProxyExports.getCredentials(
177+
getRunnerLogger(true),
178+
undefined,
179+
credentialsInput,
180+
undefined,
181+
);
182+
for (const credential of credentials) {
183+
t.not(credential.token, undefined);
184+
t.is(credential.password, undefined);
185+
}
186+
});

0 commit comments

Comments
 (0)