vvauth 2.6.0 → 2.6.2

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.
@@ -1,196 +1,410 @@
1
- # vvauth — Architecture, Code Quality, and Security Review
1
+ # Security Audit — vvauth
2
2
 
3
- **Review date:** October 23, 2026
4
- **Reviewer:** Codex (GPT 6.1-sol)
3
+ - **Assessed commit:** `f368802700f03c8b632bbacefbfc71dbfaae04f4`
4
+ - **Assessment date:** October 25, 2026
5
+ - **Source state:** `master`, pre-release functional source; current Node and Go manifests declare `2.6.0`
6
+ - **Checkout:** `/var/monolith/3rd/github.com/131/vvauth`
7
+ - **Canonical remote:** `git@github.com:131/vvauth.git`
8
+ - **Execution model:** `gpt-6.1-sol_codeassist`, as declared by the host. The tools available to this review do not independently expose the execution-model identifier; no differing model was disclosed or selected. Client configuration and environment values were not inspected to identify the model.
5
9
 
6
- ## Scope and evidence
10
+ ## 1. Provenance
7
11
 
8
- This is a read-only review of the current checkout. I read `README.md`, `API_and_tests.md`, both canonical implementations (`index.js`; `vauth.go`, `vault.go`, `cache.go`, `rc.go`, `humandiff.go`, and `cmd/vauth/main.go`), both test files, the three workflows, and the package/build manifests. I also inspected locally installed dependency source where necessary to understand Node HTTP, CLI, macro, child-process, and encryption delegation, Go agent selection, and Go HTTP redirect handling. I did not read the other audit as evidence, examine project history, modify the repository, craft inputs, or perform behavioral probes.
12
+ This is an independent, source-only assessment of the current implementation, selected installed dependency sources, tests, manifests, and release workflows. Findings were derived from those inputs, not from an intended design.
9
13
 
10
- Authorized verification:
14
+ The following inputs were excluded:
11
15
 
12
- - `npm test`: **64 passed, 0 failed, 0 skipped**.
13
- - `go test ./...`: **passed** for the library; `cmd/vauth` reports **no test files**. The normal Go output does not establish whether individual tests skipped optional checks.
14
- - The Git working tree was clean before and after the test runs.
16
+ - Every `SECURITY_AUDIT*.md` file, including the existing file bearing this report’s intended filename.
17
+ - Every `README.md`, at every depth.
18
+ - Previous assessments, scores, reports, conversations, and handoffs.
19
+ - Assessment content in Git history and assessment-related commit messages.
20
+ - Dependency Markdown containing advisories or audits.
21
+ - Personal context, task indexes, and neighboring project documentation.
22
+ - Real credentials, user configuration files, real Vault services, and network resources.
15
23
 
16
- Findings below distinguish observed source behavior from inferred consequences. Severity reflects the likely impact under the stated conditions, not a demonstrated exploit. This is not an independent cryptographic certification, dependency-vulnerability scan, live Vault integration test, or Windows execution test.
24
+ Excluded filenames were visible in the initial filename inventory; their contents were not read or searched. Only heading line numbers and titles were inspected in `API_and_tests.md`; its entire body was omitted.
17
25
 
18
- ## Design as understood
26
+ The applicable `$AGENT_WORKSPACE/AGENTS.md` was read. The checkout is unmapped in the internal monolith, and no neighboring project rules were adopted.
19
27
 
20
- vvauth combines an authentication client, a credential/profile resolver, and an environment publisher. Node exposes a class and a reflection-based CLI; Go separates configuration, cache, Vault transport, orchestration, and the command entry point.
28
+ No repository files were modified. Git metadata confirmed the assessed commit, branch, canonical remote, and clean tracked working tree.
21
29
 
22
- Both locate `.vauthrc` through `VAUTHRC`, the working directory, then the home directory, and perform environment macro expansion. With an authentication configuration, connection precedence is the inherited `VAULT_TOKEN`, then the encrypted session cache, then SSH challenge signing or JWT login. Cached expiry drives reuse, renewal in the final third of the recorded lease, or replacement. `--renew` means fresh authentication, not merely renewal of the existing token. Without an auth block, inherited Vault tokens are deliberately ignored, allowing local armored credentials to work offline.
30
+ The public upstream, existing npm/Go/native releases, and authorization for a future patch release are operator-provided context, not independently network-verified facts in this review. This assessment does not certify an unpublished patch or authorize publication.
23
31
 
24
- The shared disk contract is a hash-addressed `.creds` file beneath `~/.vauth/tokens`, containing armored JSON with the token, lease duration, renewable flag, and absolute expiry. `ssh-agent-crypt` performs encryption/decryption using an agent-backed key; new cache writes select a key through identity/mail settings, while decryption generally selects the armor's embedded fingerprint.
32
+ ## 2. Scope and Method
25
33
 
26
- Environment resolution combines Vault entity metadata, the user's private KV-v2 `.vauth_database`, optional local encrypted JSON, and ordered remote secret reads. Metadata overrides private database entries; later secret sources override earlier ones. `env.map` publishes selected values through JSON, Bash exports, raw dotenv lines, or a child process. `set`/`unset` replace the private database document after a read.
34
+ ### 2.1 Explicit input inventory
27
35
 
28
- **Overall assessment:** a useful, compact design with thoughtful cache hygiene and substantial lifecycle regression coverage. The principal weaknesses are implicit trust in working-directory configuration, incomplete lifecycle validation, unsafe transport defaults in Go, and a parity promise broader than the implementation and tests support.
36
+ #### Project implementation
29
37
 
30
- ## Strengths
38
+ - `index.js`
39
+ - `cmd/vauth.js`
40
+ - `vauth.go`
41
+ - `vault.go`
42
+ - `rc.go`
43
+ - `gitlab.go`
44
+ - `cmd/vauth/main.go`
31
45
 
32
- - **No plaintext token-cache fallback.** Encryption precedes writing, unreadable/plaintext armor is treated as a miss, and cache write failure does not fail authentication or print the token. Both request private creation modes and rename the completed temporary file into place (`index.js:121–152`, `cache.go:43–101`).
33
- - **Well-covered lease decisions.** Tests exercise expiry, proportional renewal thresholds, lease-baseline preservation, nonrenewable replacement, forced reauthentication, environment-token precedence, disabled caching, and ordinary reuse without rewriting the cache.
34
- - **Reasonable failure classification in token lookup/renewal.** HTTP 400/403 can trigger reauthentication, whereas server/network failures are propagated instead of creating extra tokens (`index.js:178–202`, `vauth.go:181–215,255–263`).
35
- - **Good shell-value quoting and key checks on the normal environment path.** Bash values are single-quoted with embedded quotes escaped; `env.map` names are validated in both implementations. Resolution completes before export output begins (`index.js:330–335,489–492`, `vauth.go:419–431,448–459`).
36
- - **Secrets are not printed in ordinary success diagnostics.** Token status and sourced export echoes are redacted; JSON output can be separated from stderr diagnostics.
37
- - **Go has useful architectural seams.** Typed configuration, injectable HTTP client/clock/streams/environment, and separate transport/cache files make the library more maintainable and testable than a single CLI-bound implementation.
38
- - **CI has basic quality gates and restrained permissions.** Linting, formatting, vetting, and tests are present; regular CI has read-only repository permissions. Go release configuration includes trimmed builds, version injection, checksums, and a Windows signing hook.
46
+ These cover profile resolution, private KV updates, environment mapping, shell publication, local encrypted credentials, Git remote interpretation, construction, and CLI dispatch.
39
47
 
40
- ## Weaknesses and correctness risks
48
+ #### Repository tests
41
49
 
42
- ### 1. High — Configuration discovery is also an implicit credential trust decision
50
+ - `test/token-cache.js`
51
+ - `vauth_test.go`
52
+ - `gitlab_test.go`
43
53
 
44
- **Evidence:** `index.js:39,64–95,330–335`; `rc.go:322–373`; `vault.go:57–67`; `vauth.go:419–425`.
54
+ The test-case indexes and selected bodies were inspected, particularly fixture construction, disposable-agent setup, cache lifecycle, shell forwarding, transport inheritance, unknown-Vault rejection, local decryption, scalar validation, configuration snapshots, and GitLab publication. This was not an exhaustive assertion-by-assertion review of every test body.
45
55
 
46
- A working-directory `.vauthrc` can select the Vault destination and auth parameters, reference local encrypted credentials, and map arbitrary syntactically valid environment names. The code checks names against shell injection, but does not establish whether the configuration is trusted. In a malicious checkout, invoking the helper can therefore send an inherited token or JWT to a chosen endpoint, request agent signatures, decrypt available local material, or export values affecting command execution. This is a configuration-authority boundary, not a claim that correctly quoted values execute as Bash code.
56
+ #### Manifests and supporting configuration
47
57
 
48
- A nonexistent explicit `VAUTHRC` also silently falls through to another configuration. That matches the README's fallback wording but can select an unintended security context.
58
+ - `package.json`
59
+ - `package-lock.json` — selected metadata and dependency entries
60
+ - `go.mod`
61
+ - `go.sum`
62
+ - `.npmrc`
63
+ - `.gitignore`
64
+ - `.eslintrc`
65
+ - `.eslintignore`
49
66
 
50
- **Remedy:** make explicit configuration selection fail closed; add an opt-in/trust mechanism for project configurations and display the selected configuration and destination without credentials. Bind inherited tokens to a trusted Vault origin, restrict sensitive environment overrides, and document that approving a configuration authorizes credential resolution and agent use.
67
+ The local `package-lock.json` is ignored and untracked. Its stale contents were treated as local metadata, not as the canonical dependency specification.
51
68
 
52
- ### 2. High — Transport policy is insufficient, particularly Go redirects
69
+ `package.json` declares **ISC**. No standalone project license text was independently verified.
53
70
 
54
- **Evidence:** `vault.go:42–86`; Node request construction throughout `index.js`; locally installed `nyks/http/request.js`; local Go `net/http/client.go` redirect-header copying.
71
+ #### Release and CI configuration
55
72
 
56
- Neither implementation requires HTTPS for credential-bearing requests. Go uses `http.DefaultClient` unless overridden, with no helper-level deadline, and reads complete response bodies without a size cap. Its default redirect behavior copies the custom `X-Vault-Token` header; that header is not among the standard headers receiving sensitive-header filtering. A redirect to another origin can consequently disclose a token. This is a static conclusion from the local HTTP implementation, not a redirect experiment.
73
+ - `.github/workflows/test.yml`
74
+ - `.github/workflows/publish-npm.yml`
75
+ - `.github/workflows/release.yml`
76
+ - `.goreleaser.yaml`
57
77
 
58
- Node does not enable redirects in these requests. Its dependency supplies a 60-second response-header timer, but that is not a total deadline: the timer is cleared when headers arrive, and timeout rejection does not explicitly destroy the request. Body draining remains unbounded.
78
+ #### Selected installed Node dependency inputs
59
79
 
60
- **Remedy:** default to HTTPS, with explicit local-development exceptions; reject redirects for Vault calls or enforce an exact trusted origin and prohibit downgrade. Use bounded total deadlines, cancellation, response-size limits, and proper request/response cleanup in both runtimes. Preserve normal certificate verification.
80
+ Under `node_modules/`:
61
81
 
62
- ### 3. Medium — Cached validity and in-memory validity are conflated with actual token usability
82
+ - `vauth-login/index.js`
83
+ - `ssh-agent-crypt/index.js`
84
+ - `nyks/http/request.js`
85
+ - `nyks/stream/drain.js`
86
+ - `nyks/string/replaceEnv.js`
87
+ - `nyks/string/stripStart.js`
88
+ - `nyks/object/jqdive.js`
89
+ - `nyks/object/walk.js`
90
+ - `nyks/object/structuredClone.js`
91
+ - `nyks/object/freeze.js`
92
+ - `nyks/child_process/exec.js`
93
+ - `nyks/process/parseArgs.js`
94
+ - `nyks/function/promiser.js`
95
+ - `nyks/async/eachLimit.js`
96
+ - `nyks/date/humanDiff.js`
63
97
 
