Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to Host Appcircle Testing Distribution plugin for jenkins #3955

Closed
guvenkaranfil opened this issue Jun 5, 2024 · 73 comments
Closed
Labels
bot-check-complete Automated hosting checks passed hosting-request Request to host a component in jenkinsci security-audit-done The hosting request code passed the security audit with success

Comments

@guvenkaranfil
Copy link

guvenkaranfil commented Jun 5, 2024

Repository URL

https://github.com/appcircleio/appcircle-testing-distribution-plugin

New Repository Name

appcircle-testing-distribution-plugin

Description

Appcircle Testing Distribution plugin is a unique way to upload your build artifacts to appcircleio mobile DevOps platform

GitHub users to have commit permission

@guvenkaranfil

Jenkins project users to have release permission

guvenkaranfil
appcircle

Issue tracker

GitHub issues

@guvenkaranfil guvenkaranfil added the hosting-request Request to host a component in jenkinsci label Jun 5, 2024
@jenkins-cert-app
Copy link
Collaborator

Security audit, information and commands

The security team is auditing all the hosting requests, to ensure a better security by default.

This message informs you that a Jenkins Security Scan was triggered on your repository.
It takes ~10 minutes to complete.

Commands

The bot will parse all comments, and it will check if any line start with a command.

Security team only:

  • /audit-ok => the audit is complete, the hosting can continue 🎉.
  • /audit-skip => the audit is not necessary, the hosting can continue 🎉.
  • /audit-findings => the audit reveals some issues that require corrections ✏️.

Anyone:

  • /request-security-scan => the findings from the Jenkins Security Scan were corrected, this command will re-scan your repository 🔍.
  • /audit-review => the findings from the audit were corrected, this command will ping the security team to review the findings 👀. It's only applicable when the previous audit required changes.

Only one command can be requested per comment.

(automatically generated message, version: 1.28.6)

@jenkins-cert-app jenkins-cert-app added the security-audit-todo The security team needs to audit the hosting request code label Jun 5, 2024
Copy link

github-actions bot commented Jun 5, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: Your baseline specified does not meet the minimum Jenkins version required, please update <jenkins.version>2.414.3</jenkins.version> to at least 2.440.3 in your pom.xml. Take a look at the baseline recommendations.
  • ⛔ Required: The parent pom version '4.80' should be at least '4.82' or higher.
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@jenkins-cert-app
Copy link
Collaborator

The Jenkins Security Scan discovered 9 finding(s) 🔍.

Please follow the instructions below for every identified issues:

  • Implement the recommended fix to address the issue.
  • If you think it's a false positive, suppress the warning directly within the code.
  • Alternative, you write an explanation here about why you think it's irrelevant. That will require a manual review, leading to a slower process.

After addressing the findings through one of the above methods:

  • If all modifications have been made to the code, please initiate a new security scan by triggering the /request-security-scan command.
  • If there are any unresolved findings (those not corrected or suppressed), request a review from the Jenkins security team by using the /audit-review command.

Stapler: Missing POST/RequirePOST annotation

You can find detailed information about this finding here.

AppcircleBuilder.java#156
Potential CSRF vulnerability: If DescriptorImpl#doCheckMessage connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
AppcircleBuilder.java#151
Potential CSRF vulnerability: If DescriptorImpl#doCheckProfileID connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
AppcircleBuilder.java#146
Potential CSRF vulnerability: If DescriptorImpl#doCheckAppPath connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
AppcircleBuilder.java#141
Potential CSRF vulnerability: If DescriptorImpl#doCheckAccessToken connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST

Stapler: Missing permission check

You can find detailed information about this finding here.

AppcircleBuilder.java#156
Potential missing permission check in DescriptorImpl#doCheckMessage
AppcircleBuilder.java#151
Potential missing permission check in DescriptorImpl#doCheckProfileID
AppcircleBuilder.java#146
Potential missing permission check in DescriptorImpl#doCheckAppPath
AppcircleBuilder.java#141
Potential missing permission check in DescriptorImpl#doCheckAccessToken

Jenkins: Plaintext password storage

You can find detailed information about this finding here.

AppcircleBuilder.java#27
Field should be reviewed whether it stores a password and is serialized to disk: accessToken

@jenkins-cert-app jenkins-cert-app added security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request and removed security-audit-todo The security team needs to audit the hosting request code labels Jun 5, 2024
@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Jun 5, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Jun 5, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@guvenkaranfil
Copy link
Author

Where do I need to add the Isegal user. I follow the links but could not found any settings for user adding.

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Jun 5, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Jun 5, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@lsegal
Copy link
Contributor

lsegal commented Jun 5, 2024

@guvenkaranfil I just logged in, please wait until the next hour to re-check this. Sorry about the delay.

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Jun 5, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@lsegal
Copy link
Contributor

lsegal commented Jun 5, 2024

@guvenkaranfil I think you should be giving commit / release permissions to yourself, not me.

GitHub users to have commit permission

@guvenkaranfil 

Jenkins project users to have release permission

guvenkaranfil

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Jun 6, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

