|
16 | 16 |
|
17 | 17 | package com.google.errorprone.bugpatterns;
|
18 | 18 |
|
| 19 | +import static com.google.errorprone.bugpatterns.SerializableReads.BANNED_OBJECT_INPUT_STREAM_METHODS; |
19 | 20 | import static com.google.errorprone.matchers.Matchers.allOf;
|
20 | 21 | import static com.google.errorprone.matchers.Matchers.anyOf;
|
21 | 22 | import static com.google.errorprone.matchers.Matchers.enclosingClass;
|
|
25 | 26 | import static com.google.errorprone.matchers.Matchers.methodIsNamed;
|
26 | 27 | import static com.google.errorprone.matchers.Matchers.not;
|
27 | 28 |
|
28 |
| -import com.google.common.collect.ImmutableSet; |
29 | 29 | import com.google.errorprone.BugPattern;
|
30 | 30 | import com.google.errorprone.BugPattern.SeverityLevel;
|
31 | 31 | import com.google.errorprone.VisitorState;
|
|
41 | 41 | severity = SeverityLevel.ERROR)
|
42 | 42 | public final class BanSerializableRead extends BugChecker implements MethodInvocationTreeMatcher {
|
43 | 43 |
|
44 |
| - private static final ImmutableSet<String> BANNED_OBJECT_INPUT_STREAM_METHODS = |
45 |
| - ImmutableSet.of( |
46 |
| - // Prevent reading objects unsafely into memory |
47 |
| - "readObject", |
48 |
| - |
49 |
| - // This is the same, the default value |
50 |
| - "defaultReadObject", |
51 |
| - |
52 |
| - // This is for trusted subclasses |
53 |
| - "readObjectOverride", |
54 |
| - |
55 |
| - // Ultimately, a lot of the safety worries come |
56 |
| - // from being able to construct arbitrary classes via |
57 |
| - // reading in class descriptors. I don't think anyone |
58 |
| - // will bother calling this directly, but I don't see |
59 |
| - // any reason not to block it. |
60 |
| - "readClassDescriptor", |
61 |
| - |
62 |
| - // These are basically the same as above |
63 |
| - "resolveClass", |
64 |
| - "resolveObject"); |
65 |
| - |
66 | 44 | private static final Matcher<ExpressionTree> EXEMPT =
|
67 | 45 | anyOf(
|
68 | 46 | // This is called through ObjectInputStream; a call further up the callstack will have
|
|
0 commit comments