Skip to content

Commit b69384a

Browse files
authored
Merge pull request #203 from tailscale/secrets
use `setSecret` to mask secrets from logs
2 parents ac425ca + 0edb496 commit b69384a

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

dist/index.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41254,13 +41254,24 @@ async function pingHost(host) {
4125441254
async function getInputs() {
4125541255
let ping = core.getInput("ping");
4125641256
let pingHosts = ping?.length > 0 ? ping.split(",") : [];
41257+
const authKey = core.getInput("authkey") || "";
41258+
const oauthSecret = core.getInput("oauth-secret") || "";
41259+
// Mask sensitive values in logs unless debug mode is enabled
41260+
if (!core.isDebug()) {
41261+
if (authKey) {
41262+
core.setSecret(authKey);
41263+
}
41264+
if (oauthSecret) {
41265+
core.setSecret(oauthSecret);
41266+
}
41267+
}
4125741268
return {
4125841269
version: core.getInput("version") || "1.88.3",
4125941270
resolvedVersion: "",
4126041271
arch: "",
41261-
authKey: core.getInput("authkey") || "",
41272+
authKey: authKey,
4126241273
oauthClientId: core.getInput("oauth-client-id") || "",
41263-
oauthSecret: core.getInput("oauth-secret") || "",
41274+
oauthSecret: oauthSecret,
4126441275
tags: core.getInput("tags") || "",
4126541276
hostname: core.getInput("hostname") || "",
4126641277
args: core.getInput("args") || "",

src/main.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,26 @@ async function getInputs(): Promise<TailscaleConfig> {
203203
let ping = core.getInput("ping");
204204
let pingHosts = ping?.length > 0 ? ping.split(",") : [];
205205

206+
const authKey = core.getInput("authkey") || "";
207+
const oauthSecret = core.getInput("oauth-secret") || "";
208+
209+
// Mask sensitive values in logs unless debug mode is enabled
210+
if (!core.isDebug()) {
211+
if (authKey) {
212+
core.setSecret(authKey);
213+
}
214+
if (oauthSecret) {
215+
core.setSecret(oauthSecret);
216+
}
217+
}
218+
206219
return {
207220
version: core.getInput("version") || "1.88.3",
208221
resolvedVersion: "",
209222
arch: "",
210-
authKey: core.getInput("authkey") || "",
223+
authKey: authKey,
211224
oauthClientId: core.getInput("oauth-client-id") || "",
212-
oauthSecret: core.getInput("oauth-secret") || "",
225+
oauthSecret: oauthSecret,
213226
tags: core.getInput("tags") || "",
214227
hostname: core.getInput("hostname") || "",
215228
args: core.getInput("args") || "",

0 commit comments

Comments
 (0)