Commit 107dbb1
committed
feat(auth): move browser login to RFC 8628 device flow on www.vulnetix.com
`vulnetix auth login` no longer talks to app.vulnetix.com. The flow is now a
proper device authorization grant served by www.vulnetix.com.
The old scheme was not a device flow. The CLI invented the six-character code
and polled a public endpoint that handed the org ApiKey to whoever presented an
unclaimed code inside the five-minute TTL. Nothing bound the CLI that created
the code to the client that collected the key; guessing the 36^6 space was the
only barrier. The endpoints were also hardcoded constants, so the flow could
not be pointed at a test server and had no test coverage at all.
Now:
- The CLI POSTs /cli/device/authorize before opening a browser and receives a
256-bit device_code plus a short user_code. The device_code is the credential
and is never printed; the user_code is only an approval handle.
- Polling /cli/device/token honours the server's interval and expires_in, and
handles authorization_pending, slow_down (backs off), expired_token and
access_denied. A 429 from the rate limiter also backs off.
- The browser is opened at verification_uri_complete, so the code is pre-filled
and the user confirms rather than transcribes.
- VULNETIX_WEB_URL overrides the console base for local verification, mirroring
VULNETIX_API_URL. `--verbose` prints the resolved endpoints.
Adds cmd/auth_device_test.go — the first test coverage of this code — driving
the whole client state machine against an httptest server, and
scripts/verify-device-flow.sh, which stands up website + vdb-site + Postgres
locally and asserts the proxy path, the JWT gate, the rate limiter, the pending
state, single-use redemption, and that only the sha256 of the device_code is
persisted.
Docs: every `--base-url https://app.vulnetix.com/api` example was wrong. The
CLI has never contacted that host. Uploads and `gha` go to
api.vdb.vulnetix.com/v1, `vdb`/`package-firewall` to api.vdb.vulnetix.com, and
`/api/check` never existed — the reachable probe is /health. The corporate
proxy guide now names all three hosts an allowlist must carry.
Lint: golangci-lint is clean uncapped. Removes seven dead functions, fixes four
ineffectual assignments (one in the login path), two S1017 TrimPrefix cases, an
empty branch and a dead append, and checks the errors that errcheck flagged.
Adds a lint job to CI with a pinned linter version, and a pre-commit hook
(`just hooks`).1 parent f58ba12 commit 107dbb1
127 files changed
Lines changed: 13104 additions & 1556 deletions
File tree
- .githooks
- .github/workflows
- cmd
- docs
- examples/gitlab
- component
- templates
- templates
- internal
- filetree
- gitctx
- github
- memory
- sast
- scan
- secretscan
- testutils
- tui
- update
- upload
- pkg
- auth
- cache
- vdb
- scripts
- website/content/docs
- authentication
- ci-cd
- cli-reference
- enterprise
- getting-started
- sast-rules
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
17 | 23 | | |
18 | 24 | | |
19 | 25 | | |
| |||
22 | 28 | | |
23 | 29 | | |
24 | 30 | | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
| 50 | + | |
43 | 51 | | |
44 | 52 | | |
45 | 53 | | |
46 | 54 | | |
47 | 55 | | |
48 | 56 | | |
49 | | - | |
| 57 | + | |
50 | 58 | | |
51 | 59 | | |
52 | 60 | | |
| |||
99 | 107 | | |
100 | 108 | | |
101 | 109 | | |
| 110 | + | |
102 | 111 | | |
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
108 | | - | |
| 117 | + | |
109 | 118 | | |
110 | 119 | | |
111 | 120 | | |
| |||
137 | 146 | | |
138 | 147 | | |
139 | 148 | | |
| 149 | + | |
140 | 150 | | |
141 | 151 | | |
142 | 152 | | |
| |||
180 | 190 | | |
181 | 191 | | |
182 | 192 | | |
| 193 | + | |
183 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
184 | 198 | | |
185 | 199 | | |
186 | 200 | | |
| |||
206 | 220 | | |
207 | 221 | | |
208 | 222 | | |
| 223 | + | |
209 | 224 | | |
210 | 225 | | |
211 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
17 | 59 | | |
18 | 60 | | |
| 61 | + | |
19 | 62 | | |
20 | 63 | | |
21 | 64 | | |
| |||
24 | 67 | | |
25 | 68 | | |
26 | 69 | | |
27 | | - | |
| 70 | + | |
28 | 71 | | |
29 | 72 | | |
30 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | | - | |
| 390 | + | |
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
| 411 | + | |
411 | 412 | | |
412 | 413 | | |
413 | 414 | | |
| |||
584 | 585 | | |
585 | 586 | | |
586 | 587 | | |
587 | | - | |
| 588 | + | |
588 | 589 | | |
589 | 590 | | |
590 | 591 | | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
| 592 | + | |
| 593 | + | |
595 | 594 | | |
596 | 595 | | |
597 | 596 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | | - | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| |||
0 commit comments