jenkinsci / file-parameters-plugin

https://plugins.jenkins.io/file-parameters/
MIT License
14 stars 11 forks source link

StackOverflowError when using Base64 File Parameter on freestyle project #116

Open visit1985 opened 2 years ago

visit1985 commented 2 years ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.346.1 OS: Linux - 5.4.0-110-generic --- ace-editor:1.1 amazon-ecr:1.73.v741d474abe74 ansicolor:1.0.1 ant:475.vf34069fef73c antisamy-markup-formatter:2.7 apache-httpcomponents-client-4-api:4.5.13-1.0 authentication-tokens:1.4 aws-credentials:191.vcb_f183ce58b_9 aws-java-sdk:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-cloudformation:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-codebuild:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-ec2:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-ecr:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-ecs:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-elasticbeanstalk:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-iam:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-logs:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-minimal:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-sns:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-sqs:1.12.246-349.v96b_b_f7eb_a_c3c aws-java-sdk-ssm:1.12.246-349.v96b_b_f7eb_a_c3c aws-parameter-store:1.2.2 badge:1.9.1 blueocean:1.25.5 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.25.5 blueocean-commons:1.25.5 blueocean-config:1.25.5 blueocean-core-js:1.25.5 blueocean-dashboard:1.25.5 blueocean-display-url:2.4.1 blueocean-events:1.25.5 blueocean-git-pipeline:1.25.5 blueocean-github-pipeline:1.25.5 blueocean-i18n:1.25.5 blueocean-jwt:1.25.5 blueocean-personalization:1.25.5 blueocean-pipeline-api-impl:1.25.5 blueocean-pipeline-editor:1.25.5 blueocean-pipeline-scm-api:1.25.5 blueocean-rest:1.25.5 blueocean-rest-impl:1.25.5 blueocean-web:1.25.5 bootstrap4-api:4.6.0-5 bootstrap5-api:5.1.3-7 bouncycastle-api:2.26 branch-api:2.1046.v0ca_37783ecc5 build-timeout:1.21 caffeine-api:2.9.3-65.v6a_47d0f4d1fe checks-api:1.7.4 cloudbees-bitbucket-branch-source:773.v4b_9b_005b_562b_ cloudbees-folder:6.729.v2b_9d1a_74d673 command-launcher:84.v4a_97f2027398 compact-columns:1.148.v649c8db_2a_91e config-file-provider:3.10.0 copyartifact:1.46.4 credentials:1139.veb_9579fca_33b_ credentials-binding:523.vd859a_4b_122e6 cron_column:1.4 custom-tools-plugin:0.8 dependency-check-jenkins-plugin:5.1.2 dependency-track:4.2.0 display-url-api:2.3.6 docker-commons:1.19 docker-workflow:1.29 durable-task:496.va67c6f9eefa7 echarts-api:5.3.3-1 email-ext:2.89 extended-choice-parameter:346.vd87693c5a_86c extensible-choice-parameter:1.8.0 external-monitor-job:191.v363d0d1efdf8 extra-columns:1.25 favorite:2.4.1 file-parameters:205.vf6ce13b_e5dee font-awesome-api:6.1.1-1 git:4.11.3 git-client:3.11.0 git-parameter:0.9.17 git-push:34.vd474e0fe7b_ec git-server:1.11 github:1.34.4 github-api:1.303-400.v35c2d8258028 github-branch-source:1656.v77eddb_b_e95df gradle:1.39.3 greenballs:1.15.1 groovy-postbuild:2.5 h2-api:1.4.199 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.30 hudson-wsclean-plugin:1.0.8 jackson2-api:2.13.3-285.vc03c0256d517 javadoc:217.v905b_86277a_2a_ javax-activation-api:1.2.0-3 javax-mail-api:1.6.2-6 jaxb:2.3.6-1 jdk-tool:1.5 jenkins-design-language:1.25.5 jersey2-api:2.36-2 jira:3.7.1 jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.7-3 job-dsl:1.80 jobConfigHistory:1155.v28a_46a_cc06a_5 jquery:1.12.4-1 jquery3-api:3.6.0-4 jsch:0.1.55.2 junit:1119.1121.vc43d0fc45561 kubernetes-cli:1.10.3 kubernetes-client-api:5.12.2-193.v26a_6078f65a_9 kubernetes-credentials:0.9.0 ldap:2.10 lockable-resources:2.15 mailer:414.vcc4c33714601 mapdb-api:1.0.9.0 matrix-auth:3.1.5 matrix-project:772.v494f19991984 maven-artifact-choicelistprovider:1.11.0 maven-plugin:3.19 mina-sshd-api-common:2.8.0-21.v493b_6b_db_22c6 mina-sshd-api-core:2.8.0-21.v493b_6b_db_22c6 momentjs:1.1.1 next-executions:1.0.15 nexus-artifact-uploader:2.13 nodejs:1.5.1 okhttp-api:4.9.3-105.vb96869f8ac3a pam-auth:1.8 pipeline-aws:1.43 pipeline-build-step:2.18 pipeline-graph-analysis:195.v5812d95a_a_2f9 pipeline-groovy-lib:593.va_a_fc25d520e9 pipeline-input-step:449.v77f0e8b_845c4 pipeline-maven:1161.v89a_7dcec5d31 pipeline-milestone-step:101.vd572fef9d926 pipeline-model-api:2.2097.v33db_b_de764b_e pipeline-model-definition:2.2097.v33db_b_de764b_e pipeline-model-extensions:2.2097.v33db_b_de764b_e pipeline-rest-api:2.24 pipeline-stage-step:293.v200037eefcd5 pipeline-stage-tags-metadata:2.2097.v33db_b_de764b_e pipeline-stage-view:2.24 plain-credentials:1.8 plugin-util-api:2.17.0 popper-api:1.16.1-3 popper2-api:2.11.5-2 powershell:1.7 pubsub-light:1.16 rebuild:1.34 resource-disposer:0.19 rich-text-publisher-plugin:1.4 s3:0.12.1 saferestart:0.3 scm-api:608.vfa_f971c5a_a_e9 script-security:1175.v4b_d517d6db_f0 scriptler:3.5 simple-theme-plugin:103.va_161d09c38c7 snakeyaml-api:1.30.2-76.vc104f7ce9870 sonar:2.14 sse-gateway:1.25 ssh-agent:295.v9ca_a_1c7cc3a_a_ ssh-credentials:277.v95c2fec1c047 ssh-slaves:1.821.vd834f8a_c390e sshd:3.242.va_db_9da_b_26a_c3 structs:318.va_f3ccb_729b_71 subversion:2.15.5 timestamper:1.18 tm4j-automation:3.2.1 token-macro:293.v283932a_0a_b_49 trilead-api:1.57.v6e90e07157e1 uno-choice:2.6.2 variant:1.4 windows-slaves:1.8.1 workflow-aggregator:590.v6a_d052e5a_a_b_5 workflow-api:1188.v0016b_4f29881 workflow-basic-steps:969.vc4ec3e4854b_f workflow-cps:2746.v0da_83a_332669 workflow-durable-task-step:1174.v73a_9a_17edce0 workflow-job:1203.v7b_7023424efe workflow-multibranch:716.vc692a_e52371b_ workflow-scm-step:400.v6b_89a_1317c9a_ workflow-step-api:625.vd896b_f445a_f8 workflow-support:827.v7ef666c4d65c ws-cleanup:0.42 xray-connector:2.6.1 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Jenkins controller running on Linux with one local agent launched via command execution on controller.