64
- **Evidence:** `index.js:161–226,276–288`; `vauth.go:159–252,289–319`; the explicit cached-revocation tests in both suites.
98
+ Selected manifest fields were read from the installed `nyks`, `vauth-login`, `ssh-agent-crypt`, `cnyks`, `mout`, and `semver` packages. The installed versions of the three principal shared dependencies matched the supplied context:
65
99
 
66
- Cache reuse intentionally skips lookup until renewal is due. Revoked cached tokens can be returned successfully by `connect`/`login`; the subsequent profile lookup used by `env` can fail without retrying authentication. Moreover, once an instance is marked connected, ordinary calls bypass expiry and renewal altogether. A long-lived library client can keep returning an expired token. Absolute wall-clock expiry also assumes a stable clock and does not subtract network latency or a safety margin.
100
+ | Dependency | Node installed version | Go requirement |
101
+ |---|---:|---:|
102
+ | nyks | 6.18.0 | v6.18.0 |
103
+ | vauth-login | 1.1.7 | v1.1.7 |
104
+ | ssh-agent-crypt | 1.4.4 | v1.4.4 |
67
105
 
68
- **Remedy:** retain in-memory lease metadata and reevaluate expiry on every connection request. Decide and document the freshness policy for cached tokens; offer validation, and implement one bounded reauthentication retry for token-invalid responses on safe reads. Add conservative expiry skew and keep network/server failures distinct from invalid credentials.
106
+ #### Selected cached Go dependency inputs
69
107
 
70
- ### 4. Medium — Token persistence and replacement do not fully define ownership or cleanup
108
+ Under `/root/go/pkg/mod/`:
71
109
 
72
- **Evidence:** `index.js:175,205–221`; `vauth.go:177,218–246`; environment-token and repeated-force-login tests.
110
+ - `github.com/131/vauth-login@v1.1.7/{go.mod,vauth.go,rc.go,cache.go,vault.go}`
111
+ - `github.com/131/ssh-agent-crypt@v1.4.4/{go.mod,sshagentcrypt.go,agent_unix.go,agent_windows.go}`
112
+ - `github.com/131/nyks/v6@v6.18.0/go.mod`
113
+ - `github.com/131/nyks/v6@v6.18.0/string/replaceEnv.go`
114
+ - `github.com/131/nyks/v6@v6.18.0/object/{jqdive.go,walk.go}`
115
+ - `github.com/131/nyks/v6@v6.18.0/date/humanDiff.go`
116
+ - `github.com/131/nyks/v6@v6.18.0/internal/js/string.go`
73
117
 
74
- An inherited token is persisted under the configured auth session even though it may belong to a different identity or carry different privileges. A later invocation without that environment variable can reuse it. Fresh authentication overwrites the local cache but does not revoke the previous token. Cache disabling leaves files intact; changing JWT content creates another filename; there is no logout, expiry cleanup, or retention policy. Replacement is therefore not revocation or credential erasure.
118
+ Dependency paths in findings below refer to these installed versions.
75
119
 
76
- **Remedy:** distinguish externally supplied tokens from helper-owned tokens and make persistence of inherited tokens explicit. Bind persisted sessions to the intended principal/policy context. Add local cache cleanup and a documented logout path, with revocation limited to tokens the helper owns so that unrelated inherited credentials are not accidentally revoked.
120
+ ### 2.2 Safe local checks performed
77
121
 
78
- ### 5. Medium — The decrypted cache lacks a validated, context-bound schema
122
+ | Check | Result |
123
+ |---|---|
124
+ | Git commit, branch, remote, and tracked status inspection | Matched the stated checkout; tracked tree remained clean |
125
+ | `node --version` | v22.22.2 |
126
+ | `GOTOOLCHAIN=local go version` | go1.24.0, Linux/amd64 |
127
+ | `node --check` on `index.js`, `cmd/vauth.js`, and `test/token-cache.js` | Passed |
128
+ | `gofmt -l` on all seven project Go source/test files | No formatting differences reported |
129
+ | ESLint on the three selected project JavaScript files, with `--no-cache`, no fixes, and a minimal environment | Passed |
130
+ | `GOTOOLCHAIN=local GOPROXY=off GOSUMDB=off GOFLAGS=-mod=readonly go list -m all` | Passed using available local module metadata; no replacements reported |
131
+ | Local JSON parsing of manifest and selected lockfile metadata | Completed; an initial URL-only formatter rejected a relative lockfile entry and was corrected |
79
132
 
80
- **Evidence:** `index.js:121–141,175–187`; `cache.go:15–20,43–59`; `vault.go:89–96,161–176`.
133
+ These checks do not establish runtime correctness or absence of vulnerabilities.
81
134
 
82
- Node accepts any successfully decrypted JSON without checking token type, lease duration, expiry, or renewable shape. Go checks a nonempty token and JSON types, but omitted/null expiry becomes unlimited and lease invariants are not checked. Go login parsing also accepts an omitted lease duration as zero; lookup accepts an omitted TTL as zero. Encryption authenticates bytes, not application meaning.
135
+ ### 2.3 Checks not performed
83
136
 
84
- Neither payload contains a format version or session digest. Thus a valid armor copied into another session filename is not rejected for context mismatch if the corresponding key remains available. This requires local cache manipulation or another source of valid armor; it is not an unauthenticated bypass of encryption.
137
+ - **`node --test`, `npm test`, and `go test`:** repository fixtures create temporary directories, SSH keys, disposable agents, and loopback HTTP listeners. They were not executed under this strictly read-only, no-network review.
138
+ - **`go vet` and native builds:** these can require compiler work directories and cache writes. They were not attempted under the filesystem restriction.
139
+ - **Windows runtime tests:** no Windows execution environment was available.
140
+ - **npm installation, Go module downloads, npm audit, and live vulnerability scanning:** prohibited by the source-only and no-network scope.
141
+ - **Release execution, signing, artifact installation, and Vault integration:** outside reviewer authorization.
142
+ - **Published-package or binary comparison:** no network retrieval was permitted.
85
143
 
