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

Sanitise parameters #873

Merged
merged 1 commit into from
Jan 8, 2024
Merged

Sanitise parameters #873

merged 1 commit into from
Jan 8, 2024

Conversation

sxa
Copy link
Member

@sxa sxa commented Jan 4, 2024

This PR will trap potentially dangerous characters before passing them to a shell operation within the groovy pipelines. Noting that some dodgy characters are trapped elsewhere (but doing it here makes it explicit in case other places are missed):

15:45:46  Execution error: ERROR: Name must follow the pattern '^[a-zA-Z0-9]+((\.|_|__|-+)[a-zA-Z0-9]+)*$'
[Pipeline] echo
15:45:46  ERROR: Name must follow the pattern '^[a-zA-Z0-9]+((\.|_|__|-+)[a-zA-Z0-9]+)*$'

If the docker image parameter has nonsense in it.
Also VARIANT will get trapped and abort in make-adopt-build-farm.sh if it's not in a defined list: 16:29:19 + ./build-farm/make-adopt-build-farm.sh 16:29:19 [ERROR] hot$pot is not a recognised build variant. Valid Variants = hotspot temurin openj9 corretto SapMachine dragonwell fast_startup bisheng

Ref TOB_TEMURIN_17

Preferred future solution would be to avoid using sh where possible to reduce the risk of shell escapes, but this should be good as an interim solution.

Copy link

github-actions bot commented Jan 4, 2024

Thank you for creating a pull request!

Please check out the information below if you have not made a pull request here before (or if you need a reminder how things work).

Code Quality and Contributing Guidelines

If you have not done so already, please familiarise yourself with our Contributing Guidelines and Code Of Conduct, even if you have contributed before.

Tests

Github actions will run a set of jobs against your PR that will lint and unit test your changes. Keep an eye out for the results from these on the latest commit you submitted. For more information, please see our testing documentation.

In order to run the advanced pipeline tests (executing a set of mock pipelines), it requires an admin to post run tests on this PR.
If you are not an admin, please ask for one's attention in #infrastructure on Slack or ping one here.
To run full set of tests, use "run tests"; a subset of tests on specific jdk version, use "run tests quick 11,21"

@karianna
Copy link
Contributor

karianna commented Jan 4, 2024

@sxa Can you rebase? That should fix CI checks

@sxa
Copy link
Member Author

sxa commented Jan 5, 2024

@sxa Can you rebase? That should fix CI checks

Hmmm I think it is up to date - a rebase locally isn't pucking up anything new and my branch includes the "2nd attmpt" commit. The error seems to be:

> Task :test FAILED
file or directory '/home/runner/work/ci-jenkins-pipelines/ci-jenkins-pipelines/pipelines/target/classes/java/test', not found

FAILURE: Build failed with an exception.

It's that something that you would expect to be fixed by a rebase?

@github-actions github-actions bot added the gradle label Jan 5, 2024
@sxa
Copy link
Member Author

sxa commented Jan 5, 2024

@sxa Can you rebase? That should fix CI checks

I've puilled in your commit from pending PR #871 and that seems to have allowed the checks to pass. Since they're not yet merged upstream I'm now going to remove them from this PR again, but that should be enough to prove that this PR is good.

Copy link
Contributor

@steelhead31 steelhead31 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sxa sxa merged commit 8f12123 into adoptium:master Jan 8, 2024
11 of 13 checks passed
AdamBrousseau pushed a commit to ibmruntimes/ci-jenkins-pipelines that referenced this pull request Jan 8, 2024
@AdamBrousseau
Copy link
Contributor

AdamBrousseau commented Jan 8, 2024

I'm caught up on the aqa branch regex. We have an aqa release branch named j9.0.42-release for a release build that just got caught on this. I started looking at the regex but I'm failing to see how the it works for any of the aqa branches. Unless I'm misunderstanding or missing something. I also tried master and v0.9.9-release and both fail.

Edit: Perhaps we're just missing the * in the first and last sets?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants