vvauth 2.5.0 → 2.6.1

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.
@@ -0,0 +1,410 @@
1
+ # Security Audit — vvauth
2
+
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.
9
+
10
+ ## 1. Provenance
11
+
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.
13
+
14
+ The following inputs were excluded:
15
+
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.
23
+
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.
25
+
26
+ The applicable `$AGENT_WORKSPACE/AGENTS.md` was read. The checkout is unmapped in the internal monolith, and no neighboring project rules were adopted.
27
+
28
+ No repository files were modified. Git metadata confirmed the assessed commit, branch, canonical remote, and clean tracked working tree.
29
+
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.
31
+
32
+ ## 2. Scope and Method
33
+
34
+ ### 2.1 Explicit input inventory
35
+
36
+ #### Project implementation
37
+
38
+ - `index.js`
39
+ - `cmd/vauth.js`
40
+ - `vauth.go`
41
+ - `vault.go`
42
+ - `rc.go`
43
+ - `gitlab.go`
44
+ - `cmd/vauth/main.go`
45
+
46
+ These cover profile resolution, private KV updates, environment mapping, shell publication, local encrypted credentials, Git remote interpretation, construction, and CLI dispatch.
47
+
48
+ #### Repository tests
49
+
50
+ - `test/token-cache.js`
51
+ - `vauth_test.go`
52
+ - `gitlab_test.go`
53
+
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.
55
+
56
+ #### Manifests and supporting configuration
57
+
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`
66
+
67
+ The local `package-lock.json` is ignored and untracked. Its stale contents were treated as local metadata, not as the canonical dependency specification.
68
+
69
+ `package.json` declares **ISC**. No standalone project license text was independently verified.
70
+
71
+ #### Release and CI configuration
72
+
73
+ - `.github/workflows/test.yml`
74
+ - `.github/workflows/publish-npm.yml`
75
+ - `.github/workflows/release.yml`
76
+ - `.goreleaser.yaml`
77
+
78
+ #### Selected installed Node dependency inputs
79
+
80
+ Under `node_modules/`:
81
+
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`
97
+
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:
99
+
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 |
105
+
106
+ #### Selected cached Go dependency inputs
107
+
108
+ Under `/root/go/pkg/mod/`:
109
+
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`
117
+
118
+ Dependency paths in findings below refer to these installed versions.
119
+
120
+ ### 2.2 Safe local checks performed
121
+
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 |
132
+
133
+ These checks do not establish runtime correctness or absence of vulnerabilities.
134
+
135
+ ### 2.3 Checks not performed
136
+
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.
143
+
144
+ No real credentials, token caches, SSH agents, or Vault endpoints were accessed.
145
+
146
+ ## 3. Prioritized Findings
147
+
148
+ “Verified observation” below means directly established from the inspected source or local metadata. It does **not** imply that an exploit was dynamically reproduced.
149
+
150
+ ### F1 — High: Vault destination trust does not establish trust in the environment being sourced
151
+
152
+ **Classification:** Verified observation; downstream exploitation is conditional on sourcing an attacker-controlled project configuration.
153
+
154
+ **Evidence**
155
+
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`.
161
+
162
+ **Impact**
163
+
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.
165
+
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.
167
+
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.
169
+
170
+ **Suggested fix**
171
+
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.
173
+
174
+ ### F2 — Medium: The installed shell wrapper can hide environment-generation failure
175
+
176
+ **Classification:** Verified observation based on the generated Bash function.
177
+
178
+ **Evidence**
179
+
180
+ - `index.js:26`
181
+ - `vauth.go:35–36`
182
+
183
+ Both define:
184
+
185
+ ```bash
186
+ function venv() { source <(/usr/bin/env vauth env --source "$@"); }
187
+ ```
188
+
189
+ The forwarding test at `test/token-cache.js:372–410` exercises successful operation.
190
+
191
+ **Impact**
192
+
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.
194
+
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.
196
+
197
+ **Suggested fix**
198
+
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.
200
+
201
+ ### F3 — Medium: Macro replacement interprets secret values as replacement syntax and has no recursion bound
202
+
203
+ **Classification:** Verified observation; resource-exhaustion consequences were not dynamically reproduced.
204
+
205
+ **Evidence**
206
+
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.
210
+
211
+ **Impact**
212
+
213
+ Resolved values containing replacement metacharacters are not inserted literally. Examples include:
214
+
215
+ - `$$`, which becomes a single dollar sign.
216
+ - `$&`, which substitutes the matched macro.
217
+ - Prefix/suffix replacement forms, which introduce surrounding template text.
218
+
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.
220
+
221
+ Cross-language agreement does not eliminate the defect: both implementations deliberately share these semantics.
222
+
223
+ **Suggested fix**
224
+
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.
226
+
227
+ ### F4 — Medium: Node release dependencies are not reproducibly locked
228
+
229
+ **Classification:** Verified observation.
230
+
231
+ **Evidence**
232
+
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.
238
+
239
+ **Impact**
240
+
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.
242
+
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.
244
+
245
+ **Suggested fix**
246
+
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.
248
+
249
+ ### F5 — Medium: Release execution relies on mutable external references, including the signing helper
250
+
251
+ **Classification:** Verified observation; compromise of those upstream references is a hypothesis, not an observed event.
252
+
253
+ **Evidence**
254
+
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.
259
+
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. |
package/cmd/vauth/main.go CHANGED
@@ -1,8 +1,9 @@
1
1
  // Command vauth is the standalone Vault credentials helper: same commands
