-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
When running our own initializr in an Openshift namespace, we have default openshift SCC's active that require standard apps to run with a random userId within a given range. However this range is by default higher than the maximum value (=2097151)
When running, the tgz creation through REST endpoint, we're seeing following error:
java.lang.IllegalArgumentException: user id 'replaced' is too big ( > 2097151 ).
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.failForBigNumber(TarArchiveOutputStream.java:406) ~[commons-compress-1.23.0.jar:1.23.0]
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.failForBigNumber(TarArchiveOutputStream.java:400) ~[commons-compress-1.23.0.jar:1.23.0]
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.failForBigNumbers(TarArchiveOutputStream.java:418) ~[commons-compress-1.23.0.jar:1.23.0]
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.putArchiveEntry(TarArchiveOutputStream.java:592) ~[commons-compress-1.23.0.jar:1.23.0]
at io.spring.initializr.web.controller.ProjectGenerationController.lambda$createArchive$1(ProjectGenerationController.java:168) ~[initializr-web-0.20.1.jar:na]
When searching we discovered similar issues in testcontainers and docker-maven-plugin with both very similar fixes: Setting the posix BigNumberMode (testcontainers and plugin)
Looking at the stacktrace, I found this snippet which does not set it.
Lines 147 to 149 in bac7d31
TarArchiveOutputStream out = new TarArchiveOutputStream(new GzipCompressorOutputStream(output)); | |
out.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); | |
return out; |
After adding out.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
, it is working fine.
Unfortunately this is part of a private method in the abstract class, and overridding it requires a lot of the other methods (all private) to be overridden also. Starting from the exposed controller method, all methods need overriding for this adoption.
I think we could either make it protected or add the big filenumberMode by default? Or can we somehow feed it as a property?