tusury / vt-middleware

Automatically exported from code.google.com/p/vt-middleware
0 stars 0 forks source link

vt-password: AlphabeticalSequenceRule a to z #221

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
    @Test
    public void testDescSequence() {
        // Given
        Rule rule = new AlphabeticalSequenceRule(3, false);

        // When
        RuleResult result1 = rule.validate(new PasswordData(new Password("cba")));
        RuleResult result2 = rule.validate(new PasswordData(new Password("dcb")));
        RuleResult result3 = rule.validate(new PasswordData(new Password("xyz")));
        RuleResult result4 = rule.validate(new PasswordData(new Password("vxy")));

        // Then
        assertEquals(result1.isValid(), result2.isValid());
        assertEquals(result3.isValid(), result4.isValid());
    }

What is the expected output? What do you see instead?

Expected:
"cba" and "dcb" to be both valid or invalid.
"xyz" and "vxy" to be both valid or invalid.

Actually:
When ending with 'a' or 'z' It's not considered a sequence.

What version of the product are you using? On what operating system?
<groupId>edu.vt.middleware</groupId>
<artifactId>vt-password</artifactId>
<version>3.1.2</version>

Please provide any additional information below.

Original issue reported on code.google.com by gabbe...@gmail.com on 25 Jul 2014 at 10:14

GoogleCodeExporter commented 8 years ago
Looks like the lower bounds checking has a bug when the sequence ends at the 0 
index.
Patch forthcoming...

Original comment by dfis...@gmail.com on 28 Jul 2014 at 4:19

GoogleCodeExporter commented 8 years ago
Change lower bound to -1 if not wrapping since bounds checking is exclusive.
Add unit test to check boundary forwards and backwards.
Fixed in r3036.

Original comment by dfis...@gmail.com on 29 Jul 2014 at 2:59