Skip to content

[DEFECT] /api/v1/jobs/folderBulkDuplicate skips the 50-folder limit that Content Drive's bulk duplicate enforces #37883

Description

@rjvelazco

Problem Statement

Content Drive's bulk folder duplicate (#37062) limits one run to 50 folders (FOLDER_BULK_DUPLICATE_MAX_PATHS, default 50, advertised to clients as folderBulkDuplicate.maxPaths on /api/v1/appconfiguration). The UI and the dedicated endpoint POST /api/v1/assets/folders/_bulkduplicate both enforce it: more than 50 paths is refused with 400 OVER_MAX_PATHS.

_bulkduplicate validates the request and then puts it on the folderBulkDuplicate job queue (FolderBulkDuplicateHelper.java:110). The generic job-queue endpoint POST /api/v1/jobs/{queueName} can put a job on that same queue directly, and nothing on that path checks the limit:

  • The 50-path check lives only in FolderBulkDuplicateHelper.submit, which the generic endpoint never calls.
  • FolderBulkDuplicateProcessor does not implement Validator, so the job framework has nothing to check either. Only BulkRefreshContentletsProcessor and ImportContentletsProcessor implement it today.

Impact:

  • Any logged-in back-end user can queue an unbounded number of folder duplicates in one request. Anonymous and front-end users are still refused (401).
  • Each folder still goes through its own permission check, so this does not let anyone copy what they could not copy before. The risk is load: every folder copy is a long database transaction, and runs into the same parent wait for each other.
  • Normal authors don't hit it: the UI never sends more than 50. It takes a hand-written API call.

