Skip to content

fix(deploy): never upload .env, .git or local databases with --remote-build - #20

Merged
fadymondy merged 1 commit into
mainfrom
fix/12-remote-build-excludes
Oct 14, 2026
Merged

fadymondy merged 1 commit into
mainfrom
fix/12-remote-build-excludes

Conversation

@fadymondy

Copy link
Copy Markdown
Contributor

Fixes #12

--remote-build ran rsync -az -e ssh <root>/ <remote> with no filters. It now passes (first match wins):

  1. --include=<p> for each deploy.include entry (new opt-in key in togo.yaml),
  2. --include=.env.example,
  3. excludes: .env, .env.*, .git/, *.db, *.db-wal, *.db-shm, *.db-journal, *.sqlite, *.sqlite3, *.sqlite-wal, *.sqlite-shm, node_modules/, .togo/,
  4. --filter=:- .gitignore.

Other changes:

  • The scp fallback is refused for remote builds (scp cannot exclude), with an error asking for rsync. The artifact upload of a normal deploy is unchanged.
  • --dry-run lists the exclusions.
  • README documents the behaviour and deploy.include.

Tests (all in cmd/deploy_remote_test.go): default filter set and rule order, deploy.include precedence, rsync argument construction, scp refusal, and an end-to-end test with the real rsync into a local directory asserting that .env, .env.local, nested .env, .git, togo.db(+wal), *.sqlite3, node_modules, .togo and a gitignored file are not delivered, while .env.example, the source and an included database are. The rsync test skips when rsync is missing (it was not available on my Windows host, so CI on ubuntu is the first run).

Release note to include: behaviour change. Users who deployed with --remote-build before this version should remove stale .env, .git and database files from the server deploy path and rotate any secrets that were in that .env.

🤖 Generated with Claude Code

…-build

--remote-build rsynced the whole project root with no exclusions. It now
excludes .env, .env.* (keeping .env.example), .git/, *.db/*.sqlite files with
their -wal/-shm companions, node_modules/ and .togo/, and honours .gitignore.
deploy.include opts paths back in. The scp fallback is refused for remote
builds because it cannot exclude files. --dry-run lists the exclusions.

Fixes #12

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fadymondy
fadymondy merged commit 7e48d50 into main Oct 14, 2026
3 checks passed
@fadymondy
fadymondy deleted the fix/12-remote-build-excludes branch October 14, 2026 15:15
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.

security: deploy --remote-build uploads .env, .git and local database files to the server

1 participant