86
- **Remedy:** define a shared versioned schema with required fields, finite/nonnegative durations, explicit unlimited-token semantics, and consistency checks. Embed and verify the session digest and relevant principal context. Treat malformed or mismatched payloads as misses with redacted diagnostics.
144
+ No real credentials, token caches, SSH agents, or Vault endpoints were accessed.
87
145
 
88
- ### 6. Medium — Fixed cache staging names are unsafe under concurrency
146
+ ## 3. Prioritized Findings
89
147
 
90
- **Evidence:** `index.js:134–151`; `cache.go:66–100`.
148
+ “Verified observation” below means directly established from the inspected source or local metadata. It does **not** imply that an exploit was dynamically reproduced.
91
149
 
92
- Both writers use exactly `<session>.creds.next`, overwrite it without exclusive creation, rename it, and unconditionally attempt cleanup. Concurrent Node/Go invocations can overwrite or remove each other's staging file, lose an update, or persist a different process's token. The read/renew/login/write sequence is also unlocked, so simultaneous callers may issue redundant logins or renewals.
150
+ ### F1 — High: Vault destination trust does not establish trust in the environment being sourced
93
151
 
94
- Creation modes do not repair existing permissive files/directories, prevent following a preexisting symlink, or establish Windows ACL isolation. These are hardening gaps, not evidence that plaintext tokens are written.
152
+ **Classification:** Verified observation; downstream exploitation is conditional on sourcing an attacker-controlled project configuration.
95
153
 
96
- **Remedy:** use unique exclusively created temporary files in a verified private directory, close and optionally sync before rename, and clean up only the writer's own file. Coordinate the session lifecycle with a cross-runtime lock and re-read inside the lock. Check ownership/permissions, avoid symlink traversal, and implement/test the Windows ACL equivalent.
154
+ **Evidence**
97
155
 
98
- ### 7. Medium — Cache identity selection is not authentication identity selection
156
+ - `node_modules/vauth-login/index.js:62–105` selects project configuration and checks whether its Vault address is known.
157
+ - `index.js:193–197` validates environment-key syntax but does not restrict sensitive names.
158
+ - `vauth.go:313–322` implements the same unrestricted mapping behavior.
159
+ - `index.js:26` and `vauth.go:35–36` install a function that sources the generated exports.
160
+ - `index.js:163–166,193–197` and `vauth.go:256–262,314–322` allow mapped values to replace initially selected `VAULT_TOKEN` and `VAULT_ADDR`.
99
161
 
100
- **Evidence:** `index.js:143,390–419`; `cache.go:89–94`; `vault.go:110–158`; identity-selection tests in `test/token-cache.js`.
162
+ **Impact**
101
163
 
102
- Identity/mail settings select new cache encryption, not the SSH login key: login tries all agent identities in order. Cache reads use the embedded fingerprint, so changing selectors does not isolate users when the old key remains loaded. Multiple identities sharing the same Vault/role configuration also share the cache filename. Agent ordering can therefore determine the authenticated principal independently of the advertised cache selector.
164
+ A syntactically valid key can still change security-sensitive behavior. A project configuration can export `PATH`, `BASH_ENV`, `NODE_OPTIONS`, loader-related variables, or replacement Vault credentials and addresses.
103
165
 
104
- Both SSH loops swallow all login failures and continue, including transport/server failures. Node signing failures escape the loop, whereas Go signing refusals skip to another key. There is no JWT fallback after an attempted SSH login fails. On Windows, Node explicitly selects `pageant`; Go's dependency discovers a Pageant pipe and otherwise selects OpenSSH, so the documented fallback is not implemented identically.
166
+ Shell quoting prevents a value from becoming an immediate shell command during assignment. It does not prevent subsequent commands or runtimes from acting on that value. A malicious `PATH`, for example, can redirect later command execution.
105
167
 
106
- **Remedy:** expose an explicit authentication-key fingerprint separate from, or intentionally coupled to, cache encryption selection. Include principal selection in session identity. Define fallback and error-classification rules, constrain agent access/signing, and harmonize Windows agent selection. Document that access to a loaded key's signing service can enable cache decryption; armor is not protection against an already-compromised session with agent access.
168
+ The known-Vault check protects requests to the selected endpoint; it is not an approval mechanism for the rest of `.vauthrc`. Configurations that require no Vault request can also reach environment publication.
107
169
 
108
- ### 8. Medium — Configuration and macro semantics diverge and can silently preserve mistakes
170
+ **Suggested fix**
109
171
 
110
- **Evidence:** `index.js:67–88,293–335`; `rc.go:121–136,155–245,247–301,340–371`; locally installed `nyks/string/replaceEnv.js` and `nyks/object/walk.js`.
172
+ Treat approval of a configuration’s environment effects separately from approval of its Vault endpoint. Require explicit trust before sourcing an untrusted project configuration, preferably tied to its contents. Offer a restricted mode that blocks execution-controlling variables and credential/address overrides unless separately authorized. Preserve unrestricted behavior only as an explicit trusted-config choice.
111
173
 
112
- Unknown macros remain literal, including in authentication and required credential fields. Node's recursive replacement has no cycle/depth guard; cyclic references can overflow recursion or grow output. Go stops after 16 passes without reporting incomplete resolution and stringifies structured values, whereas Node can return a structured value directly. Go's YAML walk processes mapping keys as well as values; Node's object walk processes values only. Alias handling and YAML coercion further complicate parity. Unknown configuration fields are not comprehensively rejected.
174
+ ### F2 — Medium: The installed shell wrapper can hide environment-generation failure
113
175
 
114
- **Remedy:** publish a constrained schema and deterministic macro specification covering types, missing values, recursion, keys, and aliases. Reject unresolved required fields, detect cycles, and bound expansion depth and output size with errors rather than partial success. Treat secret values as literal data by default instead of automatically interpreting embedded macros.
176
+ **Classification:** Verified observation based on the generated Bash function.
115
177
 
116
- ### 9. Medium — Cache hashing is order-sensitive, and Go can retain a stale auth hash
178
+ **Evidence**
117
179
 
118
- **Evidence:** `index.js:110–115`; `rc.go:27–45,247–301,358–371`; `cache.go:23–31`; `vauth_test.go:TestTokenCacheKeyMatchesNode`.
180
+ - `index.js:26`
181
+ - `vauth.go:35–36`
119
182
 
