keychain-cli 0.1.1__tar.gz → 0.1.3__tar.gz

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 (31) hide show
  1. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/PKG-INFO +34 -34
  2. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/README.md +33 -33
  3. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/pyproject.toml +8 -1
  4. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/pyproject.toml.orig +6 -1
  5. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/__init__.py +1 -1
  6. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/_clipclear.py +6 -4
  7. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/cli.py +3 -3
  8. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/clipboard.py +2 -2
  9. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/LICENSE +0 -0
  10. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/__main__.py +0 -0
  11. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/__init__.py +0 -0
  12. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/check.py +0 -0
  13. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/copy.py +0 -0
  14. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/delete.py +0 -0
  15. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/import_.py +0 -0
  16. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/init.py +0 -0
  17. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/list_.py +0 -0
  18. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/run.py +0 -0
  19. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/commands/set_.py +0 -0
  20. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/envfile.py +0 -0
  21. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/errors.py +0 -0
  22. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/keychain/__init__.py +0 -0
  23. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/keychain/_cf.py +0 -0
  24. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/keychain/_sec.py +0 -0
  25. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/keychain/store.py +0 -0
  26. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/manifest.py +0 -0
  27. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/names.py +0 -0
  28. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/output.py +0 -0
  29. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/platform_check.py +0 -0
  30. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/prompt.py +0 -0
  31. {keychain_cli-0.1.1 → keychain_cli-0.1.3}/src/keychain_cli/secret.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: keychain-cli
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Security-focused CLI for storing and retrieving secrets in macOS Keychain
5
5
  Keywords: macos,keychain,secrets,secret-management,environment-variables,dotenv,cli
6
6
  Author: CivicActions
@@ -35,13 +35,18 @@ instead of keeping a plaintext `.env` file.
35
35
 
36
36
  ## What it is
37
37
 
38
- A small Python command-line tool for macOS. Each project gets a *namespace* in your login
39
- Keychain holding named environment variables. You store values at a hidden prompt, then run
40
- your development command through the tool, which places the variables in that command's
41
- environment and nowhere else. Your shell is never modified. Nothing is written to disk.
38
+ `keychain-cli` is a small, security-focused command-line tool for storing secrets in the macOS
39
+ Keychain and injecting them into a single command only when needed. It is designed for local
40
+ development workflows where you need API tokens, database passwords, or other environment
41
+ variables available to an application, but do not want those values written to disk or permanently
42
+ exported into your shell session.
42
43
 
43
- Requires macOS 13 or later and Python 3.11 or later. There is no fallback storage on other
44
- platforms; the tool exits with code 6.
44
+ Each project gets a *namespace* in your login Keychain holding named environment variables. You
45
+ store values at a hidden prompt, then run your development command through the tool, which places
46
+ the variables in that command's environment and nowhere else. Your shell is never modified.
47
+ Nothing is written to disk.
48
+
49
+ Requires macOS 13 or later and Python 3.11 or later.
45
50
 
46
51
  ## Install
47
52
 
@@ -65,9 +70,20 @@ To uninstall:
65
70
  uv tool uninstall keychain-cli
66
71
  ```
67
72
 
68
- ## First secret in 60 seconds
73
+ ## Create namespace with secrets
74
+
75
+ Either:
69
76
 
70
- 1. Store secrets in a project namespace:
77
+ - Import existing key-value pairs from a local `.env` file into `my-project` namespace:
78
+
79
+ ```sh
80
+ keychain-cli import my-project .env
81
+ ```
82
+ - and remove the plaintext secrets `.env` file
83
+
84
+ or:
85
+
86
+ - Store secrets directly into a project namespace:
71
87
 
72
88
  ```sh
73
89
  keychain-cli set my-project API_TOKEN DB_PASSWORD
@@ -81,7 +97,7 @@ uv tool uninstall keychain-cli
81
97
  stored: API_TOKEN, DB_PASSWORD
82
98
  ```
83
99
 
84
- 2. Run your command with secrets injected:
100
+ Now you can run your command with secrets injected:
85
101
 
86
102
  ```sh
87
103
  keychain-cli run my-project -- npm run dev
@@ -104,31 +120,16 @@ variables = [
104
120
  ]
