Repository navigation
fix(security): move Data Machine private files out of public uploads - #4290
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Agent, user and network memory, data packets, email attachments and job artifacts used to sit at guessable paths under public uploads. They now resolve through one private root, DirectoryManager::get_private_base_directory(). The default is uploads/datamachine-files/private-<random key>/, protected by an index.php and a deny-all .htaccess. Setting the DATAMACHINE_PRIVATE_FILES_DIR constant moves it anywhere else. A one-time, idempotent migration moves existing files on single-site and multisite (each site's base plus the network base) and leaves nothing at the old paths. Pipeline job media and FileStorage::get_public_url() URLs are unchanged.
What changed
Verification
All gates passed on
db3edd14e8c9. Basemain: gated on380d7b495ff3, target now380d7b495ff3, re-verified: no.( if git diff --quiet --no-renames 380d7b495ff38a454fae9f385b6586ecc2901492 -- ':(literal)plugins/data-machine'; then :…: passed, 56050 ms; retained gate metadata.php plugins/data-machine/tests/agents-api-memory-store-smoke.php && php plugins/data-machine/tests/agent-memory-store-r…: passed, 201 ms; retained gate evidence.( if git diff --quiet --no-renames 380d7b495ff38a454fae9f385b6586ecc2901492 -- ':(literal)plugins/data-machine'; then :…: passed, 974 ms; retained gate evidence.Gate 2 output
Gate 3 output
[output truncated; retained tail] "plugins/data-machine/tests/fixtures/action-scheduler-multisite-standalone.php", "plugins/data-machine/tests/image-template-file-urls-smoke.php", "plugins/data-machine/tests/job-artifact-content-resolver-smoke.php", "plugins/data-machine/tests/job-artifact-hashable-smoke.php", "plugins/data-machine/tests/job-artifact-retention-smoke.php", "plugins/data-machine/tests/principal-memory-scope-smoke.php", "plugins/data-machine/tests/private-files-migration-smoke.php", "plugins/data-machine/tests/private-files-stubs.php", "plugins/data-machine/tests/retention-packet-store-smoke.php", "plugins/data-machine/uninstall.php" ], "commands": [], "skipped": [ { "reason": "PR branch filters require GitHub event context", "source": { "job": null, "step": null, "workflow": ".github/workflows/data-machine-business.yml" } }, { "reason": "PR branch filters require GitHub event context", "source": { "job": null, "step": null, "workflow": ".github/workflows/data-machine-events.yml" } }, { "reason": "PR branch filters require GitHub event context", "source": { "job": null, "step": null, "workflow": ".github/workflows/data-machine-socials.yml" } }, { "reason": "PR branch filters require GitHub event context", "source": { "job": null, "step": null, "workflow": ".github/workflows/data-machine-test.yml" } }, { "reason": "PR branch filters require GitHub event context", "source": { "job": null, "step": null, "workflow": ".github/workflows/data-machine.yml" } } ] }, "results": [] } }Cook run
agent-task-4f8bf867-6509-41bb-a397-74918860fa0dagent-task-4f8bf867-6509-41bb-a397-74918860fa0d-attempt-1-3cb62acebb05f62f4e69c83aee35e1b6f2d560e1b5c6b16fbb05f62f4e69c83aee35e1b6f2d560e1b5c6b16fbb05f62f4e69c83aee35e1b6f2d560e1b5c6b16fDelivery
Evidence
homeboy review testandhomeboy review lintstopped locally because Homeboy's 'wordpress' extension manifest could not be read. The PHPUnit suite, including the new PrivateFilesRootTest, was therefore not run under PHPUnit here; the controller gates still need to run it. No evidence files were committed.wp datamachine memory readreturned both the old and the new sections. -memory pathsshowed every layer under private-<key>. - A new data packet was written under the private root. - An old ref that still held the pre-move absolute file_path loaded correctly.wp datamachine memory write, a data packet, an email attachment, a job artifact, NETWORK.md and public pipeline media. After switching to this branch, one request moved everything into uploads/datamachine-files/private-<40-hex>/. No agents, users, shared, network, data-packets, email-attachments or datamachine-artifacts folders were left at the old paths.AI disclosure
Tool: Homeboy Cook. Agent: Homeboy (roadie). Model: roadie · route cook-heavy · served claude-opus-5-5. Cook time: 27m11s.
The AI implemented the private-root resolver, the migration, the call-site changes, the docs and the tests. It also ran the end-to-end verification on disposable single-site and multisite WordPress installs, and linted the changed files with PHPCS and PHPStan, under the direction of the Cook requester. Homeboy reports controller verification separately from this account of the AI's work. A human reviews before merge.
Refs #4289