2
- // and flags as the vvauth npm package (cnyks runner).
2
+ // and flags as the vvauth npm package.
3
3
  package main
4
4
 
5
5
  import (
6
+ "bytes"
6
7
  "encoding/json"
7
8
  "fmt"
8
9
  "os"
@@ -18,14 +19,13 @@ const usage = `Usage: vauth <command> [--flag[=value]] [--ir://json]
18
19
  Commands:
19
20
  env [--source] [--renew] Resolve the .vauthrc environment (JSON with --ir://json)
20
21
  login [--source] [--renew] Authenticate; --source exports VAULT_TOKEN
21
- connect [--renew] Authenticate and print the token
22
- run <command> [args...] Run a command with the resolved environment
23
22
  dotenv Print the environment as K=v lines
24
23
  show Print the identity profile and .vauth_database
25
24
  set <key> <value> Store a key in the .vauth_database
26
25
  unset <key> Remove a key from the .vauth_database
27
26
  install Install the venv shell function in ~/.bashrc
28
27
  version Print the build version
28
+ gitlab Export CI_PROJECT_* from origin without login
29
29
  `
30
30
 
31
31
  // version is set by the release build (-ldflags "-X main.version=v1.2.3");
@@ -96,10 +96,13 @@ func main() {
96
96
  }
97
97
 
98
98
  func run(argv []string) error {
99
- if len(argv) > 0 && argv[0] == "run" {
100
- return runCommand(argv[1:])
101
- }
102
99
  args, dict := parseArgs(argv)
100
+ if len(args) > 1 && args[0] == "env" && args[1] == "gitlab" {
101
+ args = []string{"gitlab"}
102
+ }
103
+ if truthy(dict["gitlab"], dict["gitlab"] != "") {
104
+ args = []string{"gitlab"}
105
+ }
103
106
  if _, ok := dict["version"]; ok && len(args) == 0 {
104
107
  args = []string{"version"}
105
108
  }
@@ -110,10 +113,14 @@ func run(argv []string) error {
110
113
  command, args := args[0], args[1:]
111
114
  _, jsonOutput := dict["ir://json"]
112
115
  if command == "version" || command == "--version" {
113
- fmt.Println(buildVersion())
116
+ fmt.Println(strings.TrimPrefix(buildVersion(), "v"))
114
117
  return nil
115
118
  }
116
119
 
120
+ if command == "gitlab" {
121
+ return (&vvauth.Vauth{}).Gitlab()
122
+ }
123
+ vvauth.Version = buildVersion()
117
124
  v, err := vvauth.New()
118
125
  if err != nil {
119
126
  return err
@@ -172,30 +179,24 @@ func run(argv []string) error {
172
179
  return fmt.Errorf("Invalid command key '%s'", command)
173
180
  }
174
181
 
175
- func runCommand(argv []string) error {
176
- if len(argv) == 0 {
177
- return fmt.Errorf("run: missing command")
178
- }
179
- v, err := vvauth.New()
180
- if err != nil {
181
- return err
182
- }
183
- code, err := v.Run(argv[0], argv[1:]...)
184
- if err != nil {
185
- return err
186
- }
187
- os.Exit(code)
188
- return nil
189
- }
190
-
191
182
  // respond prints the command result: JSON with --ir://json, raw strings
192
183
  // otherwise (objects are still rendered as JSON).
193
184
  func respond(response any, jsonOutput bool) error {
194
185
  if text, ok := response.(string); ok && !jsonOutput {
195
- // cnyks --ir://raw writes String(response) without a trailing newline.
186
+ // Raw token output has no trailing newline.
196
187
  _, err := fmt.Fprint(os.Stdout, text)
197
188
  return err
198
189
  }
190
+ if jsonOutput {
191
+ var out bytes.Buffer
192
+ encoder := json.NewEncoder(&out)
193
+ encoder.SetEscapeHTML(false)
194
+ if err := encoder.Encode(response); err != nil {
195
+ return err
196
+ }
197
+ _, err := os.Stdout.Write(bytes.TrimSuffix(out.Bytes(), []byte("\n")))
198
+ return err
199
+ }
199
200
  encoder := json.NewEncoder(os.Stdout)
200
201
  encoder.SetEscapeHTML(false)
201
202
  return encoder.Encode(response)
package/cmd/vauth.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const cnyks = require('cnyks/lib/bundle');
5
+ const Vvauth = require('../index');
6
+ const {args, dict} = require('nyks/process/parseArgs')();
7
+ const command = args.shift();
8
+ const options = command ? [`--ir://run=${command}`] : [];
9
+ if(command === 'env' && !dict['ir://json'])
10
+ options.push('--ir://raw');
11
+
12
+ cnyks(Vvauth, 'vauth', options);
package/gitlab.go ADDED
@@ -0,0 +1,47 @@
1
+ package vvauth
2
+
3
+ import (
4
+ "fmt"
5
+ "net/url"
6
+ "os/exec"
7
+ "regexp"
8
+ "strings"
9
+ )
10
+
11
+ var scpRemote = regexp.MustCompile(`^[^@]+@[^:]+:(.+)$`)
12
+ var nonSlug = regexp.MustCompile(`[^a-z0-9]+`)
13
+
14
+ func (v *Vauth) Gitlab() error {
15
+ out, err := exec.Command("git", "remote", "get-url", "origin").Output()
16
+ if err != nil {
17
+ return err
18
+ }
19
+ remote := strings.TrimSpace(string(out))
20
+ var project string
21
+ if match := scpRemote.FindStringSubmatch(remote); !strings.Contains(remote, "://") && match != nil {
22
+ project = match[1]
23
+ } else {
24
+ parsed, err := url.Parse(remote)
25
+ if err != nil {
26
+ return err
27
+ }
28
+ project = parsed.Path
29
+ }
30
+ project = strings.TrimSuffix(strings.Trim(project, "/"), ".git")
31
+ if project == "" {
32
+ return fmt.Errorf("Could not resolve the Git project from origin")
33
+ }
34
+ parts := strings.Split(project, "/")
35
+ variables := map[string]string{
36
+ "CI_PROJECT_PATH": project,
37
+ "CI_PROJECT_NAME": parts[len(parts)-1],
38
+ "CI_PROJECT_NAMESPACE": strings.Join(parts[:len(parts)-1], "/"),
39
+ "CI_PROJECT_PATH_SLUG": strings.Trim(nonSlug.ReplaceAllString(strings.ToLower(project), "-"), "-"),
40
+ }
41
+ env := &OrderedMap{}
42
+ for _, key := range []string{"CI_PROJECT_PATH", "CI_PROJECT_NAME", "CI_PROJECT_NAMESPACE", "CI_PROJECT_PATH_SLUG"} {
43
+ env.Set(key, variables[key])
44
+ }
45
+ v.PublishEnv(env)
46
+ return nil
47
+ }