René's URL Explorer Experiment
Title: Keep the source database URL off the command line of psql and pg_dump by shipmill-romamo[bot] · Pull Request #370 · cloudfall-dev/cloudfall · GitHub
Open Graph Title: Keep the source database URL off the command line of psql and pg_dump by shipmill-romamo[bot] · Pull Request #370 · cloudfall-dev/cloudfall
X Title: Keep the source database URL off the command line of psql and pg_dump by shipmill-romamo[bot] · Pull Request #370 · cloudfall-dev/cloudfall
Description: Plan
Serves: quality bar
Files: engine/tests/test_data_migration_source_url.py, engine/tests/test_data_migration_role.py, engine/ansible/roles/cloudfall_data_migration/filter_plugins/pg_service.py, engine/ansible/roles/cloudfall_data_migration/tasks/main.yml, engine/ansible/roles/cloudfall_data_migration/defaults/main.yml, engine/ansible/roles/cloudfall_data_migration/meta/argument_specs.yml, docs/neon-migration-guide.md, changelog.d/355-pg-url-off-argv.md
Order: the failing tests first (a static read of every task of the role for a command line that could carry the URL, unit tests of the URL-to-service-file conversion, and a local run of the staging and a source query with a stand-in psql), then the filter plugin, the role's staging, environment and cleanup, and the docs
Proof: engine/tests/test_data_migration_source_url.py and the updated engine/tests/test_data_migration_role.py
Summary
The data copy passed the source URL to psql and pg_dump as --dbname "$(cat )" in four tasks, so the password sat in their argv, readable in /proc//cmdline by every local user for as long as the copy ran.
The role turns the URL, on the controller, into a 0600 libpq service file on the target host (/root/.cloudfall-data-source.pgservice, owned by root, the user the clients run as) and names it to the clients through PGSERVICEFILE and PGSERVICE in the environment of each of the four source tasks only; the target-side tasks keep their peer-authenticated --dbname and don't see the service
The URL itself is no longer staged on the host: only the service file is, and the block's always removes it, on failure too, as it removed the URL file before
A role filter plugin (cloudfall_pg_service) parses the URL as libpq parses a connection URI: percent-encoded user, password, host and database, comma-separated host lists, bracketed IPv6 hosts, and query parameters such as sslmode (with ssl=true read as sslmode=require, as libpq does). It refuses what a service file can't hold or libpq wouldn't read (another scheme, a #, a bad percent-encoding, a line break, trailing whitespace, a parameter set twice, a nested service) before anything is staged, and no message quotes any part of the URL
Every task that reads the URL file is no_log; the refusal is an assert on the problem string alone, so the reason still shows
The four source tasks move from shell to command with argv (ansible-lint asks for it once no shell expansion is left), so schema and extension names are now single arguments with no shell quoting
docs/neon-migration-guide.md says the connection is staged as a service file and which password characters to percent-encode
Test notes
New: engine/tests/test_data_migration_source_url.py
Unit tests of the conversion: password with :, @, / and %, sslmode, IPv6, host lists, an empty password, a socket directory; and eleven refused URLs whose messages hold no part of the URL
A static test over every task of the role: no shell/command task references the URL file, a lookup, $(, the service file or a password; the four source tasks carry no --dbname and do carry the service environment; every leaf task that reads the URL file is no_log
A real ansible-playbook run on localhost of the check, the staging, the row-count query (with a stand-in psql recording its argv, environment and the file's mode) and the cleanup: the password is in the 0600 file and nowhere in argv or in -vvv output, and the file is gone afterwards; a bad URL stops before any file is written, with its reason and without the URL
These fail on main: the source tasks there are shell with $(cat ...), and the staging tasks don't exist
Updated: engine/tests/test_data_migration_role.py reads the dump, preflight and row-count commands as argv lists instead of shell strings; the expectations are otherwise unchanged
Ran: uv run ruff check ., uv run mypy, uv run ansible-lint engine/ansible (with ANSIBLE_CONFIG=engine/ansible/ansible.cfg, as CI does), and uv run pytest on engine/tests/test_data_migration_source_url.py, engine/tests/test_data_migration_role.py, engine/tests/test_postgresql_owner_role.py, engine/tests/test_component_hosts.py, sdk/tests/test_data_migration.py, sdk/tests/test_data_copy_preflight.py (118 passed)
Not run: a real copy against PostgreSQL; the Converge workflow does not run a data copy, so the service file has not met a real libpq in CI. The full suite is left to CI
Fixes #355
🤖 Generated with Claude Code
Open Graph Description: Plan
Serves: quality bar
Files: engine/tests/test_data_migration_source_url.py, engine/tests/test_data_migration_role.py, engine/ansible/roles/cloudfall_data_migration/filter_plugins/pg_service.py...
X Description: Plan
Serves: quality bar
Files: engine/tests/test_data_migration_source_url.py, engine/tests/test_data_migration_role.py, engine/ansible/roles/cloudfall_data_migration/filter_plugins/pg_service.py...
Opengraph URL: https://github.com/cloudfall-dev/cloudfall/pull/370
X: @github
direct link
Domain: github.com
IPv4 address: 140.82.114.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c17a7949-3a77-e9e8-303d-30c06566c642 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B9DC:1F7B:E7F539:134C56A:6B055952 |
| html-safe-nonce | 6b13159b0928a1c04f8ba0078fa19febf51bd37c16510f2d1e8e113a4c254e75 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOURDOjFGN0I6RTdGNTM5OjEzNEM1NkE6NkIwNTU5NTIiLCJ2aXNpdG9yX2lkIjoiMTE4NzM1Mzk0NTY4MTc3OTAyNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7a32d0f481bea0595c6634b15851a7f0050ae3a3eed3bebebb73a710003ed55b |
| hovercard-subject-tag | pull_request:5324783933 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | ///pull_requests/show/files |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/cloudfall-dev/cloudfall/pull/370/files |
| twitter:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/5600783?s=400&v=4 |
| og:image:alt | Plan
Serves: quality bar
Files: engine/tests/test_data_migration_source_url.py, engine/tests/test_data_migration_role.py, engine/ansible/roles/cloudfall_data_migration/filter_plugins/pg_service.py... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | a79a02b7e7546ea306864e922ed2103ef4c04fac63168e11c2b2d4d816793080 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/cloudfall-dev/cloudfall git https://github.com/cloudfall-dev/cloudfall.git |
| octolytics-dimension-user_id | 339512759 |
| octolytics-dimension-user_login | cloudfall-dev |
| octolytics-dimension-repository_id | 1360999777 |
| octolytics-dimension-repository_nwo | cloudfall-dev/cloudfall |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1360999777 |
| octolytics-dimension-repository_network_root_nwo | cloudfall-dev/cloudfall |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 10dff83edfd4f3617a7792a152d44991587b434c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Skip to content | https://github.com/cloudfall-dev/cloudfall/pull/370/files#start-of-content |
| https://github.com/ |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcloudfall-dev%2Fcloudfall%2Fpull%2F370%2Ffiles |
| GitHubRepository hosting, code review, and collaboration | https://github.com/platform |
| CopilotAI coding agent for tasks, projects, and automated work | https://github.com/features/copilot |
| ActionsCI/CD and automation | https://github.com/features/actions |
| Code QualityQuality analysis, fixes, and enforcement | https://github.com/features/code-quality |
| CodespacesCloud development environments | https://github.com/features/codespaces |
| Code SecurityVulnerability detection and remediation | https://github.com/security/advanced-security/code-security |
| Secret ProtectionSecret scanning and leak prevention | https://github.com/security/advanced-security/secret-protection |
| All Features | https://github.com/features |
| Documentation | https://docs.github.com/en |
| Training | https://learn.github.com/skills |
| Certifications | https://learn.github.com/credentials |
| Build with Copilot | https://github.com/features/ai |
| Customize Copilot | https://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview |
| Integrations | https://github.com/marketplace |
| Trending repos | https://github.com/trending |
| GitHub Sponsors | https://github.com/open-source/sponsors |
| Developer articles | https://github.com/resources/articles |
| ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place. | https://github.blog/changelog/ |
| Enterprises | https://github.com/enterprise |
| Team | https://github.com/team |
| Startups | https://github.com/enterprise/startups |
| Nonprofits | https://github.com/solutions/industry/nonprofits |
| Healthcare | https://github.com/solutions/industry/healthcare |
| Financial services | https://github.com/solutions/industry/financial-services |
| Manufacturing | https://github.com/solutions/industry/manufacturing |
| Government | https://github.com/solutions/industry/government |
| See all industries | https://github.com/solutions/industry |
| Why GitHub | https://github.com/why-github |
| Customer Stories | https://github.com/customer-stories |
| Business insights | https://github.com/solutions/executive-insights |
| Trust Center | https://github.com/trust-center |
| GitHub Advanced SecurityEnterprise-grade code security | https://github.com/security/advanced-security |
| Copilot for businessEnterprise-grade AI features | https://github.com/features/copilot/copilot-business |
| Premium SupportEnterprise-grade 24/7 support | https://github.com/enterprise/premium-support |
| Documentation | https://docs.github.com/en |
| Resource center | https://github.com/resources |
| Blog | https://github.blog/ |
| Events & webinars | https://github.com/resources/events |
| Community Forum | https://github.com/orgs/community/discussions |
| Customer Stories | https://github.com/customer-stories |
| Integrations | https://github.com/marketplace |
| Customer support | https://help.github.com/ |
| Training | https://learn.github.com/skills |
| GitHub Status | https://www.githubstatus.com/ |
| About | https://github.com/about |
| Partners | https://github.com/partners |
| Changelog | https://github.blog/changelog/ |
| GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub. | https://githubuniverse.com/ |
| Pricing | https://github.com/pricing |
| Sign in | https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fcloudfall-dev%2Fcloudfall%2Fpull%2F370%2Ffiles |
| Sign up | https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=cloudfall-dev%2Fcloudfall |
| Reload | https://github.com/cloudfall-dev/cloudfall/pull/370/files |
| Reload | https://github.com/cloudfall-dev/cloudfall/pull/370/files |
| Reload | https://github.com/cloudfall-dev/cloudfall/pull/370/files |
| cloudfall-dev | https://github.com/cloudfall-dev |
| cloudfall | https://github.com/cloudfall-dev/cloudfall |
| Code | https://github.com/cloudfall-dev/cloudfall |
| Issues78 (78) | https://github.com/cloudfall-dev/cloudfall/issues |
| Pull requests10 (10) | https://github.com/cloudfall-dev/cloudfall/pulls |
| Discussions | https://github.com/cloudfall-dev/cloudfall/discussions |
| Actions | https://github.com/cloudfall-dev/cloudfall/actions |
| Security and quality | https://github.com/cloudfall-dev/cloudfall/security |
| Insights | https://github.com/cloudfall-dev/cloudfall/insights |
| Sign up for GitHub
| https://github.com/signup?return_to=%2Fcloudfall-dev%2Fcloudfall%2Fissues%2Fnew%2Fchoose |
| terms of service | https://docs.github.com/terms |
| privacy statement | https://docs.github.com/privacy |
| Sign in | https://github.com/login?return_to=%2Fcloudfall-dev%2Fcloudfall%2Fissues%2Fnew%2Fchoose |
| shipmill-romamo | https://github.com/apps/shipmill-romamo |
| main | https://github.com/cloudfall-dev/cloudfall/tree/main |
| fix/355-pg-url-off-argv | https://github.com/cloudfall-dev/cloudfall/tree/fix/355-pg-url-off-argv |
|
Conversation
1
| https://github.com/cloudfall-dev/cloudfall/pull/370 |
|
Commits
3
| https://github.com/cloudfall-dev/cloudfall/pull/370/commits |
|
Checks
2
| https://github.com/cloudfall-dev/cloudfall/pull/370/checks |
|
Files changed
8
| https://github.com/cloudfall-dev/cloudfall/pull/370/files |
|
Keep the source database URL off the command line of psql and pg_dump
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#top |
|
Show all changes
3 commits
| https://github.com/cloudfall-dev/cloudfall/pull/370/files |
|
e8fe7e7
Keep the source database URL off the command line of psql and pg_dump
shipmill-romamo[bot] Nov 15, 2026
| https://github.com/cloudfall-dev/cloudfall/pull/370/commits/e8fe7e709f8c6be3d1427241a7ebe27301ce3e13 |
|
19fb2c0
Read the source URL's user info as libpq does
shipmill-romamo[bot] Nov 15, 2026
| https://github.com/cloudfall-dev/cloudfall/pull/370/commits/19fb2c0b9e68f3af04e92ab597a3abf869c34790 |
|
7427f9f
Mark the newly refused source URLs as Breaking in the changelog
shipmill-romamo[bot] Nov 15, 2026
| https://github.com/cloudfall-dev/cloudfall/pull/370/commits/7427f9f58e87a1a121ab53c5e8b7b3de95cda0b9 |
|
Clear filters
| https://github.com/cloudfall-dev/cloudfall/pull/370/files |
| Please reload this page | https://github.com/cloudfall-dev/cloudfall/pull/370/files |
| Please reload this page | https://github.com/cloudfall-dev/cloudfall/pull/370/files |
|
355-pg-url-off-argv.md
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-8952d46bd421fa920bf127ef3a20fd717f33850805807ba48e826e9c0daaca8c |
|
neon-migration-guide.md
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-42b2d04a8e6b9be9ec5000fbd64deb2e729475a4a6df9d40f411847c4389e1b3 |
|
main.yml
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-c2cd1ecff4eb8bf0c0b514f61c851c888945f83ad7a9debc7ad8abf517b10e16 |
|
pg_service.py
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-b0a8d90c26c727232578e5d925ee1f95e0eb4ba078e6ccff213f510371f89c79 |
|
argument_specs.yml
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-eb76cf1a03882791eee1509326bd8eeb41cb030c058c195e6efe986cf0aa5881 |
|
main.yml
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-0ac67bf03bdde553c079ee1c53ed226e3666d32cb39a594b2330e46f0d270880 |
|
test_data_migration_role.py
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-56b1b2e85bd63c611408b5047d9febdd513402cd5c6cc42cafaa323ddce3a6a2 |
|
test_data_migration_source_url.py
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-a33d2aae2fdb63e7b5bc554bf3996ffb172434dbd33bb22382fe38594661b045 |
| changelog.d/355-pg-url-off-argv.md | https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-8952d46bd421fa920bf127ef3a20fd717f33850805807ba48e826e9c0daaca8c |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/7427f9f58e87a1a121ab53c5e8b7b3de95cda0b9/changelog.d/355-pg-url-off-argv.md |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/370/{{ revealButtonHref }} |
| docs/neon-migration-guide.md | https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-42b2d04a8e6b9be9ec5000fbd64deb2e729475a4a6df9d40f411847c4389e1b3 |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/7427f9f58e87a1a121ab53c5e8b7b3de95cda0b9/docs/neon-migration-guide.md |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/370/{{ revealButtonHref }} |
|
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-42b2d04a8e6b9be9ec5000fbd64deb2e729475a4a6df9d40f411847c4389e1b3 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-42b2d04a8e6b9be9ec5000fbd64deb2e729475a4a6df9d40f411847c4389e1b3 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-42b2d04a8e6b9be9ec5000fbd64deb2e729475a4a6df9d40f411847c4389e1b3 |
| engine/ansible/roles/cloudfall_data_migration/defaults/main.yml | https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-c2cd1ecff4eb8bf0c0b514f61c851c888945f83ad7a9debc7ad8abf517b10e16 |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/7427f9f58e87a1a121ab53c5e8b7b3de95cda0b9/engine/ansible/roles/cloudfall_data_migration/defaults/main.yml |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/370/{{ revealButtonHref }} |
|
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-c2cd1ecff4eb8bf0c0b514f61c851c888945f83ad7a9debc7ad8abf517b10e16 |
| engine/ansible/roles/cloudfall_data_migration/filter_plugins/pg_service.py | https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-b0a8d90c26c727232578e5d925ee1f95e0eb4ba078e6ccff213f510371f89c79 |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/7427f9f58e87a1a121ab53c5e8b7b3de95cda0b9/engine/ansible/roles/cloudfall_data_migration/filter_plugins/pg_service.py |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/370/{{ revealButtonHref }} |
| engine/ansible/roles/cloudfall_data_migration/meta/argument_specs.yml | https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-eb76cf1a03882791eee1509326bd8eeb41cb030c058c195e6efe986cf0aa5881 |
|
View file
| https://github.com/cloudfall-dev/cloudfall/blob/7427f9f58e87a1a121ab53c5e8b7b3de95cda0b9/engine/ansible/roles/cloudfall_data_migration/meta/argument_specs.yml |
|
Open in desktop
| https://desktop.github.com |
| https://github.co/hiddenchars |
| https://github.com/cloudfall-dev/cloudfall/pull/370/{{ revealButtonHref }} |
|
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-eb76cf1a03882791eee1509326bd8eeb41cb030c058c195e6efe986cf0aa5881 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-eb76cf1a03882791eee1509326bd8eeb41cb030c058c195e6efe986cf0aa5881 |
|
| https://github.com/cloudfall-dev/cloudfall/pull/370/files#diff-eb76cf1a03882791eee1509326bd8eeb41cb030c058c195e6efe986cf0aa5881 |
| Please reload this page | https://github.com/cloudfall-dev/cloudfall/pull/370/files |
| Please reload this page | https://github.com/cloudfall-dev/cloudfall/pull/370/files |
|
| https://github.com |
| Terms | https://docs.github.com/site-policy/github-terms/github-terms-of-service |
| Privacy | https://docs.github.com/site-policy/privacy-policies/github-privacy-statement |
| Security | https://github.com/security |
| Status | https://www.githubstatus.com/ |
| Community | https://github.community/ |
| Docs | https://docs.github.com/ |
| Contact | https://support.github.com?tags=dotcom-footer |
Response headers:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width
URLs of crawlers that visited me.