1 similar comment
Copy link

github-actions bot commented Jun 6, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Jun 6, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @lsegal (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@guvenkaranfil
Copy link
Author

I've updated the "GitHub users to have commit permission" but still getting the same error. What should I do?

@timja
Copy link
Member

timja commented Jun 6, 2024

That error is not the same, its just issuing warnings about the "Jenkins project users to have release permission" section now

@guvenkaranfil
Copy link
Author

I see, Could you please guide me through how can i resolve it. I searched the docs and open the link provided in the comment but I could not understand how can i add it. Thank you so much

Copy link

github-actions bot commented Jun 6, 2024

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @guvenkaranfil (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Artifactory: @guvenkaranfil (reports are re-synced hourly, wait to re-check for a bit after logging in)

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@jenkins-cert-app jenkins-cert-app added security-audit-done The hosting request code passed the security audit with success and removed security-audit-todo The security team needs to audit the hosting request code labels Jul 23, 2024
@mawinter69
Copy link
Contributor

How does this differentiate from #3968?
It looks as if you should put both in the same plugin. A Jenkins plugin can implement many build steps and other things
Other problems:

  • the package name io.jenkins.plugins.ac is very generic, it should better be io.jenkins.plugins.appcircle
  • both plugins define the class AppcircleBuilder in the same package, this can't work full qualified name of classes must be unique within Jenkins
  • in https://github.com/appcircleio/appcircle-testing-distribution-plugin/blob/b74a86df23be9d0d8395da255fbde1db52de1b8f/src/main/java/io/jenkins/plugins/ac/AppcircleBuilder.java#L127 the symbol is used as the name in pipelines, so it should reflect that it is doing (both plugins use greet), e.g. appCircleTestingDistribution
  • the files in src/main/resources/assets look as if they are for documentation. So they should be outside of the src folder, e.g. in docs/images. Right now they get packed in the resulting jar file and will only make the plugin bigger.
  • the Messages.properties contains unused properties, also it refers to HelloWorldBuilder from the archetype
  • The permission checks all use Jenkins.ADMINISTER that means that only admins will be able to configure the steps, not sure if this really what you want. As all checks just check if not empty you can also omit the checks and apply annotations so the security scanner will not complain.
  • Can the accessToken that is used in both plugins be the same when I use both plugins? In general it would be better to use credentials as they can be defined once per Jenkins instance. So when the accessToken changes you only need to change it in one place, right now you would need to adjust each and every job (freestyle) that uses the accessToken.
  • the getInputValue method looks as if you want to make use of environment variables, not sure if this a good idea to allow this for the accessToken.
  • Consider that the command that you execute with launcher.launch() will be printed to the log, so the accessToken will also be printed in freestyle jobs (in pipeline jobs I could use a withCredentials step to set the accessToken and then it gets masked automatically.

There might be more problematic things

The plugins expect that the program appcircle is installed on the machine. And they are not doing much more than calling that program. I can achieve this also with a simple shell step in a pipeline.

@guvenkaranfil
Copy link
Author

Yes, while it's possible to achieve similar results with a shell script, many users prefer not to write custom scripts. Therefore, we aimed to automate the process of publishing the build to Appcircle, similar to how the App Center plugin functions (App Center Plugin).

Does this reason make sense to you? If so, I'll address the comments and submit another fix commit, @mawinter69.

@mawinter69
Copy link
Contributor

maybe I'm not the typical user, but from my experience it's mostly developers that use Jenkins and they usually have no problem to work with scripts. But it's fine to have that as a plugin.

@guvenkaranfil
Copy link
Author

@mawinter69, Thank you for your valuable feedback.

I have removed the environment variable option for accessToken as you recommended. Instead, you can now use withCredentials to securely handle the token, which ensures it is masked properly:

withCredentials([string(credentialsId: 'CREDENTIAL_ID', variable: 'VARIABLE_NAME')]) { // Your code here }
I’ve updated the implementation accordingly based on your guidance. Could you please review the changes and let me know if they meet the expectations? I will apply similar improvements to the Enterprise Store plugin as well.

Thanks again for your input!

@mawinter69
Copy link
Contributor

In the doc you have
appcircleTestingDistribution accessToken: hudson.util.Secret.fromString('VARIABLE_NAME')
Using hudson.util.Secret in a pipeline script is not a good idea, it is not allowed to use this method in a pipeline running in the groovy sandbox without approval. It might be that Jenkins will automatically convert a string to a secret when a secret is expected as a parameter so just using appcircleTestingDistribution accessToken: VARIABLE_NAME, ... might work, you should check this.

You should use f:password at https://github.com/appcircleio/appcircle-testing-distribution-plugin/blob/bd3605798a15aff142f228c396a4c7728827075c/src/main/resources/io/jenkins/plugins/appcircle/testing/distribution/TestingDistributionBuilder/config.jelly#L4

In a freestyle job the password can still be leaked at https://github.com/appcircleio/appcircle-testing-distribution-plugin/blob/bd3605798a15aff142f228c396a4c7728827075c/src/main/java/io/jenkins/plugins/appcircle/testing/distribution/TestingDistributionBuilder.java#L64
You should use https://javadoc.jenkins.io/hudson/Launcher.ProcStarter.html#masks(boolean...) to avoid that the password gets printed in a freestyle job. Ideally you create a unit test that runs a freestyle job that checks that the password is not printed to the log

Please consider merging the 2 plugins into a single Jenkins plugin. You have duplicated code (method loginToAC) and having both steps in a single plugin just adds additional maintenance effort on all sides. How likely is it that someone that uses this plugin will also use the other plugin?

@guvenkaranfil
Copy link
Author

Please consider merging the 2 plugins into a single Jenkins plugin.

While these use cases may appear similar, they are fundamentally distinct. Combining them into a single plugin would not adequately meet our customers' needs.

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The parent pom version '4.83' should be at least '4.85' or higher.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@github-actions github-actions bot added needs-fix and removed bot-check-complete Automated hosting checks passed labels Aug 19, 2024
@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The parent pom version '4.83' should be at least '4.85' or higher.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The parent pom version '4.83' should be at least '4.85' or higher.

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@guvenkaranfil
Copy link
Author

Hi @mawinter69,

I’ve removed the dependency on @appcircle/cli and opted for direct HTTP requests instead. Could you please review and approve the plugin?

Additionally, I’ve updated the parent POM version from 4.83 to 4.85.

Thank you!

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

@github-actions github-actions bot added bot-check-complete Automated hosting checks passed and removed needs-fix labels Aug 22, 2024
@mawinter69
Copy link
Contributor

Hello from your friendly Jenkins Hosting Checker

It appears you have some issues with your hosting request. Please see the list below and correct all issues marked Required. Your hosting request will not be approved until these issues are corrected. Issues marked with Warning or Info are just recommendations and will not stall the hosting process.

  • ⛔ Required: The dependency org.json:json should be replaced with a dependency to the api plugin io.jenkins.plugins:json-api
  • ⛔ Required: The dependency org.apache.httpcomponents:httpclient should be replaced with a dependency to the api plugin org.jenkins-ci.plugins:apache-httpcomponents-client-4-api

You can re-trigger a check by editing your hosting request or by commenting /hosting re-check

@guvenkaranfil
Copy link
Author

/hosting re-check

Copy link

github-actions bot commented Sep 3, 2024

Hello from your friendly Jenkins Hosting Checker

It looks like you have everything in order for your hosting request. A member of the Jenkins hosting team will check over things that I am not able to check(code review, README content, etc) and process the request as quickly as possible. Thank you for your patience.

Hosting team members can host this request with /hosting host

@guvenkaranfil
Copy link
Author

Could you please review the hosting request? Let me know if there is anything I need to do.

@timja
Copy link
Member

timja commented Sep 9, 2024

Below is my feedback for what I found, I don't see any blockers so I'll go ahead and host it, but I suggest fixing the below, and if you have any questions you can ask them on this issue.


  1. I suspect your plugin doesn't work for users behind a Proxy:

AuthService just creates a default http client without integrating with ProxyConfiguration

  1. Potential resource leakage, HttpClient created without closing it (applies in multiple places):

https://github.com/appcircleio/appcircle-testing-distribution-plugin/blob/main/src/main/java/io/jenkins/plugins/appcircle/testing/distribution/UploadService.java#L46

  1. Jelly files shouldn't need value to be used, use field instead:

https://github.com/appcircleio/appcircle-testing-distribution-plugin/blob/main/src/main/resources/io/jenkins/plugins/appcircle/testing/distribution/TestingDistributionBuilder/config.jelly

  1. Would be good to add some tests: https://github.com/appcircleio/appcircle-testing-distribution-plugin/blob/main/src/test/java/io/jenkins/plugins/appcircle/testing/distribution/TestingDistributionBuilderTest.java

  2. Instructions missing for adding API token to Jenkins, I assume its expected to be a credential of type Secret text

@timja
Copy link
Member

timja commented Sep 9, 2024

/hosting host

@jenkins-infra-bot
Copy link
Contributor

Hosting request complete, the code has been forked into the jenkinsci project on GitHub as https://github.com/jenkinsci/appcircle-testing-distribution-plugin

GitHub issues has been selected for issue tracking and was enabled for the forked repo.

A pull request has been created against the repository permissions updater to setup release permissions. Additional users can be added by modifying the created file.

Please delete your original repository (if there are no other forks), under 'Danger Zone', so that the jenkinsci organization repository is the definitive source for the code. If there are other forks, please contact GitHub support to make the jenkinsci repo the root of the fork network (mention that Jenkins approval was given in support request 569994). Also, please make sure you properly follow the documentation on documenting your plugin so that your plugin is correctly documented.

You will also need to do the following in order to push changes and release your plugin:

Welcome aboard!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot-check-complete Automated hosting checks passed hosting-request Request to host a component in jenkinsci security-audit-done The hosting request code passed the security audit with success
Projects
None yet
Development

No branches or pull requests

8 participants