jenkins-infra / repository-permissions-updater

Artifactory permissions synchronization tool and data set
77 stars 1.03k forks source link

Infisical Plugin #3924

Closed DanielHougaard closed 3 months ago

DanielHougaard commented 3 months ago

Repository URL

https://github.com/Infisical/infisical-jenkins

New Repository Name

infisical-plugin

Description

The Infisical Plugin is a native integration that links Infisical with Jenkins, without the need to use our CLI tool as a part of the freestyle Jenkins project.

The plugin pulls in secret values from Infisical and sets environment variables that can be used in the build step(s). The secret values are masked from the output.

The plugin takes use of Credentials to securely store the Infisical authentication credentials.

GitHub users to have commit permission

@danielhougaard @maidul98 @dangtony98 @vmatsiiako @akhilmhdh

Jenkins project users to have release permission

danielhougaard

Issue tracker

Jira

github-actions[bot] commented 3 months 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 3 months 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.4)

jenkins-cert-app commented 3 months ago

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

Please follow the instructions below for every identified issues:

After addressing the findings through one of the above methods:


Jenkins: Missing permission check on a form fill web method with credentials lookup

You can find detailed information about this finding here.

InfisicalConfiguration.java#140 ``` doFillInfisicalCredentialIdItems should perform a permission check before calling #includeAs doFillInfisicalCredentialIdItems should perform a permission check before calling #includeEmptyValue ```

Stapler: Missing POST/RequirePOST annotation

You can find detailed information about this finding here.

InfisicalConfiguration.java#140 ``` Potential CSRF vulnerability: If DescriptorImpl#doFillInfisicalCredentialIdItems 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.

InfisicalConfiguration.java#140 ``` Potential missing permission check in DescriptorImpl#doFillInfisicalCredentialIdItems ```

Jenkins: Plaintext password storage

You can find detailed information about this finding here.

InfisicalSecretValue.java#17 ``` Field should be reviewed whether it stores a password and is serialized to disk: infisicalKey ```
SingleSecretResponse.java#7 ``` Field should be reviewed whether it stores a password and is serialized to disk: secretKey ```
DanielHougaard commented 3 months ago

/hosting re-check

github-actions[bot] commented 3 months 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

DanielHougaard commented 3 months ago

/hosting re-check

github-actions[bot] commented 3 months 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

DanielHougaard commented 3 months ago

/audit-review

DanielHougaard commented 3 months ago

/request-security-scan

jenkins-cert-app commented 3 months ago

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


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

DanielHougaard commented 3 months ago
mawinter69 commented 3 months ago
  • Docs (README) has been added to the repository.
  • A separate plugin for pipeline support will be raised once this plugin is released, as it will use this plugin as a dependency.

    • I've seen examples of other plugins doing this as well.

Why a separate plugin? It is much more common to have the things for freestyle and pipeline in the same plugin. And wouldn't it be enough to give your buildwrapper and InfisicalSecret a @Symbol annotation on the Descriptor so you can use it in pipeline (just guessing here, never tried this myself for a buildwrapper)?

DanielHougaard commented 3 months ago

Hi @mawinter69, thanks for the clarification. After taking a second look at the docs I totally agree that it would be senseless to create a separate plugin for pipeline support. I've updated the repo to support pipelines!

DanielHougaard commented 3 months ago

@mawinter69 Just following up, did you get to take a look after my update from 2 days ago?

mawinter69 commented 3 months ago

one comment, maybe change the symbol from infisical to withInfisical, similar to e.g. withCredentials

Also if I need to configure infisical in each pipeline, that will cause a lot of duplicate work. Isn't it likely that almost all pipelines will use the same configuration and just need different secrets? So it might be good to provide one or more central configurations that can be reused.

And as it looks as if infisical is providing credentials, I wonder if there is a way to say something like

withCredentials([infisicalSecret(config: configID, path: '/', secretValues: [...]
)]) {
...
}

Just proposal I'm not using infisical (and most likely will never use it)

DanielHougaard commented 3 months ago

Hi @mawinter69, I've updated the infisical symbol to withInfisical.

In regards to the config, it's likely that the environment slug and project slug are unique on a per-job basis. We may release an update in the future, allowing for a more "global" config. For now we're looking to release with the current config implementation.

DanielHougaard commented 3 months ago

Hi again @mawinter69, we're looking to get this done as soon as possible (ideally Monday in the coming week). If you could please let us know how we can proceed that would be great!

mawinter69 commented 3 months ago

I think you have everything to release for now. My suggestions can also be delivered later.

DanielHougaard commented 3 months ago

@mawinter69 Awesome! Please let me know when everything is set up, and I’ll get started with the release:-)

NotMyFault commented 3 months ago

Hey,

I took a brief look over your hosting request and have some feedback for you:

DanielHougaard commented 3 months ago

Hi @NotMyFault, thank you for the feedback! I've implemented all your feedback in the repo.

I have one question/need for clarification:

https://github.com/Infisical/infisical-jenkins/blob/6709df615e40bb23c9667d78c6424b6d807a277a/pom.xml#L44 should always match your jenkins.version specified.

https://github.com/Infisical/infisical-jenkins/commit/de68abd6e4fc7f0898fb8c7a987371f8ac8d1d67

In the commit above I've updated the version as requested. Does it need to be an exact match? Or is it fine to end it with .x like I have in the commit above? Thanks!

NotMyFault commented 3 months ago

Does it need to be an exact match? Or is it fine to end it with .x like I have in the commit above?

The .x is actually part of the artifact name, but the version itself should match your jenkins.version specified :)

NotMyFault commented 3 months ago

/hosting host

jenkins-infra-bot commented 3 months ago

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

A Jira component named [infisical-plugin](https://issues.jenkins.io/issues/?jql=project+%3D+JENKINS+AND+component+%3D+ infisical-plugin)has also been created with danielhougaard as the default assignee for issues.

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!