Reproduction steps

  1. Create a freestyle project with a Base64 File Parameter named FILE and a shell step just running echo $FILE
  2. Start the job with any file

Expected Results

The shell step should output base64 string.

Actual Results

FATAL: null
java.lang.StackOverflowError
    at java.base/java.lang.Class.getDeclaredMethod(Class.java:2473)
    at hudson.Util.getMethod(Util.java:1555)
    at hudson.Util.isOverridden(Util.java:1519)
    at hudson.model.ParameterValue.buildEnvVars(ParameterValue.java:166)
    at hudson.model.ParameterValue.buildEnvironment(ParameterValue.java:194)
    at io.jenkins.plugins.file_parameters.AbstractFileParameterValue.buildEnvironment(AbstractFileParameterValue.java:95)
    at io.jenkins.plugins.file_parameters.Base64FileParameterValue.buildEnvironment(Base64FileParameterValue.java:64)
    at hudson.model.ParameterValue.buildEnvVars(ParameterValue.java:167)
    at hudson.model.ParameterValue.buildEnvironment(ParameterValue.java:194)
    at io.jenkins.plugins.file_parameters.AbstractFileParameterValue.buildEnvironment(AbstractFileParameterValue.java:95)
    at io.jenkins.plugins.file_parameters.Base64FileParameterValue.buildEnvironment(Base64FileParameterValue.java:64)
    at hudson.model.ParameterValue.buildEnvVars(ParameterValue.java:167)
    at hudson.model.ParameterValue.buildEnvironment(ParameterValue.java:194)
    at io.jenkins.plugins.file_parameters.AbstractFileParameterValue.buildEnvironment(AbstractFileParameterValue.java:95)
    at io.jenkins.plugins.file_parameters.Base64FileParameterValue.buildEnvironment(Base64FileParameterValue.java:64)
    at hudson.model.ParameterValue.buildEnvVars(ParameterValue.java:167)
...

Anything else?

If I remove the shell step the job succeeds.

jglick commented 2 years ago

https://github.com/jenkinsci/file-parameters-plugin/blob/10dbcb51bf4bbd6e8fa62584b8e41388fb55af37/src/main/java/io/jenkins/plugins/file_parameters/AbstractFileParameterValue.java#L95 should likely be removed. Possibly I never bothered to write tests for non-Pipeline projects.