Commit Graph

96 Commits

Author SHA1 Message Date
lukaszraczylo b4256dbbce fix(install): verify SHA-256 checksums + portable version parsing
P0 #8 — install.sh fetched and installed the binary with no integrity
check whatsoever, despite README claiming cosign verification. A
compromised release or registry MITM resulted in RCE on every
installer.

Now:
  - downloads checksums.txt alongside the archive (required; abort on
    missing)
  - computes local SHA-256 with shasum -a 256 (works on macOS+Linux,
    not GNU-only sha256sum)
  - aborts on mismatch with a clear error
  - if cosign is in PATH AND the sigstore bundle is present (the latter
    already published by goreleaser), verifies cert-identity. Skipped
    silently when cosign is absent so the install path still works for
    users without cosign installed.
  - SKIP_COSIGN=1 lets users opt out of cosign verification only
    (checksum verification is always enforced).
  - DRY_RUN=1 verifies + downloads but does not install, for testing.

Also replaced GNU-only `grep -oP` (silently fails on macOS BSD grep)
with portable awk for parsing kportal --version.

NOTE: the cosign cert-identity regex matches lukaszraczylo/kportal/.*
but actual releases are signed from the shared-actions reusable
workflow. Users with cosign installed will currently see a verification
failure on real releases. Either widen the regex to lukaszraczylo/.*
or change the signing identity scheme — flagging for follow-up.

README install section updated to mention the new verification.
2026-05-06 10:45:45 +01:00
lukaszraczylo 95bda3ee3b fix: redact sensitive headers in httplog + restore headless logging
P0 #1 — HTTP traffic logger captured Authorization, Cookie, Set-Cookie,
X-Api-Key, X-Auth-Token, X-Csrf-Token, Proxy-Authorization, X-Access-Token
verbatim into log entries (file 0600 + UI subscribers). Bearer tokens
and session cookies were ending up on disk whenever httpLog.includeHeaders
was enabled.

flattenHeaders now redacts:
  - the explicit list above (case-insensitive via http.CanonicalHeaderKey)
  - any header name containing 'token', 'secret', 'password', 'apikey'
Header names remain visible; values become [REDACTED].
Redaction is unconditional and on-by-default — no opt-out flag. Users
who want raw headers can use tcpdump.

P0 #6 — Headless mode without -v silently routed both structured and
stdlib logs to io.Discard. A daemon under launchd/systemd had no way to
report errors. Headless now defaults log destination to os.Stderr; -v
controls only the level (debug vs info). TUI-quiet path is preserved.

Tests in internal/httplog/redact_test.go cover all explicit names,
substring patterns, and case variants.
2026-05-06 10:45:29 +01:00
lukaszraczylo 4fe3f6b21f fix(ui): Esc cancels delete confirmation instead of confirming it
In the remove-wizard's confirming state, pressing Esc was reflexively
calling removeForwardsCmd — i.e. confirming deletion. The on-screen
help text said 'Esc: Cancel'. Reflexive Esc-to-cancel destroyed data.

Esc now sets confirming=false and resets the cursor; deletion
requires Enter on Yes. Non-confirming Esc behavior (exit wizard with
ClearScreen) is unchanged.

Three regression tests added in handlers_test.go.
2026-05-06 10:45:27 +01:00
lukaszraczylo 7a33e01863 fix: 4 P0 concurrency races in forward + k8s
P0 #2 — currentConfig data race
  Manager.currentConfig was written without locking in Start/Reload but
  read from the health-checker callback goroutine. All accesses now go
  through workersMu (read or write as appropriate).

P0 #3 — Reload kills health checker permanently
  Reload's zero-forward branch called m.Stop() which tore down the
  health checker, watchdog, and event bus. After that, EnableForward
  silently registered callbacks against dead components. Now the branch
  stops only the running workers; the supervisory infrastructure stays
  alive across config changes.

P0 #4 — rest.Config write-write race
  executePortForward was mutating .Dial on the cached *rest.Config
  shared by all forwards in the same kube context. Cloning the config
  with rest.CopyConfig before mutation isolates per-forward dialers.

P0 #5 — ForwardWorker.Stop() double-close panic
  close(w.stopChan) is now wrapped in sync.Once, so concurrent Stop
  calls (Manager.Stop racing stopWorkerInternal) are safe.

