|
| 1 | +/** |
| 2 | + * This class will always be the base (entry-point) of synthetic |
| 3 | + * taint-flow in the test logic. The level number indicates the |
| 4 | + * level the class belongs to in the taint-flow graph hierarchy. |
| 5 | + */ |
| 6 | +public class AnalyzeMeLevel1 { |
| 7 | + |
| 8 | + /// Start: Taint-flow elements definition. |
| 9 | + |
| 10 | + public int getSecret() { return 42; } |
| 11 | + public void publish(int number) { System.out.print(number); } |
| 12 | + public int sanatizer(int number) { return number = 0; } |
| 13 | + public int propogator(int number) { return number; } |
| 14 | + |
| 15 | + /// End: Taint-flow elements definition. |
| 16 | + |
| 17 | + |
| 18 | + /// Start: Intra-type taint-flow definitions. |
| 19 | + |
| 20 | + /* |
| 21 | + * Simple taint-flow without any issue. |
| 22 | + */ |
| 23 | + public void workNoIssue() { |
| 24 | + int secret = getSecret(); |
| 25 | + publish(10); |
| 26 | + } |
| 27 | + |
| 28 | + /* |
| 29 | + * Taint-flow without any issue. |
| 30 | + */ |
| 31 | + public void workNoIssueSanitizer() { |
| 32 | + int secret = getSecret(); |
| 33 | + secret = sanatizer(secret); |
| 34 | + publish(secret); |
| 35 | + } |
| 36 | + |
| 37 | + /* |
| 38 | + * Taint-flow without any issue. |
| 39 | + */ |
| 40 | + public void workNoIssueSanitizerProgator() { |
| 41 | + int secret = getSecret(); |
| 42 | + secret = sanatizer(secret); |
| 43 | + secret = propogator(secret); |
| 44 | + publish(secret); |
| 45 | + } |
| 46 | + |
| 47 | + /* |
| 48 | + * Simple taint-flow with issue. |
| 49 | + */ |
| 50 | + public void workWithIssue() { |
| 51 | + int secret = getSecret(); |
| 52 | + publish(secret); |
| 53 | + } |
| 54 | + |
| 55 | + /* |
| 56 | + * Simple taint-flow with issue from the parameter. |
| 57 | + */ |
| 58 | + public void workWithIssueParam(int secret) { |
| 59 | + publish(secret); |
| 60 | + } |
| 61 | + |
| 62 | + |
| 63 | + /* |
| 64 | + * Taint-flow with issue using a Propogator. |
| 65 | + */ |
| 66 | + public void workWithIssueProgator() { |
| 67 | + int secret = getSecret(); |
| 68 | + secret = propogator(secret); |
| 69 | + publish(secret); |
| 70 | + } |
| 71 | + |
| 72 | + /* |
| 73 | + * Taint-flow with issue using the Propogator and |
| 74 | + * the Parameter. |
| 75 | + */ |
| 76 | + public void workWithIssueProgatorParam(int secret){ |
| 77 | + secret = propogator(secret); |
| 78 | + publish(secret); |
| 79 | + } |
| 80 | + |
| 81 | + /// End: Intra-type taint-flow definitions. |
| 82 | + |
| 83 | + |
| 84 | + /// Start: Inter-type taint-flow definitions. |
| 85 | + |
| 86 | + /* |
| 87 | + * Simple 2-level taint-flow with a direct issue. |
| 88 | + */ |
| 89 | + public void workWithOtherTypeIssue() { |
| 90 | + AnalyzeMeLevel2 level2Instance = new AnalyzeMeLevel2(); |
| 91 | + int secret = level2Instance.getSecret(); |
| 92 | + level2Instance.publish(secret); |
| 93 | + } |
| 94 | + |
| 95 | + /* |
| 96 | + * Simple 2-level taint-flow with a direct issue |
| 97 | + * using the Parameter. |
| 98 | + */ |
| 99 | + public void workWithOtherTypeIssueParam(int secret) { |
| 100 | + AnalyzeMeLevel2 level2Instance = new AnalyzeMeLevel2(); |
| 101 | + level2Instance.publish(secret); |
| 102 | + } |
| 103 | + |
| 104 | + /* |
| 105 | + * 2-level taint-flow with a direct issue using |
| 106 | + * the Propogator. |
| 107 | + */ |
| 108 | + public void workWithOtherTypeIssueProgator() { |
| 109 | + AnalyzeMeLevel2 level2Instance = new AnalyzeMeLevel2(); |
| 110 | + int secret = level2Instance.getSecret(); |
| 111 | + secret = level2Instance.propogator(secret); |
| 112 | + level2Instance.publish(secret); |
| 113 | + } |
| 114 | + |
| 115 | + /* |
| 116 | + * 2-level taint-flow with a direct issue using |
| 117 | + * the Propogator and the Parameter. |
| 118 | + */ |
| 119 | + public void workWithOtherTypeIssueProgatorParam(int secret){ |
| 120 | + AnalyzeMeLevel2 level2Instance = new AnalyzeMeLevel2(); |
| 121 | + secret = level2Instance.propogator(secret); |
| 122 | + level2Instance.publish(secret); |
| 123 | + } |
| 124 | + |
| 125 | + /* |
| 126 | + * Simple 2-level taint-flow with an indirect |
| 127 | + * call with no issue. |
| 128 | + */ |
| 129 | + public void workWithOtherTypeIndirectNoIssue() { |
| 130 | + AnalyzeMeLevel2 level2Instance = new AnalyzeMeLevel2(); |
| 131 | + int secret = level2Instance.getSecret(); |
| 132 | + level2Instance.indirectNoIssue(secret); |
| 133 | + } |
| 134 | + |
| 135 | + /* |
| 136 | + * 2-level taint-flow with an indirect issue. |
| 137 | + */ |
| 138 | + public void workWithOtherTypeIndirectIssue() { |
| 139 | + AnalyzeMeLevel2 level2Instance = new AnalyzeMeLevel2(); |
| 140 | + int secret = level2Instance.getSecret(); |
| 141 | + level2Instance.indirectIssue(secret); |
| 142 | + } |
| 143 | + |
| 144 | + /* |
| 145 | + * 2-level taint-flow with an indirect issue |
| 146 | + * using the Porpogator and the Sanitizer. |
| 147 | + */ |
| 148 | + public void workWithOtherTypeIndirectSantNoIssue() { |
| 149 | + AnalyzeMeLevel2 level2Instance = new AnalyzeMeLevel2(); |
| 150 | + int secret = level2Instance.getSecret(); |
| 151 | + level2Instance.indirectSanitizerNoIssue(secret); |
| 152 | + } |
| 153 | + |
| 154 | + /* |
| 155 | + * 2-level taint-flow with an indirect issue |
| 156 | + * using the Porpogator and the Sanitizer. |
| 157 | + */ |
| 158 | + public void workWithOtherTypeIndirectSantPropIssue() { |
| 159 | + AnalyzeMeLevel2 level2Instance = new AnalyzeMeLevel2(); |
| 160 | + int secret = level2Instance.getSecret(); |
| 161 | + level2Instance.indirectSanitizerPropogatorIssue(secret); |
| 162 | + } |
| 163 | + |
| 164 | + /// End: Inter-type taint-flow definitions. |
| 165 | +} |
0 commit comments