1
2
3
4
5
6
7
8
9
10
11
12
13
14 package org.codehaus.plexus.archiver.filters;
15
16 import javax.annotation.Nonnull;
17 import javax.inject.Named;
18 import javax.inject.Singleton;
19
20 import java.io.IOException;
21
22 import org.codehaus.plexus.components.io.fileselectors.FileInfo;
23 import org.codehaus.plexus.components.io.fileselectors.FileSelector;
24 import org.codehaus.plexus.util.SelectorUtils;
25
26
27
28
29 @Singleton
30 @Named("jar-security")
31 public class JarSecurityFileSelector implements FileSelector {
32 public static final String[] SECURITY_FILE_PATTERNS = {
33 "META-INF/*.RSA",
34 "META-INF/*.DSA",
35 "META-INF/*.SF",
36 "META-INF/*.EC",
37 "META-INF/*.rsa",
38 "META-INF/*.dsa",
39 "META-INF/*.sf",
40 "META-INF/*.ec"
41 };
42
43 @Override
44 public boolean isSelected(@Nonnull FileInfo fileInfo) throws IOException {
45 String name = fileInfo.getName();
46
47 for (String pattern : SECURITY_FILE_PATTERNS) {
48 if (SelectorUtils.match(pattern, name)) {
49 return false;
50 }
51 }
52
53 return true;
54 }
55 }