jenkinsci / jenkinsci/cloudbees-folder-plugin

[JENKINS-72024] Folder gets copied based on current folder instead of empty

Open
#714 0 comments 0 reactions 0 assignees View on GitHub
component:cloudbees-folder-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
59
Forks
117
PR merge metrics
No merged PRs in 30d

Description

Summary

The Copy-From input field available via "New Item" interprets an empty field as the root of the current folder it's located in, and attempts to copy everything from there.

Steps to Reproduce

1. Open the "New Item" dialog

2. Enter an arbitrary name

3. Select the type "Folder"

4. Attempt to enter a template (random folder) for the Copy-From input field.

5. Delete the entered text, leaving the field empty.

Expected Results

The newly created folder should be empty.

Actual Results

The (seemingly) empty field is interpreted as the root of the current folder it's located in, and attempts to copy everything from there. Only if the Copy-From is left untouched, it behaves as expected.

The copy is recursive and even includes any empty version of the folder the user wants to create (in this moment).

See also the attached before and after screenshot of the duplication.

In our case, this caused an unexpected recursive folder duplication that was big enough to bring down the whole Jenkins instance (due to the copy/rescan of multiple 100s branches / projects).

---
Originally reported by degelma, imported from: Folder gets copied based on current folder instead of empty


  • status: Open
  • priority: Major
  • component(s): cloudbees-folder-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 1
  • imported: 20251211-141027

Raw content of original issue

Summary
The Copy-From input field available via "New Item" interprets an empty field as the root of the current folder it's located in, and attempts to copy everything from there.

Steps to Reproduce
1. Open the "New Item" dialog
2. Enter an arbitrary name
3. Select the type "Folder"
4. Attempt to enter a template (random folder) for the Copy-From input field.
5. Delete the entered text, leaving the field empty.

Expected Results
The newly created folder should be empty.

Actual Results
The (seemingly) empty field is interpreted as the root of the current folder it's located in, and attempts to copy everything from there. Only if the Copy-From is left untouched, it behaves as expected.

The copy is recursive and even includes any empty version of the folder the user wants to create (in this moment).

See also the attached before and after screenshot of the duplication.

In our case, this caused an unexpected recursive folder duplication that was big enough to bring down the whole Jenkins instance (due to the copy/rescan of multiple 100s branches / projects).

environment

