Skip to content

Commit 3a21736

Browse files
committed
validate that when using an OAuth client, tags are specified
Also include a troubleshooting section in the README with information about the requested tags are invalid or not permitted error. Updates #78 Signed-off-by: Percy Wegmann <percy@tailscale.com>
1 parent 1293ebc commit 3a21736

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,9 @@ Although caching is generally recommended, you can disable it by passing `'false
134134

135135
When running on self-hosted runners that persist after CI jobs have finished,
136136
the GitHub Action leaves tailscale binaries installed but stops the tailscale background processes.
137+
138+
## Troubleshooting
139+
140+
### requested tags [tag:mytag] are invalid or not permitted
141+
142+
You may encounter this error when using an OAuth client. OAuth clients must have the [`auth_keys` scope](https://tailscale.com/kb/1215/oauth-clients#scopes) with one or more [tags](https://tailscale.com/kb/1068/acl-tags/), and the tags specified with `tags` must match all tags on the OAuth client.

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ inputs:
1919
description: 'Your Tailscale OAuth Client Secret.'
2020
required: false
2121
tags:
22-
description: 'Comma separated list of Tags to be applied to nodes. The OAuth client must have permission to apply these tags.'
22+
description: 'Comma separated list of Tags to be applied to nodes. When using an OAuth client, the OAuth client must have the `auth_keys` scope and alls tags on the OAuth client must match all tags specified here.'
2323
required: false
2424
version:
2525
description: 'Tailscale version to use. Specify `latest` to use the latest stable version, and `unstable` to use the latest development version.'

dist/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41264,7 +41264,7 @@ async function getInputs() {
4126441264
core.setSecret(oauthSecret);
4126541265
}
4126641266
}
41267-
return {
41267+
const config = {
4126841268
version: core.getInput("version") || "1.88.3",
4126941269
resolvedVersion: "",
4127041270
arch: "",
@@ -41282,6 +41282,10 @@ async function getInputs() {
4128241282
sha256Sum: core.getInput("sha256sum") || "",
4128341283
pingHosts: pingHosts,
4128441284
};
41285+
if (config.oauthSecret && !config.tags) {
41286+
throw new Error("the tags parameter is required when using an OAuth client");
41287+
}
41288+
return config;
4128541289
}
4128641290
function validateAuth(config) {
4128741291
if (!config.authKey && (!config.oauthSecret || !config.tags)) {
@@ -41628,9 +41632,7 @@ async function connectToTailscale(config, runnerOS) {
4162841632
const tagsArg = [];
4162941633
if (config.oauthSecret) {
4163041634
finalAuthKey = `${config.oauthSecret}?preauthorized=true&ephemeral=true`;
41631-
if (config.tags) {
41632-
tagsArg.push(`--advertise-tags=${config.tags}`);
41633-
}
41635+
tagsArg.push(`--advertise-tags=${config.tags}`);
4163441636
}
4163541637
// Platform-specific args
4163641638
const platformArgs = [];

src/main.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ async function getInputs(): Promise<TailscaleConfig> {
208208
}
209209
}
210210

211-
return {
211+
const config = {
212212
version: core.getInput("version") || "1.88.3",
213213
resolvedVersion: "",
214214
arch: "",
@@ -226,6 +226,14 @@ async function getInputs(): Promise<TailscaleConfig> {
226226
sha256Sum: core.getInput("sha256sum") || "",
227227
pingHosts: pingHosts,
228228
};
229+
230+
if (config.oauthSecret && !config.tags) {
231+
throw new Error(
232+
"the tags parameter is required when using an OAuth client"
233+
);
234+
}
235+
236+
return config;
229237
}
230238

231239
function validateAuth(config: TailscaleConfig): void {
@@ -665,9 +673,7 @@ async function connectToTailscale(
665673

666674
if (config.oauthSecret) {
667675
finalAuthKey = `${config.oauthSecret}?preauthorized=true&ephemeral=true`;
668-
if (config.tags) {
669-
tagsArg.push(`--advertise-tags=${config.tags}`);
670-
}
676+
tagsArg.push(`--advertise-tags=${config.tags}`);
671677
}
672678

673679
// Platform-specific args

0 commit comments

Comments
 (0)