120
- The cache key hashes serialized auth objects rather than a normalized semantic session. Reordering nested YAML auth fields can create another cache entry for the same session. Raw JWT inclusion also causes cache fragmentation as JWTs rotate. Go reimplements Node-style serialization and tests only a small number of expected strings, not a real Node-to-Go session exchange.
183
+ Both define:
121
184
 
122
- More importantly, `ParseRC` stores `authKey`, and `AuthKey()` prefers it over the public auth structs. If an embedding caller changes a parsed role or JWT, the runtime auth configuration changes but the cached hash does not. That can reuse or overwrite a token associated with the earlier configuration.
185
+ ```bash
186
+ function venv() { source <(/usr/bin/env vauth env --source "$@"); }
187
+ ```
123
188
 
124
- **Remedy:** derive a versioned canonical session identity from immutable validated configuration, or invalidate/recompute it whenever public auth settings change. Normalize ordering/defaults and define JWT rotation semantics deliberately. Add bidirectional cross-runtime cache tests using the same parsed configuration and principal settings.
189
+ The forwarding test at `test/token-cache.js:372–410` exercises successful operation.
125
190
 
126
- ### 10. Medium — Environment publication has stale-state and data-format hazards
191
+ **Impact**
127
192
 
128
- **Evidence:** `index.js:248–255,300–335,340–345`; `vauth.go:366–424,448–470,475–487`; `FunctionDecl` in both implementations.
193
+ Bash returns the status of `source`, not reliably the exit status of the process-substitution producer. If the CLI fails without producing exports, sourcing an empty stream can succeed.
129
194
 
130
- Valid names such as `VAULT_TOKEN`, `VAULT_ADDR`, `PATH`, and runtime loader options remain unrestricted in `env.map`; mapping happens after the helper adds its own Vault values. A trusted authenticated session can thus publish a different token/address pair. Missing profile values differ by runtime: Node can retain `undefined`, while Go can retain a macro literal. Raw dotenv output does not escape multiline, quote, or comment-sensitive values.
195
+ Scripts using `venv && ...` may therefore continue with stale credentials or an old environment after authentication, configuration, or decryption failure. The CLI can correctly reject an operation while its installed shell integration obscures that rejection.
131
196
 
132
- The installed `venv` function sources process-substitution output without propagating the producer's exit status. A failed resolver can leave old credentials in the shell while the sourcing operation appears successful. Successful output also does not unset credentials absent from the newly resolved environment. Public Go `PublishEnv` assumes callers supply validated names and ignores output errors.
197
+ **Suggested fix**
133
198
 
134
- **Remedy:** reserve or explicitly authorize sensitive overrides, validate environment values at publication, and define missing/null behavior. Use a specified dotenv encoder or reject values outside its supported format. Make the shell wrapper check producer success before sourcing and manage previously exported variables explicitly. Validate names at exported sinks and return write errors.
199
+ Capture generated output, check the CLI’s exit status, and source it only after successful completion. Add repository tests covering failed authentication, malformed configuration, and decryption failure through the installed function. Define the expected handling of stale credentials.
135
200
 
136
- ### 11. Medium — Private database updates can lose concurrent changes
201
+ ### F3 — Medium: Macro replacement interprets secret values as replacement syntax and has no recursion bound
137
202
 
138
- **Evidence:** `index.js:258–268,362–386`; `vauth.go:333–347`; `vault.go:203–237`.
203
+ **Classification:** Verified observation; resource-exhaustion consequences were not dynamically reproduced.
139
204
 
140
- `set` and `unset` read the complete `.vauth_database`, edit it, then replace the complete KV-v2 document without a version/CAS condition. Concurrent updates can overwrite each other. Secret paths, mounts, login metadata, and entity IDs are concatenated into URLs without a shared validation/encoding policy. Vault remains the authorization boundary, but ambiguous path characters or missing identity fields can target unintended paths or produce confusing errors. Later secret documents also silently override earlier fields.
205
+ **Evidence**
141
206
 
142
- **Remedy:** retain KV-v2 version metadata, use CAS and bounded conflict retries, validate identity/path components, and construct URLs safely. Specify duplicate-secret precedence and provide a strict collision mode. Treat tokens without entity metadata as an explicit supported case or reject profile-dependent operations with a precise error.
207
+ - `node_modules/nyks/string/replaceEnv.js:20–24` uses `String.replace` with the resolved value as a replacement string, then recursively expands again.
208
+ - Cached Go `nyks/string/replaceEnv.go:45–50,72–99` reproduces JavaScript replacement-string semantics and recursive expansion.
209
+ - Call sites include `index.js:46,197` and `rc.go:196–198`, plus authentication configuration expansion in both `vauth-login` implementations.
143
210
 
144
- ### 12. Medium — Error handling can expose sensitive response content or hide the real failure
211
+ **Impact**
145
212
 
146
- **Evidence:** `index.js:362–386,410–419,472–483`; `vault.go:17–24,99–107,151–158,203–235`; `vauth.go:508–521`; local Node runner error handling.
213
+ Resolved values containing replacement metacharacters are not inserted literally. Examples include:
147
214
 
148
- Several errors include complete remote response bodies; the Node runner also prints the error and stack. A server or proxy can return sensitive or attacker-controlled text. Cache read failures are all swallowed, obscuring permission, integrity, and unavailable-agent failures. Missing auth capability can yield successful empty connection results on the first attempt. Go's installer ignores a `.bashrc` read error before writing; Node's function check has no child-spawn error handling. Interactive installation prompts also contradict the blanket machine-readable-stdout claim.
215
+ - `$$`, which becomes a single dollar sign.
216
+ - `$&`, which substitutes the matched macro.
217
+ - Prefix/suffix replacement forms, which introduce surrounding template text.
149
218
 
150
- **Remedy:** use typed, contextual, redacted errors with bounded/sanitized remote messages, and make diagnostics distinguish expected cache misses from operational failures without secrets. Separate offline mode from required authentication. Preserve existing shell files on read failure, handle process-start errors, return output errors, and document interactive commands as exceptions to machine-readable output.
219
+ This can corrupt passwords, tokens, connection strings, and configuration values. A replacement that recreates the original macro can also cause repeated recursion rather than a bounded error.
151
220
 
