Commit 5532faa
fix: comprehensive code review fixes across security, correctness, and robustness (#131)
* feat: comprehensive CLI improvements across security, MCP, UX, HTTP, and distribution
Phase 1 (Security): Redact token from debug logs, add HTTP timeouts,
add 10MB response body limits, fix remediate_finding silent error bug.
Phase 2 (MCP): Add unified abstract tools (search/get/triage/ticket/events/fix),
ToolSet flag (default/all/minimal/findings/admin), 5 new prompts, 2 new resources.
Phase 3 (UX): Move generated commands under `nullify api`, add new commands
(scan, fix, open, repos, whoami, version), concurrent API calls via errgroup,
output consistency with --output flag, --quiet/--no-color flags, help examples.
Phase 4 (HTTP): User-Agent header, retry with exponential backoff, fix env var
precedence, refreshing auth transport for MCP sessions, shared apierror package,
distinct exit codes.
Phase 5 (Distribution): Homebrew tap config, `nullify update` command, SARIF
output format, enhanced `nullify version` with build metadata.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address critical and high issues from code review
- Buffer request body in retry transport to prevent empty bodies on retry
- Clone request in RoundTrip to avoid mutating the original (both transports)
- Fix generator template missing api. prefix logic for host
- Strip api. prefix in open.go to navigate to dashboard, not API
- Remove unnecessary mutex in findings.go (goroutines write to distinct indices)
- Use DoPost instead of DoGet for mutation operations in fix.go
- Fix Content-Type check in apierror to use HasPrefix for charset variants
- Sort finding type names for deterministic MCP tool enum ordering
- Parallelize ci report API calls with errgroup
- Use structured exit codes (ExitAuthError) instead of bare os.Exit(1)
- Remove misleading _ = token in mcp.go, validate auth inline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address code review findings across security, correctness, and robustness
Critical fixes:
- Fix broken refresh token flow: send token as HTTP cookie instead of query param
to match backend expectation (security-droid reads from cookie)
- Fix GITHUB_ACTION_REPOSITORY → GITHUB_REPOSITORY (non-standard env var)
- Add url.PathEscape for finding IDs in all URL path interpolations (MCP, CLI)
- Replace bare http.Get with http.NewRequestWithContext for proper timeout/context
- URL-encode GitHub token and owner in token exchange request
Security & correctness:
- Fix retry transport to respect context cancellation (select on ctx.Done)
- Fix file handle leak in openapi.go (missing defer Close)
- Fix openapi.go nil,nil return to return descriptive error
- SanitizeNullifyHost now delegates to ParseCustomerDomain, accepting
'acme', 'acme.nullify.ai', and 'api.acme.nullify.ai' formats
- Strip path/query from host input, validate hostname characters
- Add severity-threshold validation in ci gate command
- Mark pentest --spec-path as required flag
Exit codes & UX:
- Use ExitAuthError(2) for auth failures, ExitNetworkError(3) for API errors,
ExitFindings(1) for gate failures across all commands
- Fix ci report to use limit=1000 for accurate counts (was limit=1)
- Fix "1 findings" → "1 finding" singular form in status output
- Fix auth token command to print trailing newline
- Add periodic "still waiting" message during login authentication
- Improve auth config error message
Architecture & deduplication:
- Deduplicate buildQueryString in MCP package to use lib.BuildQueryString
- Add ClientOption/WithHTTPClient to generated API client for retry support
- Export NewRetryTransport and wire retry into generated API client
- Remove unused --auth-config global flag
- Parallelize status command scanner queries with errgroup
- Add missing scanner types (pentest, bughunt, cspm) to MCP composite tools
- Use promptResult helper consistently in MCP prompts
- Fix wizard to use absolute paths via os.Getwd()
- Handle output.Print errors with stderr fallback
- Clear stale Token field on refreshing transport client
- Log warning when NULLIFY_HOST env var is invalid
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: run go mod tidy to promote golang.org/x/sync to direct dependency
The status command now directly imports errgroup from golang.org/x/sync.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: fix gofmt formatting and remove unnecessary leading newline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: fix gofmt formatting in login.go and spinner.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve timeout, host sanitization, and credential key mismatch bugs
- Move time.After(10min) outside for/select loop so it fires correctly
- Sanitize config file host through SanitizeNullifyHost in resolveHost
- Normalize credential keys to bare form (strip api. prefix) at save/lookup
- Fix SanitizeNullifyHost to return bare host form consistently
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* wip
* fix: address PR #131 review comments
- Use cmd.Context() instead of context.Background() in update command
- Accept context.Context param in setupLogger() so cobra commands pass
their own context instead of always creating a new background context
- Delete unused scan command that only printed help text
- Add credential key migration in LoadCredentials() to normalize old
"api." prefixed keys to bare form, preventing auth failures after
host sanitization changes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: handle errcheck lint error and normalize credential key lookups
- Check io.Copy return value in local_scan.go to fix golangci-lint errcheck
- Use auth.CredentialKey() for credential map lookups in all commands
(chat, mcp, status, whoami, fix, ci, findings) to match the normalized
key format used when saving credentials
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 16b3df0 commit 5532faa
54 files changed
Lines changed: 2183 additions & 377 deletions
File tree
- cmd/cli/cmd
- internal
- apierror
- api
- auth
- client
- lib
- mcp
- output
- pentest
- wizard
- scripts/generate
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 | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
| |||
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
43 | 56 | | |
44 | 57 | | |
45 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
145 | | - | |
| 145 | + | |
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
210 | 210 | | |
211 | 211 | | |
212 | 212 | | |
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
241 | 244 | | |
242 | 245 | | |
243 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
0 commit comments