```
Jenkins: 2.401.3

OS: Linux - 4.15.0-213-generic

Java: 11.0.19 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)

---

ace-editor:1.1

active-directory:2.33

analysis-model-api:11.6.0

ant:497.v94e7d9fffa_b_9

antisamy-markup-formatter:162.v0e6ec0fcfcf6

apache-httpcomponents-client-4-api:4.5.14-208.v438351942757

artifact-manager-s3:822.vf129d4836c31

artifactory:3.18.9

authentication-tokens:1.53.v1c90fd9191a_b_

aws-credentials:218.v1b_e9466ec5da_

aws-global-configuration:128.ve2c5685a_09c3

aws-java-sdk:1.12.529-406.vdeff15e5817d

aws-java-sdk-cloudformation:1.12.529-406.vdeff15e5817d

aws-java-sdk-codebuild:1.12.529-406.vdeff15e5817d

aws-java-sdk-ec2:1.12.529-406.vdeff15e5817d

aws-java-sdk-ecr:1.12.529-406.vdeff15e5817d

aws-java-sdk-ecs:1.12.529-406.vdeff15e5817d

aws-java-sdk-efs:1.12.529-406.vdeff15e5817d

aws-java-sdk-elasticbeanstalk:1.12.529-406.vdeff15e5817d

aws-java-sdk-iam:1.12.529-406.vdeff15e5817d

aws-java-sdk-kinesis:1.12.529-406.vdeff15e5817d

aws-java-sdk-logs:1.12.529-406.vdeff15e5817d

aws-java-sdk-minimal:1.12.529-406.vdeff15e5817d

aws-java-sdk-secretsmanager:1.12.529-406.vdeff15e5817d

aws-java-sdk-sns:1.12.529-406.vdeff15e5817d

aws-java-sdk-sqs:1.12.529-406.vdeff15e5817d

aws-java-sdk-ssm:1.12.529-406.vdeff15e5817d

blueocean:1.27.6

blueocean-autofavorite:1.2.5

blueocean-bitbucket-pipeline:1.27.6

blueocean-commons:1.27.6

blueocean-config:1.27.6

blueocean-core-js:1.27.6

blueocean-dashboard:1.27.6

blueocean-display-url:2.4.2

blueocean-events:1.27.6

blueocean-git-pipeline:1.27.6

blueocean-github-pipeline:1.27.6

blueocean-i18n:1.27.6

blueocean-jira:1.27.6

blueocean-jwt:1.27.6

blueocean-personalization:1.27.6

blueocean-pipeline-api-impl:1.27.6

blueocean-pipeline-editor:1.27.6

blueocean-pipeline-scm-api:1.27.6

blueocean-rest:1.27.6

blueocean-rest-impl:1.27.6

blueocean-web:1.27.6

bootstrap4-api:4.6.0-6

bootstrap5-api:5.3.0-1

bouncycastle-api:2.29

branch-api:2.1122.v09cb_8ea_8a_724

build-monitor-plugin:1.14-744.v35fd6fa_a_26b_2

build-timeout:1.31

buildtriggerbadge:251.vdf6ef853f3f5

built-on-column:1.4

caffeine-api:3.1.8-133.v17b_1ff2e0599

checks-api:2.0.0

cloudbees-bitbucket-branch-source:832.v43175a_425ea_6

cloudbees-folder:6.848.ve3b_fd7839a_81

cobertura:1.17

code-coverage-api:4.7.0

command-launcher:107.v773860566e2e

commons-lang3-api:3.13.0-62.v7d18e55f51e2

commons-text-api:1.10.0-78.v3e7b_ea_d5a_fe1

conditional-buildstep:1.4.3

config-file-provider:953.v0432a_802e4d2

configuration-as-code:1700.v6f448841296e

copyartifact:722.v0662a_9b_e22a_c

credentials:1271.v54b_1c2c6388a_

credentials-binding:631.v861c06d062b_4

cron_column:1.7

cvs:2.19.1

data-tables-api:1.13.5-1

dependency-check-jenkins-plugin:5.4.2

dependency-track:4.3.1

display-url-api:2.3.9

docker-commons:439.va_3cb_0a_6a_fb_29

docker-workflow:572.v950f58993843

durable-task:523.va_a_22cf15d5e0

echarts-api:5.4.0-5

email-ext:2.100

emailext-template:1.5

envinject:2.908.v66a_774b_31d93

envinject-api:1.199.v3ce31253ed13

external-monitor-job:207.v98a_a_37a_85525

favorite:2.4.3

font-awesome-api:6.4.0-2

forensics-api:2.3.0

git:5.2.0

git-client:4.4.0

git-parameter:0.9.19

git-server:99.va_0826a_b_cdfa_d

github:1.37.3

github-api:1.314-431.v78d72a_3fe4c3

github-branch-source:1732.v3f1889a_c475b_

gitlab-api:5.3.0-91.v1f9a_fda_d654f

gitlab-branch-source:671.v67b_7169092ca_

gitlab-plugin:1.7.15

gradle:2.8.2

handlebars:3.0.8

handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953

htmlpublisher:1.32

instance-identity:173.va_37c494ec4e5

ionicons-api:56.v1b_1c8c49374e

ivy:2.5

jackson2-api:2.15.2-350.v0c2f3f8fc595

jakarta-activation-api:2.0.1-3

jakarta-mail-api:2.0.1-3

javadoc:243.vb_b_503b_b_45537

javax-activation-api:1.2.0-6

javax-mail-api:1.6.2-9

jaxb:2.3.8-1

jdk-tool:73.vddf737284550

jenkins-design-language:1.27.6

jenkins-multijob-plugin:623.v03401733c9a_9

jersey2-api:2.40-1

jira:3.10

jjwt-api:0.11.5-77.v646c772fddb_0

jnr-posix-api:3.1.17-1

jobConfigHistory:1227.v7a_79fc4dc01f

jquery:1.12.4-1

jquery-detached:1.2.1

jquery3-api:3.7.0-1

jsch:0.2.8-65.v052c39de79b_2

junit:1217.v4297208a_a_b_ce

kerberos-sso:1.11

kubernetes:3985.vd26d77b_2a_48a_

kubernetes-client-api:6.4.1-215.v2ed17097a_8e9

kubernetes-credentials:0.10.0

ldap:694.vc02a_69c9787f

lockable-resources:1185.v0c528656ce04

mailer:463.vedf8358e006b_

mapdb-api:1.0.9-28.vf251ce40855d

matrix-auth:3.1.10

matrix-project:808.v5a_b_5f56d6966

maven-plugin:3.23

mercurial:1260.vdfb_723cdcc81

metrics:4.2.18-442.v02e107157925

mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_

mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_

minio:1.3.3-rc93.9e92f846d4cf

momentjs:1.1.1

monitoring:1.95.0

notification:1.17

nsiqcollector:1.3.3

oic-auth:2.6

okhttp-api:4.11.0-157.v6852a_a_fa_ec11

pam-auth:1.10

parameterized-scheduler:255.v73827fcdf618

parameterized-trigger:2.46

pipeline-build-step:505.v5f0844d8d126

pipeline-github-lib:42.v0739460cda_c4

pipeline-graph-analysis:202.va_d268e64deb_3

pipeline-groovy-lib:685.v8ee9ed91d574

pipeline-input-step:477.v339683a_8d55e

pipeline-milestone-step:111.v449306f708b_7

pipeline-model-api:2.2144.v077a_d1928a_40

pipeline-model-definition:2.2144.v077a_d1928a_40

pipeline-model-extensions:2.2144.v077a_d1928a_40

pipeline-rest-api:2.33

pipeline-stage-step:305.ve96d0205c1c6

pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40

pipeline-stage-view:2.33

pipeline-utility-steps:2.16.0

plain-credentials:143.v1b_df8b_d3b_e48

plugin-usage-plugin:4.1

plugin-util-api:3.3.0

popper-api:1.16.1-3

popper2-api:2.11.6-2

prism-api:1.29.0-7

pubsub-light:1.17

resource-disposer:0.23

reverse-proxy-auth-plugin:1.7.7

run-condition:1.7

s3:0.12.3445.vda_704535b_5a_d

saml:4.429.v9a_781a_61f1da_

scm-api:676.v886669a_199a_a_

script-security:1275.v23895f409fb_d

snakeyaml-api:2.2-111.vc6598e30cc65

sse-gateway:1.26

ssh-agent:333.v878b_53c89511

ssh-credentials:308.ve4497b_ccd8f4

ssh-slaves:2.916.vd17b_43357ce4

sshd:3.312.v1c601b_c83b_0e

structs:325.vcb_307d2a_2782

subversion:2.17.3

test-results-aggregator:1.2.16

test-results-analyzer:0.4.0

test-stability:2.3

timestamper:1.26

token-macro:384.vf35b_f26814ec

trilead-api:2.84.v72119de229b_7

variant:60.v7290fc0eb_b_cd

view-job-filters:369.ve0513a_a_f5524

warnings-ng:10.4.0

windows-slaves:1.8.1

workflow-aggregator:596.v8c21c963d92d

workflow-api:1267.vd9b_a_ddd9eb_47

workflow-basic-steps:1042.ve7b_140c4a_e0c

workflow-cps:3774.v4a_d648d409ce

workflow-cps-global-lib:609.vd95673f149b_b

workflow-durable-task-step:1289.v4d3e7b_01546b_

workflow-job:1326.ve643e00e9220

workflow-multibranch:756.v891d88f2cd46

workflow-scm-step:415.v434365564324

workflow-step-api:639.v6eca_cd8c04a_a_

workflow-support:848.v5a_383b_d14921

ws-cleanup:0.45
```

2 attachments

- [jenkins_after_copy.PNG](https://issues.jenkins.io/secure/attachment/61145/jenkins_after_copy.PNG)
> ![jenkins_after_copy.PNG](https://issues.jenkins.io/secure/attachment/61145/jenkins_after_copy.PNG)
- [jenkins_before_copy.PNG](https://issues.jenkins.io/secure/attachment/61146/jenkins_before_copy.PNG)
> ![jenkins_before_copy.PNG](https://issues.jenkins.io/secure/attachment/61146/jenkins_before_copy.PNG)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.