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

Hosting request for Black Duck Coverity on Polaris Plugin #4135

Closed
zaman-akib opened this issue Oct 15, 2024 · 26 comments
Closed

Hosting request for Black Duck Coverity on Polaris Plugin #4135

zaman-akib opened this issue Oct 15, 2024 · 26 comments
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

@zaman-akib
Copy link

zaman-akib commented Oct 15, 2024

Repository URL

https://github.com/blackduck-inc/blackduck-coverity-on-polaris-plugin

New Repository Name

blackduck-coverity-on-polaris-plugin

Description

Black Duck Coverity on Polaris for Jenkins simplifies implementing Coverity on Polaris static analysis in Jenkins builds.

Currently we have a similar kind of plugin in Jenkins marketplace -https://plugins.jenkins.io/synopsys-polaris/ which we will deprecate after releasing this new plugin as we are re-branding the Synopsys products as Black Duck products.

GitHub users to have commit permission

@zaman-akib
@blackduck-saraf
@manjeet-s

Jenkins project users to have release permission

zaman_akib

Issue tracker

GitHub issues

@zaman-akib zaman-akib added the hosting-request Request to host a component in jenkinsci label Oct 15, 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.29.21)

@jenkins-cert-app jenkins-cert-app added the security-audit-todo The security team needs to audit the hosting request code label Oct 15, 2024
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: Repository URL 'https://github.com/blackduck-inc/blackduck-coverity-on-polaris-plugin' is not a valid GitHub repository (check that you do not have .git at the end, GitHub API doesn't support this).
  • ⛔ Required: 'New Repository Name' must end with "-plugin" (disregard if you are not requesting hosting of a plugin)
  • ⚠️ Warning: No pom.xml detected.

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

@jenkins-cert-app
Copy link
Collaborator

❌ Jenkins Security Scan failed.
The Security team was notified about this.

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 dependency org.apache.httpcomponents:httpclient should be replaced with a dependency to the api plugin org.jenkins-ci.plugins:apache-httpcomponents-client-4-api
  • ⛔ Required: The dependency org.apache.commons:commons-text should be replaced with a dependency to the api plugin io.jenkins.plugins:commons-text-api

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

@zaman-akib
Copy link
Author

/request-security-scan

@jenkins-cert-app
Copy link
Collaborator

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

For every identified issue, please do one of the following:

  • 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.

FreestyleCreateChangeSetFile.java#118
Potential CSRF vulnerability: If DescriptorImpl#doFillBuildStatusOnSkipItems connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
PolarisBuildStep.java#127
Potential CSRF vulnerability: If DescriptorImpl#doFillPolarisCliNameItems connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
WaitForIssues.java#65
Potential CSRF vulnerability: If DescriptorImpl#doFillBuildStatusForIssuesItems connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
PolarisGlobalConfig.java#201
Potential CSRF vulnerability: If PolarisGlobalConfig#doConfigDotXml connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
PolarisGlobalConfig.java#121
Potential CSRF vulnerability: If PolarisGlobalConfig#doFillPolarisCredentialsIdItems connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
ExecutePolarisCliStep.java#119
Potential CSRF vulnerability: If DescriptorImpl#doFillPolarisCliItems 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.

FreestyleCreateChangeSetFile.java#118
Potential missing permission check in DescriptorImpl#doFillBuildStatusOnSkipItems
PolarisBuildStep.java#127
Potential missing permission check in DescriptorImpl#doFillPolarisCliNameItems
WaitForIssues.java#65
Potential missing permission check in DescriptorImpl#doFillBuildStatusForIssuesItems
ExecutePolarisCliStep.java#119
Potential missing permission check in DescriptorImpl#doFillPolarisCliItems

Jenkins: Plaintext password storage

You can find detailed information about this finding here.

FindOrInstallPolarisCli.java#34
Field should be reviewed whether it stores a password and is serialized to disk: proxyPassword
PolarisAccessTokenResolver.java#27
Field should be reviewed whether it stores a password and is serialized to disk: accessTokenFilePath
PolarisAccessTokenResolver.java#25
Field should be reviewed whether it stores a password and is serialized to disk: accessToken
PolarisServerConfig.java#44
Field should be reviewed whether it stores a password and is serialized to disk: accessToken
AccessTokenPolarisHttpClient.java#37
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 security-audit-todo The security team needs to audit the hosting request code and removed security-audit-todo The security team needs to audit the hosting request code security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request labels Oct 15, 2024
@mawinter69
Copy link
Contributor

/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 dependency org.apache.httpcomponents:httpclient should be replaced with a dependency to the api plugin org.jenkins-ci.plugins:apache-httpcomponents-client-4-api
  • ⛔ Required: The dependency org.apache.commons:commons-text should be replaced with a dependency to the api plugin io.jenkins.plugins:commons-text-api

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

@Wadeck Wadeck 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 Oct 15, 2024
@zaman-akib
Copy link
Author

/hosting re-check

@zaman-akib
Copy link
Author

/request-security-scan

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 Oct 16, 2024
@jenkins-cert-app jenkins-cert-app added security-audit-todo The security team needs to audit the hosting request code and removed security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request labels Oct 16, 2024
@jenkins-cert-app
Copy link
Collaborator

The Jenkins Security Scan did not find anything dangerous with your plugin, congratulations! 🎉


💡 The Security team recommends that you are setting up the scan in your repository by following our guide.

@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 Oct 16, 2024
@zaman-akib
Copy link
Author

/audit-review

@jenkins-cert-app jenkins-cert-app added security-audit-correction-review The hosting request code was adjusted, a new security review must be done and removed security-audit-done The hosting request code passed the security audit with success labels Oct 16, 2024
@Kevin-CB
Copy link

I reviewed the previous audit, everything seems fine!

@Kevin-CB
Copy link

/audit-ok

@jenkins-cert-app jenkins-cert-app added security-audit-done The hosting request code passed the security audit with success and removed security-audit-correction-review The hosting request code was adjusted, a new security review must be done labels Oct 17, 2024
@mawinter69
Copy link
Contributor

@zaman-akib
Copy link
Author

zaman-akib commented Oct 17, 2024

@mawinter69

  1. Removed the unused dependencies (xstream, structs, localizer)
  2. As per your suggestion, I have updated commons-text, commons-text and common-compress with io.jenkins.plugins:commons-lang3-api
  3. And regarding httpclient, that we cannot replace with io.jenkins.plugins:apache-httpcomponents-client-5-api because the jenkins-common library that we are using is dependent on httpclient-4.5.14 and apache-httpcomponents-client-5-api uses a higher version which is httpclient5 and this is not compatible with the jenkins-common library. That is reason we need to use httpclient4. The httpclient4 is not yet updated to httpclient5 in the jenkins-common library.

@mawinter69
Copy link
Contributor

io.jenkins.plugins:commons-lang3-api is only for commons-lang3, it doesn't contain any other commons library nor any httpclient, so you need:
commons-text-> https://plugins.jenkins.io/commons-text-api/
commons-compress -> https://plugins.jenkins.io/commons-compress-api/
httpclient-> https://plugins.jenkins.io/apache-httpcomponents-client-4-api/

Looking at the resulting hpi file I can see several jar for which api plugins in Jenkins exists.
https://plugins.jenkins.io/gson-api/
https://plugins.jenkins.io/json-path-api/
https://plugins.jenkins.io/jackson2-api/

I assume you get them transitively via some other dependency (your jenkins-common maybe)
So those should be excluded and explicit dependencies be declared.

Also the 2 annotations jar files, are they required at runtime? Or are they compile time only?

@zaman-akib
Copy link
Author

@mawinter69
I have updated accordingly. Please check now.

And about those 2 annotations jar files, Yes they are required in compile time only.

@mawinter69
Copy link
Contributor

if possible please exclude them from packaging.

https://github.com/blackduck-inc/blackduck-coverity-on-polaris-plugin/blob/21b549ea992af21f36db80342b58f3ac255c4e0f/src/main/java/com/blackduck/integration/jenkins/polaris/extensions/global/PolarisGlobalConfig.java#L46
replace with commons.lang3.StringUtils
Then you don't have any reference to commons-lang2 (which is included in Jenkins core and that's why you can make use of it, but that kind of dependency should be avoided)

@zaman-akib
Copy link
Author

@mawinter69
Updated accordingly

@zaman-akib
Copy link
Author

@mawinter69 do you have any follow up review or are we good to host?

@mawinter69
Copy link
Contributor

From my point of view it looks good, but I don't have the powers to host

@zaman-akib
Copy link
Author

From my point of view it looks good, but I don't have the powers to host

Thanks and it will be great if you can refer this hosting request to someone who can host.

@timja
Copy link
Member

timja commented Oct 22, 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/blackduck-coverity-on-polaris-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

7 participants