lobstakit-cloud 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +4 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lobstakit-cloud",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "LobstaKit Cloud — Setup wizard and management for LobstaCloud gateways",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -1072,10 +1072,10 @@ app.post('/api/tailscale/connect', (req, res) => {
1072
1072
  return res.status(400).json({ error: 'Auth key is required' });
1073
1073
  }
1074
1074
 
1075
- // Validate auth key format (tskey-auth-...)
1076
- if (!authKey.startsWith('tskey-auth-') && !authKey.startsWith('tskey-')) {
1075
+ // Strict validation: Tailscale auth keys are alphanumeric + hyphens only (CRITICAL-1: prevent command injection)
1076
+ if (!/^tskey-auth-[a-zA-Z0-9-]+$/.test(authKey)) {
1077
1077
  return res.status(400).json({
1078
- error: 'Invalid auth key format. Tailscale auth keys start with tskey-auth-'
1078
+ error: 'Invalid auth key format. Tailscale auth keys start with tskey-auth- and contain only alphanumeric characters and hyphens.'
1079
1079
  });
1080
1080
  }
1081
1081
 
@@ -1102,6 +1102,7 @@ app.post('/api/tailscale/connect', (req, res) => {
1102
1102
 
1103
1103
  // Run tailscale up with the auth key
1104
1104
  try {
1105
+ // SAFE: authKey validated above with /^tskey-auth-[a-zA-Z0-9-]+$/ — no injection possible
1105
1106
  execSync(`tailscale up --authkey=${authKey} --accept-routes --accept-dns`, {
1106
1107
  stdio: 'pipe',
1107
1108
  timeout: 30000