Skip to content

fix(security): command-mode bypass-reason, run timeout, env-file paths - #45

Merged
jamiesun merged 7 commits into
mainfrom
review/docs-and-guardrails-v2
Aug 15, 2026
Merged

fix(security): command-mode bypass-reason, run timeout, env-file paths#45
jamiesun merged 7 commits into
mainfrom
review/docs-and-guardrails-v2

Conversation

@jamiesun

Copy link
Copy Markdown
Contributor

Summary

Follow-up from a v0.5.0 / 2df64c3 review. This PR is on review/docs-and-guardrails-v2 (cut from main) so the tree stays compile-clean.

  • SECURITY.md: supported versions are now 0.5.x + N-1 0.4.x. Vulnerability reports go to GitHub Security Advisories / private reporting (no invented email).
  • Command-mode safety bypass: --force / --no-safety-check now require a non-empty --bypass-reason, matching sshx run. The flag is lifted from argv in Run() so it is not treated as the start of the remote command.
  • sshx run command timeout: defaults to 60s when --timeout / SSH_TIMEOUT are unset. SSH dial timeout is unchanged (30s).
  • --db-cred-from=env-file:: requires an absolute remote path and rejects .. segments. docker: sources are unchanged.

Test plan

  • go test ./internal/app/ ./internal/sqlsafe/
  • go test -short ./...
  • Confirm sshx -h=host --json --force --no-audit "sudo reboot" returns error_kind=config mentioning --bypass-reason
  • Confirm sshx -h=host --force --bypass-reason="maintenance reboot" --dry-run --json "sudo reboot" is not a config error
  • Confirm sshx run --target=prod-web --dry-run --json -- uptime shows a 60s command timeout
  • Confirm env-file:/opt/app/.env still parses and env-file:../.env / env-file:/tmp/../.env are rejected

Follow-ups

  • CI gosec pin/gate: .github/workflows/ci.yml could not be updated (GitHub token lacks the workflow scope; Contents/Git Data APIs return 404). Intended change: pin securego/gosec@v2.28.0, keep SARIF ./... observational (-no-fail), and add a failing gate on internal/sshclient, internal/sqlsafe, internal/app.
  • Docs still drifted on this branch (payload size): AGENT.md still mentions CodeQL Analyze and godotenv; README still says Go 1.21+ (should match go.mod 1.25.13); CHANGELOG [Unreleased] still points at v0.4.1...HEAD and needs a v0.5.0 compare link. docs/security-guidelines.md should show --force --bypass-reason=.
  • Full PostgreSQL E2E
  • Plugin trust UX overhaul
  • Windows CI matrix

Note

Please ignore / delete branch review/docs-and-guardrails if it exists. An earlier attempt accidentally truncated internal/sshclient/client.go. This v2 branch does not touch that file.

@jamiesun
jamiesun merged commit 9a73a2a into main Aug 15, 2026
8 checks passed
@jamiesun
jamiesun deleted the review/docs-and-guardrails-v2 branch August 15, 2026 16:24
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