Probably affected too (not verified): the folder bulk delete (#37063) and bulk upload (#37166) queues follow the same pattern. Their limits are checked only in their own endpoints, and their processors (FolderBulkDeleteProcessor, BulkUploadProcessor) do not implement Validator.

Steps to Reproduce

  1. On a site, create 51 folders, e.g. //demo.dotcms.com/qa-bulkdup-max/f01/ … f51/.
  2. Confirm the advertised limit: GET /api/v1/appconfiguration → folderBulkDuplicate.maxPaths: 50.
  3. Submit all 51 through the dedicated endpoint:
    curl -u admin@dotcms.com:admin -X POST http://localhost:8080/api/v1/assets/folders/_bulkduplicate \
      -H 'Content-Type: application/json' -d '{"assetPaths": ["//demo.dotcms.com/qa-bulkdup-max/f01/", "…", "//demo.dotcms.com/qa-bulkdup-max/f51/"]}'
    Result: 400, errorCode: OVER_MAX_PATHS, "selection exceeds the maximum of 50 paths". Correct.
  4. Submit the same body to the generic job-queue endpoint:
    curl -u admin@dotcms.com:admin -X POST http://localhost:8080/api/v1/jobs/folderBulkDuplicate \
      -H 'Content-Type: application/json' -d '{"assetPaths": ["//demo.dotcms.com/qa-bulkdup-max/f01/", "…", "//demo.dotcms.com/qa-bulkdup-max/f51/"]}'
    Result: 200 with a jobId. The job ends SUCCESS with processed: 51, and all 51 folders are duplicated (f01_copy … f51_copy).

Side note: sending the same folder 3 times through the generic endpoint produced a single copy, but the job reported total: 3.

Acceptance Criteria

  • A folderBulkDuplicate job with more paths than FOLDER_BULK_DUPLICATE_MAX_PATHS is refused, however it is submitted: _bulkduplicate and POST /api/v1/jobs/folderBulkDuplicate give the same answer for the same body.
  • The rest of _bulkduplicate's submit-time validation also applies on every path (empty or malformed assetPaths).
  • Decide where the check lives, and record why:
    • Option A — the processor implements Validator with the same rules as the endpoint. Every way of creating the job is covered, following ImportContentletsProcessor and BulkRefreshContentletsProcessor.
    • Option B — the generic /api/v1/jobs/{queueName} endpoint refuses domain queues that have their own dedicated endpoint (folderBulkDuplicate, folder bulk delete, assetBulkUpload), so they can only be created through the endpoint that validates them.
  • The job's reported total matches the number of distinct folders it actually processes.
  • Check whether the folder bulk delete and bulk upload queues have the same bypass, and fix them the same way if they do (or open follow-up tickets).
  • A test proves the limit cannot be skipped through the generic endpoint.

dotCMS Version

Latest from main: dotcms/dotcms:trunk_d4a354c (2026-10-02), which includes #37760 and #37761.

Severity

Medium - Some functionality impacted

Links

Activity

  1. added theissue type on Oct 2, 2026
  2. self-assigned this
    on Oct 5, 2026
  3. ihoffmann-dot commented on Oct 8, 2026

    @ihoffmann-dot
    Member

    Handover: status of the fix for #37883

    I am moving to another project. This is where the work stands so the team can pick it up.

    Spec (PR 1): #37906, approved by @fabrizzio-dotCMS. Decisions: the generic endpoint refuses queues that have a dedicated endpoint (403, message names the endpoint); every queue declares its entry point; plugin queues stay generic.

    Implementation: branch issue-37883-job-queue-entry-points, off the spec branch. No PR is open yet for it. It has two commits on top of the spec: failing tests first (48d4ad83), then the fix (c6fc3ba4).

    Done

    • @JobQueueEntryPoint("<queue>") on the REST method of each dedicated endpoint (bulk duplicate, bulk delete, bulk upload, maintenance _fix and _clean). @Queue(genericEntry = true) on the queues fed by the generic endpoint (importContentlets, bulkRefreshContentlets, failSuccess, demo).
    • JobQueueEntryPoints builds the answer from the Jandex index; the route in the message is read from the annotated method's own @Path. A queue not in the index (plugin, or registered by name at runtime) is treated as generic and logs one warning. With no index it fails closed.
    • JobQueueHelper.assertGenericEntry is called by both createJob methods of JobQueueResource (JSON and /upload) before anything is created. openapi.yaml regenerated.
    • Tests: JobQueueEntryPointsTest (7), JobQueueEntryPointsCoverageTest (2, indexes the compiled classes and asserts each core queue declares exactly one entry point), JobQueueDomainQueuesBypassIntegrationTest (8, registered in Junit5Suite1). Regression run green: FolderBulkDuplicateResourceIT, FolderBulkDeleteResourceIT, BulkUploadResourceIT, MaintenanceResourceIntegrationTest, JobQueueHelperIntegrationTest.
    • Reproduced on main before the fix: the generic endpoint created jobs on all five queues for a back-end user with no admin role and no Maintenance portlet. The dedicated maintenance endpoints require admin and the portlet (MaintenanceResource.assertBackendUser), so this is wider than a missing portlet. Severity of this issue can be set from that.

    Deliberately not done (cut to keep this short)

    • The check in JobQueueManagerAPIImpl.start() that refuses to start the queue manager when a core queue does not have exactly one declaration. The build-time coverage test is the only guard today. The spec still says "fails startup"; that is not true at runtime yet. Either implement it, or change the spec wording to "the build fails".
    • Verifying what InitServlet.init() does when start() throws (InitServlet.java:233), which matters for the item above.
    • A short doc for new queues under docs/backend/, and the ADR proposed in the plan ("every job queue declares its entry point, and the framework enforces it"), to be written in dotCMS/platform-adrs.
    • /speckit-converge and opening PR 2. Its description should state the rollback assessment: REST contract change, 200 to 403 on five queues, expected rollback safe (no response shape added).

    Things to know

    • plan.md, research.md, tasks.md and quickstart.md are gitignored in this repo, so they are not on the branch. The decisions above are the substance; nothing else is needed to continue.
    • The warning-once for plugin queues is not covered by a test (the logger is static).
    • JobQueueHelperIntegrationTest failed on its first attempt in one combined run (relation "cms_role" does not exist) and passed on rerun: it does not initialize the test database itself, so it flakes when it runs first. Not related to this change.
    • To rerun the new integration test: ./mvnw verify -pl :dotcms-core,:dotcms-integration -Ddocker.skip -Dcoreit.test.skip=false -Dit.test=JobQueueDomainQueuesBypassIntegrationTest -Dtest=JobQueueEntryPointsTest -DfailIfNoTests=false -Dmaven.build.cache.enabled=false, and confirm Tests run: N in dotcms-integration/target/failsafe-reports.
  4. removed their assignment
    on Oct 8, 2026
  5. moved this from In Progress to In Review in dotCMS - Product Planningon Oct 9, 2026
  6. self-assigned this
    on Oct 15, 2026
  7. rjvelazco commented on Oct 15, 2026

    @rjvelazco
    MemberAuthor

    Passed QA

    • dotCMS Docker Image: [dotcms/dotcms:trunk_aa3d6a7]

    Video

    video.mov
  8. removed their assignment
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions