allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject allura git commit: [#8186] Makes antispam time window configurable
Date Wed, 21 Feb 2018 17:33:23 GMT
Repository: allura
Updated Branches:
  refs/heads/kt/8186 [created] 44d6b5a2f


[#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/44d6b5a2
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/44d6b5a2
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/44d6b5a2

Branch: refs/heads/kt/8186
Commit: 44d6b5a2f9a4cec1a53296c721cddd654f9788f7
Parents: 090e5c3
Author: Kenton Taylor <ktaylor@slashdotmedia.com>
Authored: Wed Feb 21 12:32:47 2018 -0500
Committer: Kenton Taylor <ktaylor@slashdotmedia.com>
Committed: Wed Feb 21 12:32:47 2018 -0500

----------------------------------------------------------------------
 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/44d6b5a2/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/44d6b5a2/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/44d6b5a2/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index cd5404e..1b7be29 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -244,6 +244,7 @@ site_admin_project_nbhd = Projects
 ; for mollom:
 ;spam.public_key =
 ;spam.private_key =
+spam.form_post_expiration = 345600 ; 4 days
 
 ; Phone verification service: Nexmo Verify
 ; phone.method = nexmo


Mime
View raw message