-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MBUILDCACHE-86] bugfix / enhancements restoration of outputs on disk (…
…#104) * [MBUILDCACHE-86] bugfix/enhancement around restoration on disk - Bugfix / "todo" : files in a base directory containing an underscore were wrongly restored to disk (not at the same location). -> To do so, the path is not guessed anymore from the classifier. I introduced a "filePath" property in the "attachedArtifact" section of the buildinfo.xml file. -> Because the buildInfo structure change, I changed the cache implementation version from "v1" to "v1.1". I assume it was one of the purpose of this value : we don't have to deal with structure migration. Any previous cache entry is defacto invalidated. - Forbid the possibility to extract/restore data in a directory outside the project (like extracting ../../../.ssh for example) -> I guess the extraction part is not a vulnerability since someone with commit permissions can guess other ways to extract data. But the possibility of restoring at any place on the disk looks pretty dangerous to me if a remote cache server is compromised. - Gives the possibility to restore artefacts on disk, with a dedicated property : maven.build.cache.restoreOnDiskArtefacts (default to true, open for discussion) - Introduce "globs" to filter extra attached outputs by filenames. * [MBUILDCACHE-86] Adapt restoration logic to MBUILDCACHE-80 developments + TI Fix javadoc for jdk8
- Loading branch information
Showing
17 changed files
with
472 additions
and
126 deletions.
There are no files selected for viewing
221 changes: 132 additions & 89 deletions
221
src/main/java/org/apache/maven/buildcache/CacheControllerImpl.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/org/apache/maven/buildcache/artifact/OutputType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.maven.buildcache.artifact; | ||
|
||
public enum OutputType { | ||
// generated project artifact | ||
ARTIFACT(""), | ||
// generated source (regular and test) | ||
GENERATED_SOURCE("mvn-cache-ext-generated-source-"), | ||
// any unclassified output added by configuration | ||
EXTRA_OUTPUT("mvn-cache-ext-extra-output-"); | ||
|
||
private String classifierPrefix; | ||
|
||
OutputType(String getClassifierPrefix) { | ||
this.classifierPrefix = getClassifierPrefix; | ||
} | ||
|
||
public String getClassifierPrefix() { | ||
return classifierPrefix; | ||
} | ||
|
||
public static OutputType fromClassifier(String classifier) { | ||
if (classifier != null) { | ||
if (classifier.startsWith(GENERATED_SOURCE.classifierPrefix)) { | ||
return GENERATED_SOURCE; | ||
} else if (classifier.startsWith(EXTRA_OUTPUT.classifierPrefix)) { | ||
return EXTRA_OUTPUT; | ||
} | ||
} | ||
return ARTIFACT; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.