Skip to content

Commit 65f7f36

Browse files
committed
Extend isPrintable check to all keys with string values
1 parent babab88 commit 65f7f36

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

lib/start-proxy-action.js

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

src/start-proxy.ts

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,17 +354,14 @@ export function getCredentials(
354354
return str ? /^[\x20-\x7E]*$/.test(str) : true;
355355
};
356356

357-
if (
358-
!isPrintable(e.type) ||
359-
!isPrintable(e.host) ||
360-
!isPrintable(e.url) ||
361-
!isPrintable(e.username) ||
362-
!isPrintable(e.password) ||
363-
!isPrintable(e.token)
364-
) {
365-
throw new ConfigurationError(
366-
"Invalid credentials - fields must contain only printable characters",
367-
);
357+
// Ensure that all string fields only contain printable characters.
358+
for (const key of Object.keys(e)) {
359+
const val = e[key];
360+
if (typeof val === "string" && !isPrintable(val)) {
361+
throw new ConfigurationError(
362+
"Invalid credentials - fields must contain only printable characters",
363+
);
364+
}
368365
}
369366

370367
// If the password or token looks like a GitHub PAT, warn if no username is configured.

0 commit comments

Comments
 (0)