New tests in internal/forward/concurrency_test.go exercise each fix
under -race: 16 concurrent worker Stops, repeated sequential Stops,
empty-Reload preserves infra pointers, and concurrent currentConfig
read/write.
2026-05-06 10:45:10 +01:00
lukaszraczylo 614b6e6396 test: relax TestDiscovery_GetCurrentContext for empty kubeconfig
CI runners have no kubeconfig, so clientcmd's loader returns an empty
config (no error) and CurrentContext == "". The previous assertion
'NotEmpty(context)' on the success branch was incorrect — an empty
current-context is valid for an empty kubeconfig.

Mirrors the looser pattern in TestDiscovery_ListContexts.
2026-05-06 10:34:46 +01:00
lukaszraczylo 8e5eaab0af fixup! Update go.mod and go.sum (#48) 2026-02-20 15:39:27 +00:00
lukaszraczylo 0aaf2dc78c Update go.mod and go.sum (#48) v0.2.90 2026-02-18 03:55:50 +00:00
lukaszraczylo d945e4915d Update go.mod and go.sum (#47) v0.2.89 2026-02-17 03:54:37 +00:00
lukaszraczylo e50f73ec92 chore: add golangci-lint v2 config and fix linter warnings (#46)
- [x] Add golangci-lint v2 configuration with formatters section
- [x] Reorganize linters-settings under linters section
- [x] Replace if-else chains with switch statements for clarity
- [x] Wrap all ignored error returns with `_ = ` pattern
- [x] Add OSC 8 hyperlink helper function for clickable ports
- [x] Add blank line in table styling function
- [x] Remove unnecessary type assertion in test
v0.2.88
2026-02-13 18:46:27 +00:00
lukaszraczylo d3c5e5eb36 Update go.mod and go.sum (#45) v0.2.87 2026-02-13 03:57:21 +00:00
lukaszraczylo 34e6fc60da Update go.mod and go.sum (#44) v0.2.86 2026-02-11 04:03:09 +00:00
lukaszraczylo fde40f253c Update go.mod and go.sum (#42) v0.2.85 2026-02-10 04:04:32 +00:00
lukaszraczylo 9497b6d705 Update go.mod and go.sum (#41) v0.2.84 2026-02-09 04:00:55 +00:00
lukaszraczylo e6bd540306 Update go.mod and go.sum (#40) v0.2.83 2026-02-07 03:52:04 +00:00
lukaszraczylo 86d91e0071 Update go.mod and go.sum (#39) v0.2.82 2026-02-05 03:53:12 +00:00
lukaszraczylo 4eff5ff5eb Update go.mod and go.sum (#38) v0.2.81 2026-02-04 03:53:00 +00:00
lukaszraczylo b9b7d5ec87 Update go.mod and go.sum (#37) v0.2.80 2026-02-02 03:57:42 +00:00
lukaszraczylo bc3b61e778 Update go.mod and go.sum (#36) v0.2.79 2026-01-28 03:40:33 +00:00
lukaszraczylo 676fd3df39 Update go.mod and go.sum (#35) v0.2.78 2026-01-26 03:45:09 +00:00
lukaszraczylo 00380ca307 Update go.mod and go.sum (#34) v0.2.77 2026-01-25 03:43:03 +00:00
lukaszraczylo e4930071fc Update go.mod and go.sum (#33) v0.2.76 2026-01-23 03:40:40 +00:00
lukaszraczylo c43aca3805 Update go.mod and go.sum (#32) v0.2.75 2026-01-19 03:42:14 +00:00
lukaszraczylo 4add04e3be Update go.mod and go.sum (#31) v0.2.74 2026-01-16 03:39:04 +00:00
lukaszraczylo 96ae1d45e0 style: Extract UI constants and refactor main view rendering (#30)
- [x] Add golangci-lint configuration with gocritic ifElseChain disabled
- [x] Rename error variables to avoid shadowing (createErr, watcherErr, watchErr, etc.)
- [x] Replace `interface{}` with `any` type alias throughout codebase
- [x] Add package-level documentation comments to all internal packages
- [x] Reorder struct fields alphabetically for consistency
- [x] Extract UI constants (terminal dimensions, column widths, colors) to constants.go
- [x] Refactor BubbleTeaUI main view rendering into smaller helper functions
- [x] Simplify nested conditionals and improve code clarity
- [x] Add `isForwardDisabled()` helper method to BubbleTeaUI
- [x] Update file permissions from 0644 to 0600 in config tests
- [x] Add `#nosec` comments and error suppression where appropriate
- [x] Improve test table struct field ordering for readability
- [x] Fix resource parsing in AddForward using strings.SplitN
- [x] Add comprehensive tests for new UI helper functions and constants
v0.2.73
2026-01-13 09:37:45 +00:00
lukaszraczylo 3d71f64901 Update go.mod and go.sum (#29) v0.2.72 2026-01-13 03:39:00 +00:00
lukaszraczylo 38b7a06c53 Update go.mod and go.sum (#28) v0.2.71 2026-01-12 03:41:55 +00:00
lukaszraczylo 7ad96e3f72 Update go.mod and go.sum (#27) v0.2.70 2026-01-10 03:37:23 +00:00
lukaszraczylo ac7c855de5 Update go.mod and go.sum (#26) v0.2.69 2026-01-09 03:39:39 +00:00
lukaszraczylo 4074a7186c Update go.mod and go.sum (#25) v0.2.68 2026-01-07 03:39:19 +00:00
lukaszraczylo a5cc95a26e Update go.mod and go.sum (#24) v0.2.67 2025-12-23 03:39:14 +00:00
lukaszraczylo 0f977683cd Update go.mod and go.sum (#23) v0.2.66 2025-12-21 03:39:29 +00:00
lukaszraczylo dcebdf718a Update go.mod and go.sum (#22) v0.2.65 2025-12-20 03:32:25 +00:00
lukaszraczylo 5967f26c21 Update go.mod and go.sum (#21) v0.2.64 2025-12-19 03:37:51 +00:00
lukaszraczylo 285ced6755 fixup! Update go.mod and go.sum (#20) v0.2.63 2025-12-18 09:38:02 +00:00
lukaszraczylo 9fe076acb2 Update go.mod and go.sum (#20) v0.2.62 2025-12-18 03:37:26 +00:00
lukaszraczylo 92746efcf5 Update go.mod and go.sum (#19) v0.2.61 2025-12-15 03:40:40 +00:00
lukaszraczylo 391bce366d fixup! fixup! Add artifacts signing. v0.2.60 2025-12-15 00:16:16 +00:00
lukaszraczylo 9fd8f9b03b fixup! Add artifacts signing. v0.2.59 2025-12-14 23:56:42 +00:00
lukaszraczylo 7032bb5bee Add artifacts signing. v0.2.58 2025-12-14 23:29:27 +00:00
lukaszraczylo 6cb4f91ece Cleanup and refactor. v0.2.57 2025-12-14 18:17:20 +00:00
lukaszraczylo 5d600043f0 Update go.mod and go.sum (#18) v0.2.56 2025-12-13 03:32:36 +00:00
lukaszraczylo 9bb6fbc48d Update go.mod and go.sum (#17) v0.2.55 2025-12-12 03:38:34 +00:00
lukaszraczylo f4334ebdc9 Update go.mod and go.sum (#16) v0.2.54 2025-12-11 03:38:45 +00:00
lukaszraczylo 50f94bda87 Update go.mod and go.sum (#15) v0.2.53 2025-12-09 01:13:24 +00:00
lukaszraczylo d9888f1a56 Cleanup (#14)
* Codebase cleanup
v0.2.52
2025-12-09 01:06:38 +00:00
lukaszraczylo 7dec532e18 Use shared PR workflow 2025-12-08 01:32:30 +00:00
lukaszraczylo aa7695b3be Trigger autoupdate. 2025-12-08 01:10:11 +00:00
lukaszraczylo 1bacd31f27 fixup! Add verified param to the releaser. 2025-12-07 16:40:37 +00:00
lukaszraczylo bfecbdf056 Add verified param to the releaser. v0.2.48 2025-12-07 14:40:12 +00:00
lukaszraczylo 754108474c fixup! fixup! fixup! Update gorelease config and docs - moving to cask due to depreciation v0.2.47 2025-12-07 14:36:45 +00:00