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

Polarion Connector For Jenkins #4186

Open
nagasagar opened this issue Nov 20, 2024 · 38 comments
Open

Polarion Connector For Jenkins #4186

nagasagar opened this issue Nov 20, 2024 · 38 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

@nagasagar
Copy link

nagasagar commented Nov 20, 2024

Repository URL

https://github.com/nagasagar/polarion-connector-plugin

New Repository Name

polarion-connector-plugin

Description

This plugin provides options to, Publish test results to Polarion and Change the status of WorkItem In Polarion.

GitHub users to have commit permission

@nagasagar

Jenkins project users to have release permission

nagasagar

Issue tracker

Jira

@nagasagar nagasagar added the hosting-request Request to host a component in jenkinsci label Nov 20, 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.31.74)

@jenkins-cert-app jenkins-cert-app added the security-audit-todo The security team needs to audit the hosting request code label Nov 20, 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: You must specify an <scm> block in your pom.xml. See https://maven.apache.org/pom.html#SCM for more information.
  • ⛔ Required: The parent pom version '4.82' should be at least '4.85' or higher.
  • ⛔ Required: The dependency org.json:json should be replaced with a dependency to the api plugin io.jenkins.plugins:json-api
  • ⛔ Required: The 'artifactId' from the pom.xml (PolarionPlugin) should be all lower case
  • ⛔ Required: The 'artifactId' from the pom.xml (PolarionPlugin) is incorrect, it should be polarionconnectorforjenkins ('New Repository Name' field with "-plugin" removed)
  • ⛔ Required: 'New Repository Name' must end with "-plugin" (disregard if you are not requesting hosting of a plugin)

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) 🔍.

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.

PolarionNotifier.java#278
Potential CSRF vulnerability: If DescriptorImpl#doCheckTestResults connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
PolarionNotifier.java#254
Potential CSRF vulnerability: If DescriptorImpl#doCheckProject connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
PolarionNotifier.java#227
Potential CSRF vulnerability: If DescriptorImpl#doTestConnection connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST
PolarionWorkItemStatusUpdateBuilder.java#79
Potential CSRF vulnerability: If BuilderDescriptor#doCheckWorkItem 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.

PolarionNotifier.java#278
Potential missing permission check in DescriptorImpl#doCheckTestResults
PolarionNotifier.java#254
Potential missing permission check in DescriptorImpl#doCheckProject
PolarionNotifier.java#227
Potential missing permission check in DescriptorImpl#doTestConnection
PolarionWorkItemStatusUpdateBuilder.java#79
Potential missing permission check in BuilderDescriptor#doCheckWorkItem

Jenkins: Plaintext password storage

You can find detailed information about this finding here.

PolarionNotifier.java#143
Field should be reviewed whether it stores a password and is serialized to disk: token

@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 Nov 20, 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: You must specify an <scm> block in your pom.xml. See https://maven.apache.org/pom.html#SCM for more information.
  • ⛔ Required: The parent pom version '4.82' should be at least '4.85' or higher.
  • ⛔ Required: The dependency org.json:json should be replaced with a dependency to the api plugin io.jenkins.plugins:json-api
  • ⛔ Required: The 'artifactId' from the pom.xml (PolarionPlugin) should be all lower case
  • ⛔ Required: The 'artifactId' from the pom.xml (PolarionPlugin) is incorrect, it should be polarion ('New Repository Name' field with "-plugin" removed)

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

@nagasagar
Copy link
Author

/hosting re-check

@nagasagar
Copy link
Author

/audit-review

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.

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-correction-review The hosting request code was adjusted, a new security review must be done and removed security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request labels Nov 20, 2024
@nagasagar
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 Nov 20, 2024
@mawinter69
Copy link
Contributor

Your plugin doesn't support pipeline jobs, at least the Notifier is limited to AbstractBuild

@nagasagar
Copy link
Author

nagasagar commented Nov 21, 2024 via email

@mawinter69
Copy link
Contributor

Without pipeline support I guess you will not find many users for your plugin. Pipeline is the de facto standard nowadays.
Adding pipeline support is quite easy, just implement https://javadoc.jenkins.io/jenkins/tasks/SimpleBuildStep.html in the Notifier
Also add @Symbol annotations to the Descriptors to define names for the steps you can use in a pipeline script.

@nagasagar
Copy link
Author

/hosting re-check

1 similar comment
@timja
Copy link
Member

timja commented Nov 22, 2024

/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 'artifactId' from the pom.xml (polarion-connector) is incorrect, it should be polarion ('New Repository Name' field with "-plugin" removed)

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 Nov 22, 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: The 'artifactId' from the pom.xml (polarion-connector) is incorrect, it should be polarion ('New Repository Name' field with "-plugin" removed)

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

@nagasagar
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 the bot-check-complete Automated hosting checks passed label Nov 22, 2024
@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 Nov 24, 2024
@daniel-beck
Copy link
Contributor

https://github.com/nagasagar/polarion-connector-plugin/blob/e3aed456acebea53665237f35bfe9add82f036df/src/main/java/io/jenkins/plugins/polarionPlugin/PolarionNotifier.java#L270 should not be suppressed. This looks like it implements a server-side request forgery. Both CSRF protection and permission check are needed.

Less sure about https://github.com/nagasagar/polarion-connector-plugin/blob/e3aed456acebea53665237f35bfe9add82f036df/src/main/java/io/jenkins/plugins/polarionPlugin/PolarionNotifier.java#L298 and https://github.com/nagasagar/polarion-connector-plugin/blob/e3aed456acebea53665237f35bfe9add82f036df/src/main/java/io/jenkins/plugins/polarionPlugin/PolarionWorkItemStatusUpdateBuilder.java#L82 but if this service ever implements some sort of spam protection, lack of CSRF protection and permission check can lock out the Jenkins instance. No reason not to add these.

https://github.com/nagasagar/polarion-connector-plugin/blob/e3aed456acebea53665237f35bfe9add82f036df/src/main/java/io/jenkins/plugins/polarionPlugin/PolarionNotifier.java#L322 allows users without Job/Workspace permission to check whether a given pattern matches workspace contents. Please add a permission check here.

@nagasagar
Copy link
Author

/request-security-scan

@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 Nov 25, 2024
@jenkins-cert-app
Copy link
Collaborator

The Jenkins Security Scan discovered 1 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.

PolarionNotifier.java#326
Potential CSRF vulnerability: If DescriptorImpl#doCheckTestResults connects to user-specified URLs, modifies state, or is expensive to run, it should be annotated with @POST or @RequirePOST

@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 Nov 25, 2024
@daniel-beck
Copy link
Contributor

https://github.com/nagasagar/polarion-connector-plugin/blob/16558c5a16d319a0b0a6a3f80823e76d2437702c/src/main/java/io/jenkins/plugins/polarionPlugin/PolarionNotifier.java#L328 is probably wrong. Check for Item.WORKSPACE on the project if not null.

Similarly, doCheckWorkItem and doCheckProject should require Item/Configure on the job.

doTestConnection seems correct, as the UI is part of the global configuration.

@nagasagar
Copy link
Author

/request-security-scan

@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 Nov 25, 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 Nov 25, 2024
@nagasagar
Copy link
Author

/request-security-scan

@jenkins-cert-app jenkins-cert-app added security-audit-todo The security team needs to audit the hosting request code and removed security-audit-done The hosting request code passed the security audit with success labels Nov 25, 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 Nov 25, 2024
@nagasagar
Copy link
Author

nagasagar commented Nov 26, 2024

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

Hi,
is this step mandatory for hosting ?

@Wadeck
Copy link
Collaborator

Wadeck commented Nov 26, 2024

is this step mandatory for hosting ?

it's a recommendation, not a requirement :)

@alecharp
Copy link
Contributor

alecharp commented Dec 3, 2024

I think the only workflow that we consider as mandatory is to have the Jenkinsfile so that the plugin is in the community CI.

Of course, it's good to have the others: dependency update manager (dependabot, renovate or updatecli), release note generation (release-drafter) or even the continuous delivery one (cd).

I'd recommend also to remove the plugin folder on the repository. Git shouldn't be used to store the binaries.

@nagasagar
Copy link
Author

@alecharp removed binaries and added jenkinsfile

@alecharp
Copy link
Contributor

alecharp commented Dec 4, 2024

it seems that some of Daniel's comment were not addressed. Please check those.

@mawinter69
Copy link
Contributor

The method perform( AbstractBuild build, ...) https://github.com/nagasagar/polarion-connector-plugin/blob/d9add8e0b6db2e4de5aa22b857ea481ab26987b4/src/main/java/io/jenkins/plugins/polarionPlugin/PolarionNotifier.java#L139 can be removed. It will never be called as you have the more generic method that supports Run

@mawinter69
Copy link
Contributor

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