152
- ### 13. Medium — The Node/Go CLI parity contract is currently false in important cases
221
+ Cross-language agreement does not eliminate the defect: both implementations deliberately share these semantics.
153
222
 
154
- **Evidence:** `index.js:103–107,495–498`; `cmd/vauth/main.go:98–114,175–201`; locally installed `cnyks/lib/index.js`, `nyks/process/parseArgs.js`, and child-process helpers.
223
+ **Suggested fix**
155
224
 
156
- Static dispatch analysis identifies concrete mismatches not exercised by the current suites:
225
+ Insert resolved values literally. In Node, use a replacement callback; in Go, concatenate the intended segments without interpreting replacement metacharacters. Add cycle detection, expansion-count limits, and output-size limits. Add shared regression fixtures for dollar-containing credentials and non-progressing expansion.
157
226
 
158
- - Node selects raw output unless JSON is requested; its runner stringifies ordinary objects as raw strings. Bare `env`/`show` therefore do not receive the JSON-object formatting promised for both runtimes. Go explicitly JSON-encodes objects.
159
- - Go implements `version`/`--version`; the Node class and inspected runner contain no corresponding version command.
160
- - Node's runner leaves the textual flag value `false` as a truthy string, contrary to the documented boolean rule; Go interprets it as false. Node also coerces numeric-looking `set` arguments, unlike Go's string-preserving CLI.
161
- - Node's child helper turns any nonzero child status into a generic rejection and exits 1; Go propagates the child's exit code.
162
- - The documented `vauth run -- <command>` form passes `--` as the executable in both dedicated run paths, which forward original arguments rather than consuming that separator.
227
+ ### F4 — Medium: Node release dependencies are not reproducibly locked
163
228
 
164
- **Remedy:** use explicit command dispatch and shared argument/output rules rather than reflection as the Node contract boundary. Add version handling, preserve `set` strings, normalize booleans and separators, and propagate child statuses. Exercise both actual CLIs against the same contract fixtures, including default output and failure cases.
229
+ **Classification:** Verified observation.
165
230
 
166
- ### 14. Medium — Testing and release gates do not establish the advertised assurance
231
+ **Evidence**
167
232
 
168
- **Evidence:** both test files; `.github/workflows/test.yml`, `publish-npm.yml`, `release.yml`; `.goreleaser.yaml`; `.gitignore:2`; package manifests.
233
+ - `package.json:15–21` uses caret ranges for runtime dependencies.
234
+ - `.npmrc:1` disables package-lock handling.
235
+ - `.gitignore:2` excludes `package-lock.json`.
236
+ - `.github/workflows/publish-npm.yml:21` and `.github/workflows/test.yml:18` use `npm install`.
237
+ - The ignored local lockfile declares `2.5.0` at lines `3` and `9` and contains older dependency entries.
169
238
 
170
- Tests are strong for JWT/cache lifecycle but neither fake Vault implements SSH nonce/login or meaningful KV/profile operations. Go lacks CLI tests and identity-selection coverage comparable to Node. Armor interoperability checks use each runtime's corresponding crypto CLI, not a bidirectional Node/Go vvauth cache exchange; Go can skip its CLI check when unavailable.
239
+ **Impact**
171
240
 
172
- The Node CI job runs only on Linux. The Windows Go job builds instead of running tests, despite `API_and_tests.md` saying both suites run on Linux and Windows. Existing test harnesses assume Unix-style `ssh-agent -s`, Bash, and process cleanup. No race/concurrency, hostile transport, or broad configuration-contract coverage is present.
241
+ The dependency graph tested and published can change without a source-commit change. Future compatible dependency releases can alter authentication, cryptography, or transport behavior in CI.
173
242
 
174
- Node workflows run `npm install`, while `package-lock.json` is ignored and untracked in this checkout, so CI dependency resolution is not tied to a committed lock. The Node package declares no engine requirement although CI tests only Node 24. Publishing uses a different event (`create`) from binary releases (`push` with tag filtering), has no explicit tag-type guard or production environment in the job, and does not validate package/module/tag version agreement. Release actions, GoReleaser selection, and the trusted external signing helper use movable refs/ranges. Checksums and an external signing hook do not alone prove that every Windows artifact is signed, and the README download commands do not verify downloaded artifacts.
243
+ The local lockfile is not evidence of current development replacements: its stale links and versions do not describe the inspected installed dependency versions. It nevertheless cannot serve as a reproducible release input.
175
244
 
176
- **Remedy:** add common CLI, SSH/profile/KV, and real cross-runtime cache fixtures; make optional interop mandatory in release CI. Run platform-appropriate tests on Windows and declare the supported Node range. Commit a lockfile and use reproducible dependency installation. Align publication triggers, protect release environments/tags, and validate version agreement. Pin trusted build actions/helpers to reviewed immutable revisions, verify required signatures before publishing, provide provenance/checksum verification instructions, and ensure release gates cover both implementations.
245
+ **Suggested fix**
177
246
 
178
- ## Recommended order of work
247
+ Adopt a committed, current lockfile and `npm ci` for CI and publication, with reviewed dependency updates. Record the actual release dependency graph. Keep consumer-facing ranges if desired, but make the publisher’s build and test environment reproducible.
179
248
 
180
- 1. Establish trusted configuration/origin selection and safe transport defaults, especially Go redirect suppression.
181
- 2. Fix the explicit CLI-contract mismatches and the shell wrapper's failure propagation.
182
- 3. Validate/version cache payloads, eliminate fixed staging names, and make lifecycle decisions concurrency-safe.
183
- 4. Define token ownership, authentication identity, configuration immutability, and macro semantics.
184
- 5. Add shared end-to-end parity fixtures, real platform tests, and reproducible/protected release gates.
249
+ ### F5 — Medium: Release execution relies on mutable external references, including the signing helper
185
250
 
186
- ## Final scores
251
+ **Classification:** Verified observation; compromise of those upstream references is a hypothesis, not an observed event.
187
252
 
188
- These are qualitative engineering judgments, not vulnerability counts or certification grades.
253
+ **Evidence**
189
254
 
