Skip to content

Commit e8e613f

Browse files
kwwalldavewichers
andauthored
Prep 2.2.1.0 (#557)
* Delete the release notes that prevents me from doing a 'git pull origin' from my fork. * Add note referring to minimal Java 7 baseline. * Close #542 - final release notes for 2.2.1.0. * Close #556 - Add some final additional 'see also' refs. * Close #554 * Close #555 * Added issue 521 which should have been closed per PR 535. Issue now closed. * Close #558 * Update to reflect fix to issue #558 * Find/fix dependency causing java.lang.OutOfMemoryError: PermGen space that only occurs on Mac with Java 7. Apparently it was the surefire plugin. Co-authored-by: davewichers <[email protected]>
1 parent b6f8808 commit e8e613f

File tree

9 files changed

+234
-65
lines changed

9 files changed

+234
-65
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ OWASP® ESAPI (The OWASP Enterprise Security API) is a free, open source, web ap
1717
# What does Legacy mean?
1818
<p>This is the legacy branch of ESAPI which means it is an actively maintained branch of the project, however feature development for this branch will not be done. Features that have already been scheduled for the 2.x branch will move forward, but the main focus will be working on the ESAPI 3.x branch.
1919

20-
<b>IMPORTANT NOTE:</b>
20+
<b>IMPORTANT NOTES:</b>
2121
The default branch for ESAPI legacy is now the 'develop' branch (rather than the 'master' branch), where future development, bug fixes, etc. will now be done. The 'master' branch is now marked as "protected"; it reflects the latest stable ESAPI release (2.1.0.1 as of this date). Note that this change of making the 'develop' branch the default may affect any pull requests that you were intending to make.
2222

23+
Also, the <i>minimal</i> baseline Java version to use ESAPI is Java 7. (This was changed from Java 6 during the 2.2.0.0 release.)
24+
2325
# Where can I find ESAPI 3.x?
2426
https://github.com/ESAPI/esapi-java
2527

documentation/esapi4java-core-2.2.1.0-release-notes.txt

Lines changed: 197 additions & 56 deletions
Large diffs are not rendered by default.

pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@
135135
<version.jmh>1.23</version.jmh>
136136
<version.powermock>2.0.7</version.powermock>
137137
<version.spotbugs>4.0.4</version.spotbugs>
138-
<version.surefire>3.0.0-M5</version.surefire>
138+
<!-- Upgrading to 3.0.0-M3+ causes this test case error:
139+
org.owasp.esapi.reference.DefaultValidatorInputStringAPITest.getValidInputNullAllowedPassthrough Time elapsed: 2.057 s <<< ERROR!
140+
java.lang.OutOfMemoryError: PermGen space -->
141+
<version.surefire>3.0.0-M2</version.surefire>
139142
</properties>
140143

141144
<dependencies>

src/main/java/org/owasp/esapi/Encoder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@
149149
* </li>
150150
* </ul>
151151
*
152+
* @see <a href="https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html">OWASP Cross-Site Scripting Prevention Cheat Sheet</a>.
153+
* @see <a href="https://owasp.org/www-project-proactive-controls/v3/en/c4-encode-escape-data">OWASP Proactive Controls: C4: Encode and Escape Data</a>
154+
* @see <a href="https://www.onwebsecurity.com/security/properly-encoding-and-escaping-for-the-web.html">Properly encoding and escaping for the web.</a>
152155
* @author Jeff Williams (jeff.williams .at. aspectsecurity.com) <a
153156
* href="http://www.aspectsecurity.com">Aspect Security</a>
154157
* @since June 1, 2007

src/main/java/org/owasp/esapi/crypto/CryptoHelper.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,15 @@ public static void copyByteArray(final byte[] src, byte[] dest)
352352
*/
353353
@Deprecated
354354
public static boolean arrayCompare(byte[] b1, byte[] b2) {
355-
// Note: See GitHub issue #246
355+
// Note: See GitHub issue #246 and #554.
356+
// If we make Java 8 the minimal ESAPI baseline before we remove this
357+
// method, we can at least remove these next 6 lines. (Issue 554.)
358+
if ( b1 == null && b2 == null ) { // Must test this first!
359+
return true; // Prevent NPE; compatibility with Java 8 and later.
360+
}
361+
if ( b1 == null || b2 == null ) {
362+
return false; // Prevent NPE; compatibility with Java 8 and later.
363+
}
356364
return java.security.MessageDigest.isEqual(b1, b2);
357365
}
358366

src/test/java/org/owasp/esapi/crypto/CryptoHelperTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ public final void testArrayCompare() {
131131
// stop = System.nanoTime();
132132
// diff = stop - start;
133133
// System.out.println("diff: " + diff + " nanosec");
134-
134+
135+
// start = System.nanoTime();
136+
assertFalse(CryptoHelper.arrayCompare(null, ba1));
137+
// stop = System.nanoTime();
138+
// diff = stop - start;
139+
// System.out.println("diff: " + diff + " nanosec");
140+
135141
ba2 = ba1;
136142
// start = System.nanoTime();
137143
assertTrue(CryptoHelper.arrayCompare(ba1, ba2));
@@ -186,4 +192,4 @@ private boolean checkByteArray(byte[] ba, byte b) {
186192
public static junit.framework.Test suite() {
187193
return new JUnit4TestAdapter(CryptoHelperTest.class);
188194
}
189-
}
195+
}

src/test/java/org/owasp/esapi/reference/AccessControllerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public void testIsAuthorizedForData() {
226226
userRW = Class.forName("java.lang.String");
227227
anyR = Class.forName("java.io.BufferedReader");
228228
userAdminR = Class.forName("java.util.Random");
229-
userAdminRW = Class.forName("java.awt.event.MouseWheelEvent");
229+
userAdminRW = Class.forName("javax.crypto.Cipher");
230230
undefined = Class.forName("java.io.FileWriter");
231231

232232
}catch(ClassNotFoundException cnf){

src/test/java/org/owasp/esapi/reference/ValidatorTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,13 @@ public void testIsValidDirectoryPath() throws IOException {
350350

351351
// Unix specific paths should pass
352352
assertTrue(instance.isValidDirectoryPath("test", "/", parent, false)); // Root directory
353-
assertTrue(instance.isValidDirectoryPath("test", "/etc", parent, false)); // Always exist directory
353+
// Unfortunately, on MacOS both "/etc" and "/var" are symlinks
354+
// to "/private/etc" and "/private/var" respectively, and "/sbin"
355+
// and "/bin" sometimes are symlinks on certain *nix OSs, so we need
356+
// to special case MacOS here.
357+
boolean isMac = System.getProperty("os.name").toLowerCase().contains("mac");
358+
String testDirNotSymLink = isMac ? "/private" : "/etc";
359+
assertTrue(instance.isValidDirectoryPath("test", testDirNotSymLink, parent, false)); // Always exist directory
354360

355361
// Unix specific paths that should not exist or work
356362
assertFalse(instance.isValidDirectoryPath("test", "/bin/sh", parent, false)); // Standard shell, not dir

src/test/resources/esapi/fbac-policies/DataAccessRules.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ java.io.BufferedReader | any | read | default deny
44
java.lang.String | User | read, write |
55
java.lang.Math | Admin | read, write |
66
java.util.ArrayList | Admin | read |
7-
java.awt.event.MouseWheelEvent | Admin, User | write, read |
7+
javax.crypto.Cipher | Admin, User | write, read |
88
java.util.Date | User | write |
9-
java.util.Random | User, Admin | read |
9+
java.util.Random | User, Admin | read |

0 commit comments

Comments
 (0)