jenkins-infra / repository-permissions-updater

Artifactory permissions synchronization tool and data set
76 stars 1.02k forks source link

Plugin hosting request for traceable-plugin #3977

Open dhruv-singhal-github opened 2 weeks ago

dhruv-singhal-github commented 2 weeks ago

Repository URL

https://github.com/Traceableai/traceable-xast-jenkins-plugin

New Repository Name

traceable-plugin

Description

This is a plugin by Traceable AI that helps in API Security Testing by finding vulnerabilities in very early stages, giving developers and Product security engineers more time and context to prioritize mitigation of vulnerabilities and build resilient systems by scanning APIs for vulnerabilities by changing the data in the existing API specifications as required to introduce vulnerabilities.

GitHub users to have commit permission

@dhruv-singhal-github @samarth-gupta-traceable

Jenkins project users to have release permission

dhruv_singhal traceableai

Issue tracker

Jira

github-actions[bot] commented 2 weeks ago

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 commented 2 weeks ago

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 :tada:.
  • /audit-skip => the audit is not necessary, the hosting can continue :tada:.
  • /audit-findings => the audit reveals some issues that require corrections :pencil2:.
Anyone:
  • /request-security-scan => the findings from the Jenkins Security Scan were corrected, this command will re-scan your repository :mag:.
  • /audit-review => the findings from the audit were corrected, this command will ping the security team to review the findings :eyes:. 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)

github-actions[bot] commented 2 weeks ago

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

jenkins-cert-app commented 2 weeks ago

The Jenkins Security Scan discovered 7 finding(s) :mag:.

Please follow the instructions below for every identified issues:

After addressing the findings through one of the above methods:


Jenkins: Plaintext password storage

You can find detailed information about this finding here.

TraceableASTGenerateReportAction.java#30 ``` Field should be reviewed whether it stores a password and is serialized to disk: traceableCliKeyFileName ```
TraceableASTGenerateReportAction.java#27 ``` Field should be reviewed whether it stores a password and is serialized to disk: clientToken ```

Jenkins: Generally unsafe method calls

You can find detailed information about this finding here.

TraceableASTGenerateReportAction.java#63 ``` Potentially unsafe invocation of Runtime#exec ```
TraceableASTInitAndRunStepBuilder.java#469 ``` Potentially unsafe invocation of Runtime#exec ```
TraceableASTInitStepBuilder.java#430 ``` Potentially unsafe invocation of Runtime#exec ```
TraceableASTRunStepBuilder.java#90 ``` Potentially unsafe invocation of Runtime#exec ```
TraceableApiInspectorStepBuilder.java#104 ``` Potentially unsafe invocation of Runtime#exec ```
daniel-beck commented 2 weeks ago

All of

Jenkins: Generally unsafe method calls

look like real findings: User input can be used as commands. This plugin also doesn't seem to support distributed builds, but haven't looked closely enough to be sure. I recommend this not be hosted in the current state unless thoroughly reviewed.

dhruv-singhal-github commented 1 week ago

@daniel-beck do you know the reason for the following check failing?

The following usernames in 'GitHub Users to Authorize as Committers' are not valid GitHub usernames or are Organizations: dhruv-singhal-github samarth-gupta-traceable

Both usernames are valid usernames when you search on github.

daniel-beck commented 1 week ago

Obsolete since Tim edited your comment, see https://github.com/jenkins-infra/repository-permissions-updater/issues/3977#issuecomment-2176404488.

dhruv-singhal-github commented 1 week ago

/request-security-scan

jenkins-cert-app commented 1 week ago

The Jenkins Security Scan discovered 1 finding(s) :mag:.

Please follow the instructions below for every identified issues:

After addressing the findings through one of the above methods:


Jenkins: Plaintext password storage

You can find detailed information about this finding here.

TraceableASTGenerateReportAction.java#31 ``` Field should be reviewed whether it stores a password and is serialized to disk: traceableCliKeyFileName ```
dhruv-singhal-github commented 1 week ago

@daniel-beck This seems a false positive because this is not the actual cert value but the file name of the cert

daniel-beck commented 1 week ago

because this is not the actual cert value but the file name of the cert

Yep, that one's fine. Suppress the finding, or don't if there are no plans to use the security scan in your repo.

FWIW it's unclear to me why the RunAction2 needs to persist a token that's only used once in #onAttached, that seems unnecessary. I suggest you review what you persist to disk vs. what needs to be persisted.

Replacing Runtime#exec with ProcessBuilder took care of the rudimentary security check, but it still looks like a vulnerability that could allow users with Job/Configure to execute arbitrary code on the controller. https://github.com/Traceableai/traceable-xast-jenkins-plugin/blob/8cd9f4b8d983bd42e2cf866741299005d2779bb1/src/main/resources/io/jenkins/plugins/traceable/ast/shell_scripts/api_inspector.sh#L11 looks really concerning.

dhruv-singhal-github commented 1 week ago

@daniel-beck how do you suggest we solve this, since we do need to run scripts based on parameters from users.

daniel-beck commented 6 days ago

@dhruv-singhal-github First, determine whether they need to run on the controller. Tools generally run on the node that performs other build steps as well, typically an agent. https://www.jenkins.io/redirect/distributed-builds/

If you're absolutely sure it needs to happen on the controller (and not just out of convenience), try the same or similar script without eval. I don't see why that would be needed.

Note that most scripts have a shebang line and this one does not, and those that have it hardcode a path to /bin/bash so I wonder whether all of this works reliably anyway. Most (all?) of these scripts do not appear to do anything you wouldn't be able with Java, so it's unclear what they're needed for anyway.