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

Publish CTRF JSON plugin #3893

Closed
Ma11hewThomas opened this issue Apr 16, 2024 · 37 comments
Closed

Publish CTRF JSON plugin #3893

Ma11hewThomas opened this issue Apr 16, 2024 · 37 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

@Ma11hewThomas
Copy link
Contributor

Ma11hewThomas commented Apr 16, 2024

Repository URL

https://github.com/ctrf-io/ctrf-json-plugin

New Repository Name

ctrf-json-plugin

Description

This plugin allows users to publish CTRF reports on jenkins, CTRF is a JSON test report schema that provides standardized JSON test results reports.

GitHub users to have commit permission

ma11hewthomas

Jenkins project users to have release permission

ma11hewthomas

Issue tracker

GitHub issues

@Ma11hewThomas Ma11hewThomas added the hosting-request Request to host a component in jenkinsci label Apr 16, 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: Your baseline specified does not meet the minimum Jenkins version required, please update <jenkins.version>2.414.3</jenkins.version> to at least 2.426.3 in your pom.xml. Take a look at the baseline recommendations.
  • ⛔ Required: The parent pom version '4.75' should be at least '4.78' or higher.
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @Ma11hewThomas (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: @Ma11hewThomas (reports are re-synced hourly, wait to re-check for a bit after logging in)
  • ⛔ 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

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

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

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

HelloWorldBuilder.java#174
Potential CSRF vulnerability: If DescriptorImpl#doCheckJsonFilePattern 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.

HelloWorldBuilder.java#174
Potential missing permission check in DescriptorImpl#doCheckJsonFilePattern

Jenkins: Potentially unsafe classes

You can find detailed information about this finding here.

HelloWorldBuilder.java#100
This use of class [javax.xml.transform.TransformerFactory](1) should be reviewed for unsafe behavior, like allowing XML External Entity injection, or arbitrary code execution.

@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 Apr 16, 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: Your baseline specified does not meet the minimum Jenkins version required, please update <jenkins.version>2.414.3</jenkins.version> to at least 2.426.3 in your pom.xml. Take a look at the baseline recommendations.
  • ⛔ Required: The parent pom version '4.75' should be at least '4.78' or higher.
  • ⛔ Required: The following usernames in 'Jenkins project users to have release permission' need to log into Jira: @Ma11hewThomas (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: @Ma11hewThomas (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

@Ma11hewThomas
Copy link
Contributor 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 following usernames in 'Jenkins project users to have release permission' need to log into Jira: @Ma11hewThomas (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: @Ma11hewThomas (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

@Ma11hewThomas
Copy link
Contributor Author

/hosting re-check

@Ma11hewThomas
Copy link
Contributor Author

/request-security-scan

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 following usernames in 'Jenkins project users to have release permission' need to log into Jira: @Ma11hewThomas (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: @Ma11hewThomas (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-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 Apr 17, 2024
@jenkins-cert-app
Copy link
Collaborator

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

HelloWorldBuilder.java#189
Potential CSRF vulnerability: If DescriptorImpl#doCheckJsonFilePattern 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.

HelloWorldBuilder.java#189
Potential missing permission check in DescriptorImpl#doCheckJsonFilePattern

Jenkins: Potentially unsafe classes

You can find detailed information about this finding here.

HelloWorldBuilder.java#101
This use of class [javax.xml.transform.TransformerFactory](1) should be reviewed for unsafe behavior, like allowing XML External Entity injection, or arbitrary code execution.

@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 Apr 17, 2024
@Ma11hewThomas
Copy link
Contributor 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 Apr 17, 2024
@jenkins-cert-app
Copy link
Collaborator

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

HelloWorldBuilder.java#189
Potential CSRF vulnerability: If DescriptorImpl#doCheckJsonFilePattern 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.

HelloWorldBuilder.java#189
Potential missing permission check in DescriptorImpl#doCheckJsonFilePattern

Jenkins: Potentially unsafe classes

You can find detailed information about this finding here.

HelloWorldBuilder.java#101
This use of class [javax.xml.transform.TransformerFactory](1) should be reviewed for unsafe behavior, like allowing XML External Entity injection, or arbitrary code execution.

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

Maybe fix the package name and rename HelloWorldBuilder, that doesn't look good 😉

@Ma11hewThomas
Copy link
Contributor Author

@daniel-beck thanks for the feedback, I've made those changes.

@Ma11hewThomas
Copy link
Contributor Author

/request-security-scan

@Ma11hewThomas
Copy link
Contributor Author

/hosting re-check

@jenkins-cert-app jenkins-cert-app removed the security-audit-needs-correction The security audit revealed issues that must be corrected from the hosting request label Apr 17, 2024
@Ma11hewThomas
Copy link
Contributor Author

/request-security-scan

@Ma11hewThomas
Copy link
Contributor Author

/hosting re-check

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

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

PublishCtrfJson.java#189
Potential CSRF vulnerability: If DescriptorImpl#doCheckJsonFilePattern 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 Apr 23, 2024
@Ma11hewThomas
Copy link
Contributor 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 Apr 26, 2024
@Ma11hewThomas
Copy link
Contributor Author

/hosting re-check

@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 Apr 26, 2024
@Ma11hewThomas
Copy link
Contributor 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 following usernames in 'Jenkins project users to have release permission' need to log into Jira: @Ma11hewThomas (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: @Ma11hewThomas (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

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 Apr 29, 2024
@Ma11hewThomas
Copy link
Contributor 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

@alecharp
Copy link
Contributor

alecharp commented May 2, 2024

Hello, I looked at the repository of the plugin and I have a few comments.

Looking at what you plugin is doing, it seems that it's converting the CTRF files to JUnit format and let the JUnit plugin interpret those. I'm curious to know if you have tested to use your plugin on a project build that also has a JUnit report? How are the two behave?

@timja
Copy link
Member

timja commented May 2, 2024

I'd suggested to add the license header in your source code files

Most plugins don't do this, unless they are mixing licenses

@Ma11hewThomas
Copy link
Contributor Author

@alecharp thanks for the review
All items have been completed - additional comments below:

Is it possible that the report be larger than the possible size of a String and so creates a problem with
I’ve amended to use Jackson stream, which manages this better

you publish a JUnit report for each CTRF file. Wouldn't it be better to publish only one for all of them?
In most instances a single CTRF report is generated by the test frameworks, although multiple executions may happen in the same build, for this reason I don’t think it’s worth rearchitecting the approach at this stage.

Looking at what you plugin is doing, it seems that it's converting the CTRF files to JUnit format and let the JUnit plugin interpret those. I'm curious to know if you have tested to use your plugin on a project build that also has a JUnit report? How are the two behave?
I’ve tested both publish CTRF and publish junit and they behave nicely together. All tests are published successfully.

* you are not marking the build / run as failed if an exception occurred, is that voluntary?
Now marking build as failed if exception occurs

I would suggested to be more specific than Exception in
improved exception handling overall

* I'd suggested to add the license header in your source code files
`Not required as mentioned by @timja

@NotMyFault
Copy link
Member

Looks good so far! But I'd recommend

@Ma11hewThomas
Copy link
Contributor Author

Thanks for the feedback @NotMyFault, I've applied the recommended changes

@NotMyFault
Copy link
Member

/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/ctrf-json-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