105
121
  ```
106
122
 
107
- ### Onboarding and drift detection
108
-
109
- 1. Check for missing variables without storing anything:
110
-
111
- ```sh
112
- keychain-cli check
113
- ```
123
+ This gives the team a shared contract for local configuration variable names without storing any secret values in the repository. Developers can run:
114
124
 
115
- Exits `0` if all variables are present, or `10` if any are missing (listing the missing names).
125
+ - `keychain-cli check` to see what is missing
126
+ - `keychain-cli init` to fill only missing values
116
127
 
117
- 2. Initialize missing secrets:
128
+ Now they can run their code without typing the namespace, e.g.:
118
129
 
119
- ```sh
120
- keychain-cli init
121
- ```
122
-
123
- Prompts only for declared variables not yet in your Keychain. Existing values are never touched.
124
-
125
- 3. Run without typing the namespace:
126
-
127
- ```sh
128
- keychain-cli run -- npm run dev
129
- ```
130
-
131
- The tool infers `my-project` from `.keychain-cli.toml` in the current directory.
130
+ ```sh
131
+ keychain-cli run -- npm run dev
132
+ ```
132
133
 
133
134
  ## Commands
134
135
 
@@ -142,8 +143,7 @@ variables = [
142
143
  | `init [<namespace>]` | Prompt for missing secrets declared in `.keychain-cli.toml` |
143
144
  | `check [<namespace>]` | Report which declared secrets are missing |
144
145
 
145
- For full command documentation, options, and exit codes, run `keychain-cli <command> --help`
146
- or see `specs/001-keychain-secret-manager/contracts/cli.md`.
146
+ For full command documentation, options, and exit codes, run `keychain-cli <command> --help`.
147
147
 
148
148
  ## Exit codes
149
149
 
@@ -5,13 +5,18 @@ instead of keeping a plaintext `.env` file.
5
5
 
6
6
  ## What it is
7
7
 
8
- A small Python command-line tool for macOS. Each project gets a *namespace* in your login
9
- Keychain holding named environment variables. You store values at a hidden prompt, then run
10
- your development command through the tool, which places the variables in that command's
11
- environment and nowhere else. Your shell is never modified. Nothing is written to disk.
8
+ `keychain-cli` is a small, security-focused command-line tool for storing secrets in the macOS
9
+ Keychain and injecting them into a single command only when needed. It is designed for local
10
+ development workflows where you need API tokens, database passwords, or other environment
11
+ variables available to an application, but do not want those values written to disk or permanently
12
+ exported into your shell session.
12
13
 
13
- Requires macOS 13 or later and Python 3.11 or later. There is no fallback storage on other
14
- platforms; the tool exits with code 6.
14
+ Each project gets a *namespace* in your login Keychain holding named environment variables. You
15
+ store values at a hidden prompt, then run your development command through the tool, which places
16
+ the variables in that command's environment and nowhere else. Your shell is never modified.
17
+ Nothing is written to disk.
18
+
19
+ Requires macOS 13 or later and Python 3.11 or later.
15
20
 
16
21
  ## Install
17
22
 
@@ -35,9 +40,20 @@ To uninstall:
35
40
  uv tool uninstall keychain-cli
36
41
  ```
37
42
 
38
- ## First secret in 60 seconds
43
+ ## Create namespace with secrets
44
+
45
+ Either:
39
46
 
40
- 1. Store secrets in a project namespace:
47
+ - Import existing key-value pairs from a local `.env` file into `my-project` namespace:
48
+
49
+ ```sh
50
+ keychain-cli import my-project .env
51
+ ```
52
+ - and remove the plaintext secrets `.env` file
53
+
54
+ or:
55
+
56
+ - Store secrets directly into a project namespace:
41
57
 
42
58
  ```sh
43
59
  keychain-cli set my-project API_TOKEN DB_PASSWORD
@@ -51,7 +67,7 @@ uv tool uninstall keychain-cli
51
67
  stored: API_TOKEN, DB_PASSWORD
52
68
  ```
53
69
 
54
- 2. Run your command with secrets injected:
70
+ Now you can run your command with secrets injected:
55
71
 
56
72
  ```sh
57
73
  keychain-cli run my-project -- npm run dev
@@ -74,31 +90,16 @@ variables = [
74
90
  ]
75
91
  ```
76
92
 
77
- ### Onboarding and drift detection
78
-
79
- 1. Check for missing variables without storing anything:
80
-
81
- ```sh
82
- keychain-cli check
83
- ```
93
+ This gives the team a shared contract for local configuration variable names without storing any secret values in the repository. Developers can run:
84
94
 
85
- Exits `0` if all variables are present, or `10` if any are missing (listing the missing names).
95
+ - `keychain-cli check` to see what is missing
96
+ - `keychain-cli init` to fill only missing values
86
97
 
87
- 2. Initialize missing secrets:
98
+ Now they can run their code without typing the namespace, e.g.:
88
99
 
89
- ```sh
90
- keychain-cli init
91
- ```
92
-
93
- Prompts only for declared variables not yet in your Keychain. Existing values are never touched.
94
-
95
- 3. Run without typing the namespace:
96
-
97
- ```sh
98
- keychain-cli run -- npm run dev
99
- ```
100
-
101
- The tool infers `my-project` from `.keychain-cli.toml` in the current directory.
100
+ ```sh
101
+ keychain-cli run -- npm run dev
102
+ ```
102
103
 
103
104
  ## Commands
104
105
 
