MDKF
MDKF

Reputation: 25

Prevent Jenkins Job from escaping the workspace

A developer committed a makefile with an output path of ....\SomeDir. When the project was built the output was dumped into Jenkins_Home. Is there any way to fail a build if it attempts to escape the workspace directory? Thanks, -Michael

Upvotes: 1

Views: 570

Answers (2)

Barnaby Golden
Barnaby Golden

Reputation: 4124

Worth putting some strong write permissions in place. Make sure that the user that Jenkins runs as only has permission to write to Jenkins_Home and its subdirectories.

You could also make sure that directories under Jenkins_Home only have write permission if it is necessary (workspace, for logging, etc.)

If a makefile attempts to use an absolute path then the build should fail with a permissions error.

Upvotes: 1

23ars
23ars

Reputation: 648

I think the solution is that, before running the command, to do a change directory to workspace. If you have the workspace set up, then you can write something like cd $WORKSPACE or cd %WORKSPACE% ( for batch commands).

Upvotes: 0

Related Questions