Test-More / TB2

Test::Builder version 2, the next generation of building testing modules in Perl
Other
1 stars 0 forks source link

Make sure TB2::History isn't vulnerable to test count flooding. #91

Closed schwernbot closed 10 years ago

schwernbot commented 10 years ago

From: @schwern Date: Sunday Jun 27, 2010 at 19:03 GMT Orig: https://github.com/Test-More/test-more/issues/37

Consider

ok 1
ok 123456789

If history is stored as an array, this will create a huge array. History should be stored as a hash to avoid a DOS attack.

schwernbot commented 10 years ago

From: @notbenh Date: Friday Sep 10, 2010 at 21:16 GMT Orig: https://github.com/Test-More/test-more/issues/37#issuecomment-400183

I could be missing something but if the result already has the test number why even bother with the whole _overlay idea? In the example above I would expect to see something like:

$history->results; # [ { test_number => 1, ...} , { test_number => 123456789, ...} ]

This would also solve the other issue about duplicate numbered tests as you really just don't care at the time of storage, shove them on the stack in the order that you collect them. Then if the formatter cares it can sort them by number and deal with it then.

schwernbot commented 10 years ago

From: @schwern Date: Friday Sep 10, 2010 at 23:58 GMT Orig: https://github.com/Test-More/test-more/issues/37#issuecomment-400352

I agree.

_overlay and having a counter in History is a hold over from Test::Builder and how its hard-wired to TAP. I think I bunged them in when I was switching over Test::Builder to use History.

Now that the Formatter is responsible, _overlay can go away and the counter moved into the Formatter. The Formatter can take care of setting test_number and even store its own index if we find it necessary.

That leaves the question of a way to manipulate history. Test::Builder supports it, so I guess it has to be in there somewhere, but probably as a method separate from add_test_history(). That turns add_test_history() into essentially a push on $history->results. Nice and simple.

schwernbot commented 10 years ago

From: @schwern Date: Saturday Sep 11, 2010 at 02:09 GMT Orig: https://github.com/Test-More/test-more/issues/37#issuecomment-400507

This should also solve http://github.com/schwern/test-more/issues/#issue/25

schwernbot commented 10 years ago

From: @notbenh Date: Monday Sep 13, 2010 at 14:40 GMT Orig: https://github.com/Test-More/test-more/issues/37#issuecomment-403911

Last week I started simplifying the history idea, but I've lost track of where I'm at and theres been a few more ideas that have been added to the list that kinda wrapped up what I was thinking (specifically #69, #70, #71). I'll try and take another stab at things again.

schwernbot commented 10 years ago

From: @notbenh Date: Monday Sep 13, 2010 at 20:09 GMT Orig: https://github.com/Test-More/test-more/issues/37#issuecomment-404591

Demo of what I was thinking posted:

http://github.com/schwern/test-more/blob/TB2-history-benh/lib/Test/Builder2/HistoryStack.pm

Currently addresses many of the listed items around the History concept or at least build a platform to work from. I've noted this on all the issues that I think would be effected.

schwernbot commented 10 years ago

From: @schwern Date: Thursday Oct 07, 2010 at 19:41 GMT Orig: https://github.com/Test-More/test-more/issues/37#issuecomment-454724

Solved by notbenh's recently merged TB2-history-notbenh branch. Results are now pushed into an array without regard to the test number. Only the Formatter cares about the test number.