@@ -112,8 +113,7 @@ variables = [
112
113
  | `init [<namespace>]` | Prompt for missing secrets declared in `.keychain-cli.toml` |
113
114
  | `check [<namespace>]` | Report which declared secrets are missing |
114
115
 
115
- For full command documentation, options, and exit codes, run `keychain-cli <command> --help`
116
- or see `specs/001-keychain-secret-manager/contracts/cli.md`.
116
+ For full command documentation, options, and exit codes, run `keychain-cli <command> --help`.
117
117
 
118
118
  ## Exit codes
119
119
 
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "keychain-cli"
7
- version = "0.1.1"
7
+ version = "0.1.3"
8
8
  description = "Security-focused CLI for storing and retrieving secrets in macOS Keychain"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -111,3 +111,10 @@ files = [
111
111
  "src",
112
112
  "tests",
113
113
  ]
114
+
115
+ [tool.bandit]
116
+ exclude_dirs = [
117
+ "tests",
118
+ "specs",
119
+ ".venv",
120
+ ]
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "keychain-cli"
7
- version = "0.1.1"
7
+ version = "0.1.3"
8
8
  description = "Security-focused CLI for storing and retrieving secrets in macOS Keychain"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -98,3 +98,8 @@ disable = [
98
98
  strict = true
99
99
  python_version = "3.11"
100
100
  files = ["src", "tests"]
101
+
102
+ [tool.bandit]
103
+ # B101 (assert) is pytest's standard assertion idiom; only enforce it outside tests.
104
+ # .venv is third-party dependency code, not ours to fix.
105
+ exclude_dirs = ["tests", "specs", ".venv"]
@@ -1,4 +1,4 @@
1
1
  """keychain-cli: store project secrets in the macOS Keychain and hand them to one process."""
2
2
 
3
3
  # Maintained by Release Please; do not edit by hand. See CONTRIBUTING.md.
4
- __version__ = "0.1.1" # x-release-please-version
4
+ __version__ = "0.1.3" # x-release-please-version
@@ -7,7 +7,7 @@ the clipboard only if its contents still match the expected SHA-256 digest.
7
7
  from __future__ import annotations
8
8
 
9
9
  import hashlib
10
- import subprocess
10
+ import subprocess # nosec B404 - CLIP-001: argv list, never a shell string
11
11
  import sys
12
12
  import time
13
13
 
@@ -26,11 +26,13 @@ def main() -> int:
26
26
  time.sleep(seconds)
27
27
 
28
28
  try:
29
- current = subprocess.check_output(["/usr/bin/pbpaste"]) # noqa: S603
29
+ current = subprocess.check_output(["/usr/bin/pbpaste"]) # noqa: S603 # nosec B603 - CLIP-001
30
30
  if hashlib.sha256(current).hexdigest() == raw_digest:
31
- proc = subprocess.Popen(["/usr/bin/pbcopy"], stdin=subprocess.PIPE) # noqa: S603
31
+ proc = subprocess.Popen( # noqa: S603 # nosec B603 - CLIP-001
32
+ ["/usr/bin/pbcopy"], stdin=subprocess.PIPE
33
+ )
32
34
  proc.communicate(b"")
33
- except Exception: # noqa: BLE001
35
+ except Exception: # noqa: BLE001 # nosec B110 - CLIP-001: best-effort clear, failure is silent
34
36
  pass
35
37
 
36
38
  return 0
@@ -446,10 +446,10 @@ def main(
446
446
 
447
447
  def _default_exec(file: str, argv: Sequence[str], env: Mapping[str, str]) -> None:
448
448
  """Replace this process with ``argv``. Only ``run`` will call it; no shell is involved."""
449
- os.execvpe(file, list(argv), dict(env)) # noqa: S606 - argv list, never a shell string
449
+ os.execvpe(file, list(argv), dict(env)) # noqa: S606 # nosec B606 - argv list, never a shell string
450
450
 
451
451
 
452
452
  def _default_spawn(*args: Any, **kwargs: Any) -> Any:
453
- import subprocess # noqa: PLC0415 - lazy; only the clipboard path spawns processes
453
+ import subprocess # noqa: PLC0415 # nosec B404 - lazy; only the clipboard path spawns processes
454
454
 
455
- return subprocess.Popen(*args, **kwargs) # noqa: S603 - argv list, never a shell string
455
+ return subprocess.Popen(*args, **kwargs) # noqa: S603 # nosec B603 - argv list, never a shell string
@@ -5,7 +5,7 @@ Deliberate exposure channel governed by SECURITY-EXCEPTIONS.md entry CLIP-001.
5
5
 
6
6
  from __future__ import annotations
7
7
 
8
- import subprocess
8
+ import subprocess # nosec B404 - CLIP-001: argv list, never a shell string
9
9
  import sys
10
10
  from collections.abc import Callable
11
11
  from typing import Any
@@ -25,7 +25,7 @@ def clear_now(spawn_fn: SpawnFn = subprocess.Popen) -> None:
25
25
  try:
26
26
  proc = spawn_fn(["/usr/bin/pbcopy"], stdin=subprocess.PIPE)
27
27
  proc.communicate(b"")
28
- except Exception: # noqa: BLE001
28
+ except Exception: # noqa: BLE001 # nosec B110 - CLIP-001: best-effort clear, failure is silent
29
29
  pass
30
30
 
31
31
 
File without changes