190
- | Criterion | Score / 20 | One-line justification |
191
- | --- | ---: | --- |
192
- | Coolness | **17 / 20** | Agent-backed armored caching, offline secret resolution, and two interoperable implementation targets make a genuinely useful developer tool. |
193
- | Robustness | **11 / 20** | Strong cache regression tests are offset by lifecycle/concurrency gaps, weak transport bounds, and concrete CLI/configuration parity defects. |
194
- | Safety | **10 / 20** | Encryption and shell-value hygiene are good, but implicit configuration trust, Go redirect leakage, token retention, and insufficient context validation need hardening. |
255
+ - `.github/workflows/release.yml:15–30` uses major-version action references, checks out `131/gh-actions` at `v1`, and selects a GoReleaser version range.
256
+ - `.goreleaser.yaml:18–19` executes the externally checked-out signing helper.
257
+ - `.github/workflows/release.yml:31–33` supplies release and signing-related values to the release step.
258
+ - Publication and test workflows also use major-version action references.
195
259
 
196
- **Signed: Codex (GPT 6.1-sol)**
260
+ **Impact**
261
+
262
+ The same source tag can execute different third-party or shared workflow code over time. The signing helper is particularly sensitive because it participates in creating a trusted executable and runs within the release credential boundary.
263
+
264
+ This checkout does not contain the helper implementation, so its behavior and protection of signing access were not verified.
265
+
266
+ **Suggested fix**
267
+
268
+ Pin actions and the signing-helper checkout to reviewed commit hashes; pin the GoReleaser version. Update them through review. Minimize credential exposure across steps and verify the signed artifact after the hook. Retain an explicit record of the workflow and helper revisions used for each release.
269
+
270
+ ### F6 — Medium: Trusted endpoints may still use plaintext HTTP
271
+
272
+ **Classification:** Verified observation; exposure depends on deployment configuration and network position.
273
+
274
+ **Evidence**
275
+
276
+ - `node_modules/vauth-login/index.js:308–324` accepts the configured URL without requiring HTTPS.
277
+ - `node_modules/nyks/http/request.js:63` selects HTTPS only for `https:`.
278
+ - Cached Go `vauth-login/vault.go:55–65` creates a request and attaches `X-Vault-Token` without enforcing HTTPS.
279
+
280
+ **Impact**
281
+
282
+ An explicitly trusted non-loopback HTTP endpoint can receive JWT login payloads, bearer tokens, and secret responses without transport encryption. Destination approval is not equivalent to transport protection.
283
+
284
+ No real deployment was inspected, and this finding does not assert that production currently uses HTTP. Repository loopback HTTP fixtures are appropriate for synthetic tests.
285
+
286
+ **Suggested fix**
287
+
288
+ Require HTTPS for non-loopback destinations by default. Provide an explicit insecure-development exception rather than silently accepting plaintext transport. Validate the URL scheme early and retain normal certificate verification.
289
+
290
+ ### F7 — Medium: HTTP response buffering is unbounded
291
+
292
+ **Classification:** Verified observation.
293
+
294
+ **Evidence**
295
+
296
+ - `node_modules/vauth-login/index.js:324–325` drains the full response.
297
+ - `node_modules/nyks/stream/drain.js:12,21–26` accumulates every chunk before concatenation.
298
+ - Cached Go `vauth-login/vault.go:69–70` calls `io.ReadAll` without a size limit.
299
+
300
+ **Impact**
301
+
302
+ An oversized response from an approved, compromised, malfunctioning, or intercepted endpoint can exhaust client memory. This applies to error responses as well as successful JSON responses.
303
+
304
+ The 60-second transport timeouts are useful but do not bound the number of bytes received within that period.
305
+
306
+ **Suggested fix**
307
+
308
+ Enforce response-size limits suitable for authentication, identity, and KV operations. Abort oversized streams before buffering completes, and return a sanitized error. Apply related bounds to local encrypted payloads where appropriate.
309
+
310
+ ### F8 — Medium: Dotenv output does not encode multiline or parser-sensitive values
311
+
312
+ **Classification:** Verified observation.
313
+
314
+ **Evidence**
315
+
316
+ - `index.js:207–215` prints `${k}=${String(v)}\n`.
317
+ - `vauth.go:360–368` prints `%s=%s\n`.
318
+ - Scalar validation in `index.js:260–265` and `rc.go:129–154` does not reject line breaks.
319
+
320
+ **Impact**
321
+
322
+ A value containing a newline can become additional dotenv records when consumed by another tool. Quote, comment, and whitespace interpretation also depends on the downstream dotenv parser.
323
+
324
+ The output therefore cannot reliably preserve every accepted environment value. This is a dotenv serialization problem, not a failure of the separately implemented shell quoting.
325
+
326
+ **Suggested fix**
327
+
328
+ Define a supported dotenv grammar and encode values accordingly, with round-trip tests against supported consumers. If portability cannot be guaranteed, reject unsupported multiline or parser-sensitive values and recommend JSON or shell-export output.
329
+
330
+ ### F9 — Low: Public publication helpers do not enforce their own key-safety invariant
331
+
332
+ **Classification:** Verified observation; exposure through arbitrary reflective CLI dispatch was not independently verified.
333
+
334
+ **Evidence**
335
+
336
+ - `index.js:94–100` interpolates supplied keys into both export and echo commands.
337
+ - `vauth.go:346–352` does the same for `OrderedMap.Keys`.
338
+ - The key validation exists in `Env`, at `index.js:193–196` and `vauth.go:314–316`, rather than in `PublishEnv`.
339
+
340
+ **Impact**
341
+
342
+ Normal environment resolution validates mapped keys, and internal login/GitLab callers use fixed keys. However, SDK callers can invoke the public publication helper directly with an unsafe key and obtain executable shell syntax.
343
+
344
+ The helper’s safety depends on a precondition that its implementation does not enforce.
345
+
346
+ **Suggested fix**
347
+
348
+ Validate every key at the publication boundary before writing any output. Return an error for invalid keys. Keep caller-side validation for useful diagnostics, but make the shell emitter safe independently.
349
+
350
+ ### F10 — Low: Private KV updates can overwrite concurrent changes
351
+
352
+ **Classification:** Verified observation of the update algorithm; concurrent loss was not dynamically reproduced.
353
+
354
+ **Evidence**
355
+
356
+ - `index.js:104–112` reads the profile/database, modifies one key, and writes the complete database.
357
+ - `vauth.go:209–223` implements the same read-modify-write sequence.
358
+ - `index.js:228–230` and `vault.go:35–45` send complete KV data without a compare-and-set option.
359
+
360
+ **Impact**
361
+
362
+ Two clients updating different keys can read the same version and then overwrite one another’s changes. An `unset` can likewise restore unrelated stale data through the full-object write.
363
+
364
+ Vault ACLs still control access; this is an integrity/concurrency issue rather than an authorization bypass.
365
+
366
+ **Suggested fix**
367
+
368
+ Use KV-v2 version metadata and compare-and-set writes, with bounded retries after conflicts. Add concurrent update and delete regression tests.
369
+
370
+ ## 4. Strengths
371
+
372
+ - **Clear separation of responsibilities.** Authentication, cache lifecycle, and HTTP requests are delegated to `vauth-login`; vvauth concentrates on profile, KV, and environment resolution.
373
+ - **Destination checks occur before requests.** Both inspected authentication implementations reject unknown project-selected Vault endpoints at the transport boundary.
374
+ - **Default redirects are not followed.** Node does not enable redirect following; the Go default client explicitly returns the last redirect response. This reduces credential-forwarding risk.
375
+ - **Useful transport deadlines.** Both implementations default to approximately 60 seconds.
376
+ - **Encrypted persistence.** New cache writes contain armor rather than plaintext tokens. Node uses exclusive temporary-file creation and rename; Go uses a temporary file and rename. New Unix directories/files request restrictive modes.
377
+ - **Authenticated encryption construction.** The selected cryptographic implementation uses randomized salt/IV, separated encryption/MAC keys, authenticates v3 framing, and checks the MAC before decrypting. This is a positive source observation, not a formal cryptographic proof.
378
+ - **Namespace separation.** New v3 key derivation uses the `ssh-agent-crypt` SSHSIG namespace rather than the generic legacy `file` namespace.
379
+ - **Credential-conscious diagnostics.** Token status messages do not print token values; HTTP error messages expose status rather than automatically rendering response bodies.
380
+ - **Inherited-token ownership is respected.** Ordinary connection does not automatically renew or persist an inherited token.
381
+ - **Failure behavior distinguishes invalid tokens from server failures.** Renewal failures with 400/403 can trigger reauthentication; other failures are propagated rather than blindly generating more tokens.
382
+ - **Shell values are quoted correctly for assignment.** Single-quote escaping and map-key syntax checks address direct shell-syntax injection in the normal `Env` path.
383
+ - **Configuration snapshots are preserved.** Node retains a frozen raw snapshot; Go returns independent snapshots and clones selected configuration before expansion.
384
+ - **Substantial synthetic fixtures exist.** Tests cover disposable agents, loopback services, cache lifecycle, transport trust, scalar validation, and CLI behavior without requiring production Vault access.
385
+ - **Release controls are visible.** CI permissions are declared, the native release job uses a production environment, GoReleaser emits checksums, and Windows builds have a signing hook.
386
+
387
+ Cached-token reuse without a revocation lookup is an explicit behavior represented in the tests. It improves offline reuse but can delay discovery of revocation. It does not bypass Vault’s server-side authorization.
388
+
389
+ ## 5. Limitations
390
+
391
+ 1. **No network access and no live vulnerability-database scanning were performed.** Dependency versions were inspected, but no claim is made that they are free of known vulnerabilities.
392
+ 2. **Runtime suites were not executed.** Syntax, lint, formatting, and local module-graph success must not be confused with passing integration tests.
393
+ 3. **Dependency review was selective.** It did not exhaustively cover `cnyks` reflection, SSH protocol internals, YAML parsing, Node/Go standard libraries, or all transitive dependencies.
394
+ 4. **Cryptography was inspected, not formally audited.** Legacy v1/v2 reading remains supported. Agent compromise, memory scraping, filesystem rollback, and local same-user attacks were not experimentally evaluated.
395
+ 5. **Agent operations do not inherit the HTTP timeout.** Agent blocking and Windows pipe behavior remain runtime verification gaps.
396
+ 6. **No production policy was assessed.** Vault ACLs, roles, token TTL policies, endpoint configuration, GitHub environment approvals, tag protections, and npm trusted-publishing configuration were not inspected.
397
+ 7. **Signing and installation were not verified.** The configuration establishes a Windows signing hook, not proof of a valid signature. The Linux build has checksum generation, but this checkout does not show an equivalent Linux signing hook.
398
+ 8. **Published artifacts were not compared with source.** No npm tarball, module archive, release binary, checksum, or provenance attestation was retrieved.
399
+ 9. **The upcoming patch remains outside this assessment.** Findings apply to the identified functional source and selected installed dependency versions.
400
+ 10. **Execution-model identity is host-declared.** It was not independently verified through client or environment inspection.
401
+
402
+ This report is not a release approval or a guarantee of safety. The highest-priority improvements are explicit configuration trust, reliable shell failure propagation, and literal, bounded interpolation.
403
+
404
+ ## 6. Scores
405
+
406
+ | Category | Score | Justification |
407
+ |---|---:|---|
408
+ | **Coolness** | **17/20** | A compact, useful dual-language credentials helper combining Vault profiles, encrypted local data, environment resolution, native CLI distribution, and shared behavior. |
409
+ | **Robustness** | **13/20** | Strong synthetic fixtures, configuration snapshots, cache lifecycle handling, and transport deadlines; deductions for shell failure masking, interpolation semantics, serialization gaps, unbounded buffering, and lost-update risk. Runtime verification remains incomplete. |
410
+ | **Safety** | **12/20** | Meaningful destination checks, encrypted persistence, redacted diagnostics, and shell quoting; deductions for the untrusted-configuration boundary, optional plaintext transport, publication-helper preconditions, and mutable release inputs. This score is not a vulnerability-database clearance. |