mirror of
https://github.com/github/codeql-action.git
synced 2026-10-21 02:01:27 +00:00
Formatting
This commit is contained in:
11
lib/start-proxy.js
generated
11
lib/start-proxy.js
generated
@@ -41,12 +41,12 @@ function getCredentials(logger, registrySecrets, registriesCredentials, language
|
||||
try {
|
||||
parsed = JSON.parse(credentialsStr);
|
||||
}
|
||||
catch (error) {
|
||||
catch {
|
||||
// Don't log the error since it might contain sensitive information.
|
||||
logger.error("Failed to parse the credentials data.");
|
||||
throw new Error("Invalid credentials format.");
|
||||
}
|
||||
let out = [];
|
||||
const out = [];
|
||||
for (const e of parsed) {
|
||||
if (e.url === undefined && e.host === undefined) {
|
||||
// The proxy needs one of these to work. If both are defined, the url has the precedence.
|
||||
@@ -60,7 +60,12 @@ function getCredentials(logger, registrySecrets, registriesCredentials, language
|
||||
const isPrintable = (str) => {
|
||||
return str ? /^[\x20-\x7E]*$/.test(str) : true;
|
||||
};
|
||||
if (!isPrintable(e.type) || !isPrintable(e.host) || !isPrintable(e.url) || !isPrintable(e.username) || !isPrintable(e.password) || !isPrintable(e.token)) {
|
||||
if (!isPrintable(e.type) ||
|
||||
!isPrintable(e.host) ||
|
||||
!isPrintable(e.url) ||
|
||||
!isPrintable(e.username) ||
|
||||
!isPrintable(e.password) ||
|
||||
!isPrintable(e.token)) {
|
||||
throw new Error("Invalid credentials - fields must contain only printable characters");
|
||||
}
|
||||
out.push({
|
||||
|
||||
Reference in New Issue
Block a user