You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2018/03/16 21:23:11 UTC

allura git commit: [#8186] Makes antispam time window configurable

Repository: allura
Updated Branches:
  refs/heads/master aae367803 -> 2c3a9e8e9


[#8186] Makes antispam time window configurable


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/2c3a9e8e
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/2c3a9e8e
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/2c3a9e8e

Branch: refs/heads/master
Commit: 2c3a9e8e969995007909c490cf8ffab7055c3551
Parents: aae3678
Author: Kenton Taylor <kt...@slashdotmedia.com>
Authored: Wed Feb 21 12:32:47 2018 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Fri Mar 16 16:51:19 2018 -0400

----------------------------------------------------------------------
 Allura/allura/lib/utils.py        | 2 +-
 Allura/allura/tests/test_utils.py | 2 +-
 Allura/development.ini            | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/2c3a9e8e/Allura/allura/lib/utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index 08b2695..1ec7f6a 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -371,7 +371,7 @@ class AntiSpam(object):
                     now = time.time()
                 if obj.timestamp > now + 5:
                     raise ValueError('Post from the future')
-                if now - obj.timestamp > 24 * 60 * 60:
+                if now - obj.timestamp > int(pylons.config.get('spam.form_post_expiration', 24 * 60 * 60)):
                     raise ValueError('Post from the distant past')
                 if obj.spinner != expected_spinner:
                     raise ValueError('Bad spinner value')

http://git-wip-us.apache.org/repos/asf/allura/blob/2c3a9e8e/Allura/allura/tests/test_utils.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_utils.py b/Allura/allura/tests/test_utils.py
index 0a466cc..711bfe4 100644
--- a/Allura/allura/tests/test_utils.py
+++ b/Allura/allura/tests/test_utils.py
@@ -120,7 +120,7 @@ class TestAntispam(unittest.TestCase):
         self.assertRaises(
             ValueError,
             utils.AntiSpam.validate_request,
-            r, now=time.time() + 24 * 60 * 60 + 1)
+            r, now=time.time() + 24 * 60 * 60 * 4 + 1)
 
     def test_valid_submit(self):
         form = dict(a='1', b='2')

http://git-wip-us.apache.org/repos/asf/allura/blob/2c3a9e8e/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index a5f6ddf..1831128 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -247,6 +247,7 @@ site_admin_project_nbhd = Projects
 ; for stopforumspam, should be a listed_ip_*_all.txt file
 ;spam.stopforumspam.ip_addr_file =
 ;spam.stopforumspam.threshold = 20
+spam.form_post_expiration = 345600 ; 4 days
 
 ; Phone verification service: Nexmo Verify
 ; phone.method = nexmo