forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAK-32068 Extract local part from BATV addresses. (sakaiproject#3740)
Some mail systems protect FROM envelope addresses by signing them using BATV, this means that the FROM address can no longer be directly used to check who the sender is. This change strips out any private BATV signatures from the local part. We could try to be more generic and strip out more BATV possible tags but then we run the risk of stripping something we shouldn’t. Doing it this was allows us to still do envelope time rejection but not reject BATV signed messages. Supported formats are: [email protected] [email protected]
- Loading branch information
Showing
2 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,30 @@ public void testGood() { | |
assertEquals("example.com", email.getDomain()); | ||
} | ||
|
||
@Test | ||
public void testBATVGood() { | ||
// Check that our batv parsing works. | ||
SplitEmailAddress email = SplitEmailAddress.parse("[email protected]"); | ||
assertEquals("me", email.getLocal()); | ||
assertEquals("example.com", email.getDomain()); | ||
} | ||
|
||
@Test | ||
public void testBATVBad() { | ||
// Check that our batv parsing is strict along the lines of the RFC | ||
SplitEmailAddress email = SplitEmailAddress.parse("[email protected]"); | ||
assertEquals("prvs=aaaaaaaaaa=me", email.getLocal()); | ||
assertEquals("example.com", email.getDomain()); | ||
} | ||
|
||
@Test | ||
public void testBATVSubAddress() { | ||
// Check that we also catch the subaddressing style. | ||
SplitEmailAddress email = SplitEmailAddress.parse("[email protected]"); | ||
assertEquals("me", email.getLocal()); | ||
assertEquals("example.com", email.getDomain()); | ||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void testNoAt() { | ||
SplitEmailAddress email = SplitEmailAddress.parse("notavalidemail"); | ||
|