Skip to content

fix/lint backlog#3

Merged
fortifyde merged 12 commits into
masterfrom
fix/lint-backlog
May 12, 2026
Merged

fix/lint backlog#3
fortifyde merged 12 commits into
masterfrom
fix/lint-backlog

Conversation

@fortifyde
Copy link
Copy Markdown
Owner

  • fix(lint): Phase 1 - quick wins (unused, ineffassign, goconst, staticcheck)
  • fix(lint): Phase 2 - errcheck (23 issues)
  • fix(lint): Phase 3 - gosec security findings (31+ issues)
  • fix(lint): Phase 5 - empty branches (SA9003)
  • fix(lint): Phase 4a - reduce cyclomatic complexity (6 functions)
  • fix(lint): Phase 4b - reduce cyclomatic complexity (4 more functions)
  • fix(lint): Phase 4c - reduce cyclomatic complexity (4 more functions)
  • fix(lint): Phase 4d - reduce cyclomatic complexity (3 more functions)
  • chore: remove accidentally committed binary

fortifyde added 12 commits May 6, 2026 19:45
…check)

- Remove unused cleanPath (fileserver) and updateDisplay (output viewer)
- Fix ineffassign in parsers.go consolidated title builder
- Extract string constants for sslscan, open, default, router, severity
  levels, switch subtype, and UI color/category strings
- Apply De Morgan's law (QF1001) in config.go and mac_table.go
- Convert if-else chains to tagged switches (QF1003)
- Replace WriteString(Sprintf(...)) with Fprintf (QF1012) throughout
- Use struct conversion for PhysicalLink (S1016)
- Fix error return ordering in StreamingResult.GetFinal (ST1008)

Reduces lint issues from 102 to 78 (24 fixed).
- Wrap deferred file.Close with explicit error discard pattern
- Handle explicit Close/Kill/Stop errors with logging or discard
- Check os.Setenv, os.Remove, filepath.Walk return values
- Explicitly discard w.Write and fmt.Scanln returns
- Handle test code errcheck with explicit discards

All 23 errcheck issues resolved.
- Tighten file/directory permissions (0777/0755→0750, 0644→0666→0600)
- Add HTTP server timeouts (ReadTimeout, WriteTimeout, IdleTimeout)
- Add log injection sanitization with sanitizeLogString helper
- Add io.LimitReader guards against decompression bombs in tests
- Add bounds check for integer overflow in concurrency test
- Add //nolint:gosec directives for accepted G304/G702/G118/G122/G602 risks
- Fix G602 slice bounds checks in tui.go

All 31+ gosec issues resolved. Many additional issues surfaced during
fixing (test files, deeper analysis) — all addressed.
- Replace empty if branches in packet capture parser with TODO comments
- Add explicit continue for informational script skip path

All 3 SA9003 staticcheck issues resolved.
- Extract parsePortLine helper from parsePortScan (22→18)
- Refactor parseNiktoXMLResult into 4 helpers (26→6)
- Extract SSL vulnerability detectors from parseSSLScanXML (22→≤20)
- Extract openScreenshotExternally from showScreenshotModal (21→20)
- Extract handleGlobalCtrlShortcuts from handleGlobalKeys (21→18)
- Extract buildMergedCaptureTasks from mergeCaptureAnalysisTasks (23→≤20)

Reduces gocyclo from 19 to 13 issues.
- Extract categorizeHosts/copyScreenshotsToDir from GenerateDistributionPackage (24→≤15)
- Extract write sections from updateDetailsPanel (29→3)
- Extract CLI helpers from run (26→18)
- Extract OS detection and port processing from parseNmapXML (25→11)

Reduces gocyclo from 13 to 9 issues.
- Extract helpers from correlateHost (23→6)
- Extract readTarEntries from TestGenerateDistributionPackage (27→16)
- Extract render helpers from showHostDetailsModal (34→≤15)
- Extract detection helpers from determineScanType (34→4+14+11+6+3)

Reduces gocyclo from 9 to 5 issues.
- Extract protocol/cipher/cert parsers from parseSSLScanResult (33→≤10)
- Extract test helpers from TestParseSSLScanResult (26→≤15)
- Refactor startSearch into searchState with 11 methods (33→2)

Reduces gocyclo from 5 to 2 issues (calculateRiskScore 41, inferHostSubtype 65
remain — extremely complex functions deferred to follow-up PR).
Remove fileserver binary and add to .gitignore.
Reduce cyclomatic complexity below gocyclo threshold by extracting
independent scoring and inference logic into focused helpers:

- scoreVulnerabilities, scoreSSLIssues, scoreServiceExposure, scoreOpenPorts
- inferWindowsSubtype, inferNetworkDeviceSubtype, inferLinuxSubtype
- inferDeviceBySysDesc, inferDeviceByOS, inferDeviceByPorts

Result: 0 golangci-lint issues (from 2 remaining gocyclo warnings).
Replace 21 occurrences of the string literal "critical" with
severityCritical across correlator.go, parsers.go, and
compliance_checks.go.
@fortifyde fortifyde merged commit 6755596 into master May 12, 2026
5 checks passed
@fortifyde fortifyde deleted the fix/lint-backlog branch May 12, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant