Skip to content

Fix backup/restore test listener exposure - #12

Open
DeveloperDurp wants to merge 1 commit into
mainfrom
codex/propose-fix-for-admin-credential-exposure
Open

Fix backup/restore test listener exposure#12
DeveloperDurp wants to merge 1 commit into
mainfrom
codex/propose-fix-for-admin-credential-exposure

Conversation

@DeveloperDurp

Copy link
Copy Markdown
Owner

Motivation

  • The backup/restore acceptance script previously created a predictable admin account and started the server bound to :8080, which exposes a privileged test user on all interfaces during the run.
  • A local/CI environment often lacks the runner sandbox, so an exposed admin account can enable remote actors to trigger deployments that execute Bash as the server user.
  • The intent is to make the test safe by restricting the server to loopback, using a per-run random admin password, and adding basic startup checks so the test fails if the spawned server exits before binding.

Description

  • Added loadAddr() in cmd/server/main.go and switched the server to use DURPDEPLOY_ADDR when present, preserving :8080 as the default when the env var is not set, and logging the resolved address via slog.
  • Modified scripts/test-backup-restore.sh to pick a random free loopback port (127.0.0.1:<port>) and export it as SERVER_ADDR/BASE for the test instead of using :8080/localhost:8080.
  • Replaced the fixed test admin password with a generated per-run secret (openssl rand -base64 32) and pass DURPDEPLOY_ADDR into the test server invocation so it binds only to the loopback address chosen by the test.
  • Hardened the script's server-wait loop to verify the spawned server process is still running while awaiting the bind and to fail early with server logs if the server exits before binding; applied the same check for the restart after restore.

Testing

  • Ran shell syntax check bash -n scripts/test-backup-restore.sh and it succeeded. (pass)
  • Verified formatting with gofmt -l cmd/server/main.go and git diff --check, both returned clean results. (pass)
  • Attempted go test -v -count=1 ./... but it could not complete because generated *_templ.go files and static/swagger-ui/ are absent and templ installation is blocked by network/proxy restrictions in this environment; templ generate could not be run here. (blocked)
  • make swagger-ui-copy produced the Swagger UI assets but templ-generate failed locally due to the missing templ binary; subsequent go test remains un-run for the reasons above. (partial/blocked)

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant