Repository navigation
Description
Problem Statement
Content Drive's bulk folder duplicate (#37062) copies everything inside the selected folder, including subfolders and files the user who runs it has no permission to read. The user is never told, and the restricted content is duplicated into a new location.
The only permission checks are on the top folder: READ on the folder being duplicated, and "can add children" on its parent (FolderAPIImpl.copy, lines 374–379). After that, nothing checks the user:
- The shipped recursive copy (
FolderFactoryImpl.copy) walks every subfolder, file, page and link with no user attached. - The second pass added by feat(content-drive): bulk folder duplicate backend (#37062) #37760 (
FolderDuplicator.copyWhatTheWalkLeftBehind, lines 171–184) copies generic content and archived items, and every subfolder, as the system user.
What is not broken: the copies keep the original's permissions (copyPermissions(source, newFolder) in FolderFactoryImpl). In our test, the user still could not see or open the copied restricted folder or file, so we saw no read leak.
Why it is a problem:
- Someone with no access to a restricted folder or file can create new copies of it, in a new place, without the owner knowing.
- A restricted folder can be multiplied by anyone who can see its parent, with storage and index growth to match.
- The copy is made with permissions inherited from the original. If a restriction relies on inheritance from a parent rather than on the item's own permissions, the copy could end up readable where the original is not. That variant was not tested.
- The result reports a plain success for the top folder, with nothing saying restricted content was included.
qa-deplicate-hidden-content.mov
Steps to Reproduce
Tested on the usual local stack, site demo.dotcms.com.
- As admin, create:
main_folder/ main-file.txt Folder_visible_to_all/ visible-1.txt, visible-2.txt Folder_no_visible_to_user_x/ secret-1.txt, secret-2.txt - Create user X: a back-end user with Content Drive access, READ on the site, and "can add children" at the site root.
- Give
Folder_no_visible_to_user_xits own permissions without READ for X (and without READ for CMS Anonymous). - Give the file
visible-2.txtits own permissions without READ for X (and without READ for CMS Anonymous). - As X, confirm:
main_foldershows onlyFolder_visible_to_allandmain-file.txt;Folder_visible_to_allshows onlyvisible-1.txt; openingFolder_no_visible_to_user_xby its path is refused. - As X, duplicate
main_folder(Content Drive → Duplicate, orPOST /api/v1/assets/folders/_bulkduplicatewith{"assetPaths":["//demo.dotcms.com/main_folder/"]}).
Result: the job ends SUCCESS (1 success, 0 failed). The copy holds everything:
| Path in the copy | Admin sees | X sees |
|---|---|---|
main_folder_copy/ |
Folder_no_visible_to_user_x, Folder_visible_to_all, main-file.txt |
Folder_visible_to_all, main-file.txt |
main_folder_copy/Folder_visible_to_all/ |
visible-1.txt, visible-2.txt |
visible-1.txt |
main_folder_copy/Folder_no_visible_to_user_x/ |
secret-1.txt, secret-2.txt |
Refused: "does not have permission to read folder…" |
The copied visible-2.txt has the same individual permissions as the original (CMS Anonymous and QA User X without READ), and X gets 404 opening it.
Acceptance Criteria
- Decide what duplicating a folder with unreadable content should do, and record the decision. Options:
- Skip what the user cannot read, and say in the result that items were left out (with a count, and no names that would reveal hidden content).
- Refuse the folder with a clear per-folder reason when it holds anything the user cannot read.
- Keep copying everything, as the shipped Site Browser copy does, and document it as intended.
- Whatever is decided applies to both passes: the shipped recursive copy and the system-user second pass in
FolderDuplicator. - Copied items never become readable by someone who could not read the original, including when the original's restriction comes from inheritance rather than its own permissions. A test covers both.
- The job result and the completion toast tell the user when restricted content was skipped or blocked a folder.
- Tests cover a restricted subfolder and a restricted file inside a readable folder.
dotCMS Version
Latest from main: dotcms/dotcms:trunk_d4a354c (2026-10-02), which includes #37760 and #37761.
Severity
Medium - Some functionality impacted
Links
- Found during QA of Content Drive: folder copy, async job endpoint and frontend wiring #37062 (backend feat(content-drive): bulk folder duplicate backend (#37062) #37760, frontend feat(content-drive): bulk folder duplicate frontend (#37062) #37761).
- Related: [DEFECT] /api/v1/jobs/folderBulkDuplicate skips the 50-folder limit that Content Drive's bulk duplicate enforces #37883 (bulk-duplicate limit bypass through the generic jobs endpoint).
- NA (no Freshdesk ticket)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNew
Activity
[-][DEFECT] Duplicating a folder copies subfolders and files the user cannot read[/-][+][DEFECT] Content Drive: Duplicating a folder copies subfolders and files the user cannot read[/+]zJaaal commentedon Oct 9, 2026
Update: this is not being folded into #37565 for now. Whether duplicating should skip, refuse or keep copying content the user cannot read is still to be discussed, so #37565 (the shared folder walk for delete and copy) stays scoped to paging and the transaction. If the outcome needs a code change in the copy walk, it can be added there then.
Written by Claude (Claude Code) on behalf of @zJaaal.