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

Quality of Life/Efficiency/Security Changes #21

Merged
merged 5 commits into from
Mar 7, 2024

Conversation

patrikcerbak
Copy link
Collaborator

Quality of Life/Efficiency/Security Changes

From the outside, nothing changes/nothing breaks (hopefully). No new arguments were added, no anything, just inside changes.

Separating filtering jobs from filtering builds

Till now, when the user wanted to filter the jobs with --job-config-find, the filtering was done in the Builds.java class together when filtering individual builds of all jobs - this was really unnecessarily inefficient.

I decided to create a class JobConfigFilter whose aim is to filter the jobs when user uses --job-config-find and Builds.java then gets the already filtered subset, so it can only filter the builds of the matched jobs (not all jobs like before), so it should be quicker.

Everything stays the same, no new command line switch was added, the results of the filtering are still the same, just faster.

Updated Jenkins help

As the heading says, I added two lines to help :)

Reworked the detection of escaping parent directory

Now, instead of checking with regex whether the file location is using ../, there is a new static method ConfigFinder.checkIfConfigIsInParent(), which checks if a config file is inside a given parent directory and if not, it throws an exception. This method is then used where it makes sense before creating new ConfigFinder -> BuildReportExtendedPlugin.java, Builds.java, JobConfigFilter.java.

@patrikcerbak patrikcerbak requested a review from a team as a code owner March 6, 2024 14:55
@judovana
Copy link
Contributor

judovana commented Mar 7, 2024

Hi! Nice job. Can you please add tests for the directory escaping?

@judovana
Copy link
Contributor

judovana commented Mar 7, 2024

pls, fix the test. Create the directory strucutre @beforeach and/or @before - as you will see it suitable.
Put all passing tests to one @org.junit.Test and the failing, each to ech own methd @org.junit.Test(expects exception.class) (I'm not sure with proepr wording, but you will find. TY!

Whether to move it to its own file or not, is up to you. TY@!

@judovana judovana merged commit a03bf73 into jenkinsci:master Mar 7, 2024
0 of 2 checks passed
@patrikcerbak patrikcerbak deleted the qol-changes branch March 13, 2024 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants