Show More
@@ -405,19 +405,6 b'' | |||||
405 | license = [ pkgs.lib.licenses.mit ]; |
|
405 | license = [ pkgs.lib.licenses.mit ]; | |
406 | }; |
|
406 | }; | |
407 | }; |
|
407 | }; | |
408 | backport-ipaddress = super.buildPythonPackage { |
|
|||
409 | name = "backport-ipaddress-0.1"; |
|
|||
410 | buildInputs = with self; []; |
|
|||
411 | doCheck = false; |
|
|||
412 | propagatedBuildInputs = with self; []; |
|
|||
413 | src = fetchurl { |
|
|||
414 | url = "https://pypi.python.org/packages/d3/30/54c6dab05a4dec44db25ff309f1fbb6b7a8bde3f2bade38bb9da67bbab8f/backport_ipaddress-0.1.tar.gz"; |
|
|||
415 | md5 = "9c1f45f4361f71b124d7293a60006c05"; |
|
|||
416 | }; |
|
|||
417 | meta = { |
|
|||
418 | license = [ pkgs.lib.licenses.psfl ]; |
|
|||
419 | }; |
|
|||
420 | }; |
|
|||
421 | backports.shutil-get-terminal-size = super.buildPythonPackage { |
|
408 | backports.shutil-get-terminal-size = super.buildPythonPackage { | |
422 | name = "backports.shutil-get-terminal-size-1.0.0"; |
|
409 | name = "backports.shutil-get-terminal-size-1.0.0"; | |
423 | buildInputs = with self; []; |
|
410 | buildInputs = with self; []; | |
@@ -822,13 +809,13 b'' | |||||
822 | }; |
|
809 | }; | |
823 | }; |
|
810 | }; | |
824 | graphviz = super.buildPythonPackage { |
|
811 | graphviz = super.buildPythonPackage { | |
825 |
name = "graphviz-0. |
|
812 | name = "graphviz-0.8"; | |
826 | buildInputs = with self; []; |
|
813 | buildInputs = with self; []; | |
827 | doCheck = false; |
|
814 | doCheck = false; | |
828 | propagatedBuildInputs = with self; []; |
|
815 | propagatedBuildInputs = with self; []; | |
829 | src = fetchurl { |
|
816 | src = fetchurl { | |
830 | url = "https://pypi.python.org/packages/7d/2d/f5cfa56467ca5a65eb44e1103d89d2f65dbc4f04cf7a1f3d38e973c3d1a8/graphviz-0.7.1.zip"; |
|
817 | url = "https://pypi.python.org/packages/da/84/0e997520323d6b01124eb01c68d5c101814d0aab53083cd62bd75a90f70b/graphviz-0.8.zip"; | |
831 | md5 = "d5926e89975121d56dec777a79bfc9d1"; |
|
818 | md5 = "9486a885360a5ee54a81eb2950470c71"; | |
832 | }; |
|
819 | }; | |
833 | meta = { |
|
820 | meta = { | |
834 | license = [ pkgs.lib.licenses.mit ]; |
|
821 | license = [ pkgs.lib.licenses.mit ]; | |
@@ -899,6 +886,19 b'' | |||||
899 | license = [ pkgs.lib.licenses.bsdOriginal ]; |
|
886 | license = [ pkgs.lib.licenses.bsdOriginal ]; | |
900 | }; |
|
887 | }; | |
901 | }; |
|
888 | }; | |
|
889 | ipaddress = super.buildPythonPackage { | |||
|
890 | name = "ipaddress-1.0.18"; | |||
|
891 | buildInputs = with self; []; | |||
|
892 | doCheck = false; | |||
|
893 | propagatedBuildInputs = with self; []; | |||
|
894 | src = fetchurl { | |||
|
895 | url = "https://pypi.python.org/packages/4e/13/774faf38b445d0b3a844b65747175b2e0500164b7c28d78e34987a5bfe06/ipaddress-1.0.18.tar.gz"; | |||
|
896 | md5 = "310c2dfd64eb6f0df44aa8c59f2334a7"; | |||
|
897 | }; | |||
|
898 | meta = { | |||
|
899 | license = [ pkgs.lib.licenses.psfl ]; | |||
|
900 | }; | |||
|
901 | }; | |||
902 | ipdb = super.buildPythonPackage { |
|
902 | ipdb = super.buildPythonPackage { | |
903 | name = "ipdb-0.10.3"; |
|
903 | name = "ipdb-0.10.3"; | |
904 | buildInputs = with self; []; |
|
904 | buildInputs = with self; []; | |
@@ -1446,13 +1446,13 b'' | |||||
1446 | }; |
|
1446 | }; | |
1447 | }; |
|
1447 | }; | |
1448 | pyramid-debugtoolbar = super.buildPythonPackage { |
|
1448 | pyramid-debugtoolbar = super.buildPythonPackage { | |
1449 |
name = "pyramid-debugtoolbar- |
|
1449 | name = "pyramid-debugtoolbar-4.2.1"; | |
1450 | buildInputs = with self; []; |
|
1450 | buildInputs = with self; []; | |
1451 | doCheck = false; |
|
1451 | doCheck = false; | |
1452 | propagatedBuildInputs = with self; [pyramid pyramid-mako repoze.lru Pygments]; |
|
1452 | propagatedBuildInputs = with self; [pyramid pyramid-mako repoze.lru Pygments ipaddress]; | |
1453 | src = fetchurl { |
|
1453 | src = fetchurl { | |
1454 |
url = "https://pypi.python.org/packages/ |
|
1454 | url = "https://pypi.python.org/packages/db/26/94620b7752936e2cd74838263ff366db9b454f7394bfb62d1eb2f84b29c1/pyramid_debugtoolbar-4.2.1.tar.gz"; | |
1455 | md5 = "aebab8c3bfdc6f89e4d3adc1d126538e"; |
|
1455 | md5 = "3dfaced2fab1644ff5284017be9d92b9"; | |
1456 | }; |
|
1456 | }; | |
1457 | meta = { |
|
1457 | meta = { | |
1458 | license = [ { fullName = "Repoze Public License"; } pkgs.lib.licenses.bsdOriginal ]; |
|
1458 | license = [ { fullName = "Repoze Public License"; } pkgs.lib.licenses.bsdOriginal ]; | |
@@ -1722,7 +1722,7 b'' | |||||
1722 | name = "rhodecode-enterprise-ce-4.9.0"; |
|
1722 | name = "rhodecode-enterprise-ce-4.9.0"; | |
1723 | buildInputs = with self; [pytest py pytest-cov pytest-sugar pytest-runner pytest-catchlog pytest-profiling gprof2dot pytest-timeout mock WebTest cov-core coverage configobj]; |
|
1723 | buildInputs = with self; [pytest py pytest-cov pytest-sugar pytest-runner pytest-catchlog pytest-profiling gprof2dot pytest-timeout mock WebTest cov-core coverage configobj]; | |
1724 | doCheck = true; |
|
1724 | doCheck = true; | |
1725 |
propagatedBuildInputs = with self; [Babel Beaker FormEncode Mako Markdown MarkupSafe MySQL-python Paste PasteDeploy PasteScript Pygments pygments-markdown-lexer Pylons Routes SQLAlchemy Tempita URLObject WebError WebHelpers WebHelpers2 WebOb WebTest Whoosh alembic amqplib anyjson appenlight-client authomatic |
|
1725 | propagatedBuildInputs = with self; [Babel Beaker FormEncode Mako Markdown MarkupSafe MySQL-python Paste PasteDeploy PasteScript Pygments pygments-markdown-lexer Pylons Routes SQLAlchemy Tempita URLObject WebError WebHelpers WebHelpers2 WebOb WebTest Whoosh alembic amqplib anyjson appenlight-client authomatic cssselect celery channelstream colander decorator deform docutils gevent gunicorn infrae.cache ipython iso8601 kombu lxml msgpack-python nbconvert packaging psycopg2 py-gfm pycrypto pycurl pyparsing pyramid pyramid-debugtoolbar pyramid-mako pyramid-beaker pysqlite python-dateutil python-ldap python-memcached python-pam recaptcha-client repoze.lru requests simplejson subprocess32 waitress zope.cachedescriptors dogpile.cache dogpile.core psutil py-bcrypt]; | |
1726 | src = ./.; |
|
1726 | src = ./.; | |
1727 | meta = { |
|
1727 | meta = { | |
1728 | license = [ { fullName = "Affero GNU General Public License v3 or later (AGPLv3+)"; } { fullName = "AGPLv3, and Commercial License"; } ]; |
|
1728 | license = [ { fullName = "Affero GNU General Public License v3 or later (AGPLv3+)"; } { fullName = "AGPLv3, and Commercial License"; } ]; |
@@ -6,7 +6,6 b' amqplib==1.0.2' | |||||
6 | anyjson==0.3.3 |
|
6 | anyjson==0.3.3 | |
7 | authomatic==0.1.0.post1 |
|
7 | authomatic==0.1.0.post1 | |
8 | Babel==1.3 |
|
8 | Babel==1.3 | |
9 | backport-ipaddress==0.1 |
|
|||
10 | Beaker==1.9.0 |
|
9 | Beaker==1.9.0 | |
11 | celery==2.2.10 |
|
10 | celery==2.2.10 | |
12 | Chameleon==2.24 |
|
11 | Chameleon==2.24 | |
@@ -55,7 +54,7 b' pygments-markdown-lexer==0.1.0.dev39' | |||||
55 | Pygments==2.2.0 |
|
54 | Pygments==2.2.0 | |
56 | pyparsing==1.5.7 |
|
55 | pyparsing==1.5.7 | |
57 | pyramid-beaker==0.8 |
|
56 | pyramid-beaker==0.8 | |
58 |
pyramid-debugtoolbar== |
|
57 | pyramid-debugtoolbar==4.2.1 | |
59 | pyramid-jinja2==2.5 |
|
58 | pyramid-jinja2==2.5 | |
60 | pyramid-mako==1.0.2 |
|
59 | pyramid-mako==1.0.2 | |
61 | pyramid==1.9.0 |
|
60 | pyramid==1.9.0 |
@@ -90,9 +90,6 b'' | |||||
90 | "python2.7-authomatic-0.1.0.post1": { |
|
90 | "python2.7-authomatic-0.1.0.post1": { | |
91 | "MIT License": "http://spdx.org/licenses/MIT" |
|
91 | "MIT License": "http://spdx.org/licenses/MIT" | |
92 |
}, |
|
92 | }, | |
93 | "python2.7-backport-ipaddress-0.1": { |
|
|||
94 | "Python Software Foundation License version 2": "http://spdx.org/licenses/Python-2.0" |
|
|||
95 | }, |
|
|||
96 | "python2.7-backports.shutil-get-terminal-size-1.0.0": { |
|
93 | "python2.7-backports.shutil-get-terminal-size-1.0.0": { | |
97 | "MIT License": "http://spdx.org/licenses/MIT" |
|
94 | "MIT License": "http://spdx.org/licenses/MIT" | |
98 | }, |
|
95 | }, |
@@ -1991,9 +1991,10 b' def check_ip_access(source_ip, allowed_i' | |||||
1991 | :param allowed_ips: list of allowed ips together with mask |
|
1991 | :param allowed_ips: list of allowed ips together with mask | |
1992 | """ |
|
1992 | """ | |
1993 | log.debug('checking if ip:%s is subnet of %s' % (source_ip, allowed_ips)) |
|
1993 | log.debug('checking if ip:%s is subnet of %s' % (source_ip, allowed_ips)) | |
1994 | source_ip_address = ipaddress.ip_address(source_ip) |
|
1994 | source_ip_address = ipaddress.ip_address(safe_unicode(source_ip)) | |
1995 | if isinstance(allowed_ips, (tuple, list, set)): |
|
1995 | if isinstance(allowed_ips, (tuple, list, set)): | |
1996 | for ip in allowed_ips: |
|
1996 | for ip in allowed_ips: | |
|
1997 | ip = safe_unicode(ip) | |||
1997 | try: |
|
1998 | try: | |
1998 | network_address = ipaddress.ip_network(ip, strict=False) |
|
1999 | network_address = ipaddress.ip_network(ip, strict=False) | |
1999 | if source_ip_address in network_address: |
|
2000 | if source_ip_address in network_address: |
@@ -101,7 +101,7 b' def _filter_port(ip):' | |||||
101 | else: |
|
101 | else: | |
102 | # fallback to ipaddress |
|
102 | # fallback to ipaddress | |
103 | try: |
|
103 | try: | |
104 | ipaddress.IPv6Address(ip_addr) |
|
104 | ipaddress.IPv6Address(safe_unicode(ip_addr)) | |
105 | except Exception: |
|
105 | except Exception: | |
106 | return False |
|
106 | return False | |
107 | return True |
|
107 | return True | |
@@ -286,6 +286,7 b' def attach_context_attributes(context, r' | |||||
286 | Attach variables into template context called `c`, please note that |
|
286 | Attach variables into template context called `c`, please note that | |
287 | request could be pylons or pyramid request in here. |
|
287 | request could be pylons or pyramid request in here. | |
288 | """ |
|
288 | """ | |
|
289 | ||||
289 | rc_config = SettingsModel().get_all_settings(cache=True) |
|
290 | rc_config = SettingsModel().get_all_settings(cache=True) | |
290 |
|
291 | |||
291 | context.rhodecode_version = rhodecode.__version__ |
|
292 | context.rhodecode_version = rhodecode.__version__ |
@@ -1123,7 +1123,7 b' class UserIpMap(Base, BaseModel):' | |||||
1123 |
|
1123 | |||
1124 | @classmethod |
|
1124 | @classmethod | |
1125 | def _get_ip_range(cls, ip_addr): |
|
1125 | def _get_ip_range(cls, ip_addr): | |
1126 | net = ipaddress.ip_network(ip_addr, strict=False) |
|
1126 | net = ipaddress.ip_network(safe_unicode(ip_addr), strict=False) | |
1127 | return [str(net.network_address), str(net.broadcast_address)] |
|
1127 | return [str(net.network_address), str(net.broadcast_address)] | |
1128 |
|
1128 | |||
1129 | def __json__(self): |
|
1129 | def __json__(self): |
@@ -777,6 +777,7 b' class UserModel(BaseModel):' | |||||
777 |
|
777 | |||
778 | def parse_ip_range(self, ip_range): |
|
778 | def parse_ip_range(self, ip_range): | |
779 | ip_list = [] |
|
779 | ip_list = [] | |
|
780 | ||||
780 | def make_unique(value): |
|
781 | def make_unique(value): | |
781 | seen = [] |
|
782 | seen = [] | |
782 | return [c for c in value if not (c in seen or seen.append(c))] |
|
783 | return [c for c in value if not (c in seen or seen.append(c))] | |
@@ -788,8 +789,8 b' class UserModel(BaseModel):' | |||||
788 | ip_range = ip_range.strip() |
|
789 | ip_range = ip_range.strip() | |
789 | if '-' in ip_range: |
|
790 | if '-' in ip_range: | |
790 | start_ip, end_ip = ip_range.split('-', 1) |
|
791 | start_ip, end_ip = ip_range.split('-', 1) | |
791 | start_ip = ipaddress.ip_address(start_ip.strip()) |
|
792 | start_ip = ipaddress.ip_address(safe_unicode(start_ip.strip())) | |
792 | end_ip = ipaddress.ip_address(end_ip.strip()) |
|
793 | end_ip = ipaddress.ip_address(safe_unicode(end_ip.strip())) | |
793 | parsed_ip_range = [] |
|
794 | parsed_ip_range = [] | |
794 |
|
795 | |||
795 | for index in xrange(int(start_ip), int(end_ip) + 1): |
|
796 | for index in xrange(int(start_ip), int(end_ip) + 1): |
@@ -27,7 +27,7 b' import ipaddress' | |||||
27 | import colander |
|
27 | import colander | |
28 |
|
28 | |||
29 | from rhodecode.translation import _ |
|
29 | from rhodecode.translation import _ | |
30 | from rhodecode.lib.utils2 import glob2re |
|
30 | from rhodecode.lib.utils2 import glob2re, safe_unicode | |
31 |
|
31 | |||
32 | log = logging.getLogger(__name__) |
|
32 | log = logging.getLogger(__name__) | |
33 |
|
33 | |||
@@ -35,7 +35,7 b' log = logging.getLogger(__name__)' | |||||
35 | def ip_addr_validator(node, value): |
|
35 | def ip_addr_validator(node, value): | |
36 | try: |
|
36 | try: | |
37 | # this raises an ValueError if address is not IpV4 or IpV6 |
|
37 | # this raises an ValueError if address is not IpV4 or IpV6 | |
38 | ipaddress.ip_network(value, strict=False) |
|
38 | ipaddress.ip_network(safe_unicode(value), strict=False) | |
39 | except ValueError: |
|
39 | except ValueError: | |
40 | msg = _(u'Please enter a valid IPv4 or IpV6 address') |
|
40 | msg = _(u'Please enter a valid IPv4 or IpV6 address') | |
41 | raise colander.Invalid(node, msg) |
|
41 | raise colander.Invalid(node, msg) | |
@@ -48,7 +48,7 b' class IpAddrValidator(object):' | |||||
48 | def __call__(self, node, value): |
|
48 | def __call__(self, node, value): | |
49 | try: |
|
49 | try: | |
50 | # this raises an ValueError if address is not IpV4 or IpV6 |
|
50 | # this raises an ValueError if address is not IpV4 or IpV6 | |
51 | ipaddress.ip_network(value, strict=self.strict) |
|
51 | ipaddress.ip_network(safe_unicode(value), strict=self.strict) | |
52 | except ValueError: |
|
52 | except ValueError: | |
53 | msg = _(u'Please enter a valid IPv4 or IpV6 address') |
|
53 | msg = _(u'Please enter a valid IPv4 or IpV6 address') | |
54 | raise colander.Invalid(node, msg) |
|
54 | raise colander.Invalid(node, msg) |
@@ -44,7 +44,7 b' from rhodecode.authentication.base impor' | |||||
44 | from rhodecode.config.routing import ADMIN_PREFIX |
|
44 | from rhodecode.config.routing import ADMIN_PREFIX | |
45 | from rhodecode.lib.auth import HasRepoGroupPermissionAny, HasPermissionAny |
|
45 | from rhodecode.lib.auth import HasRepoGroupPermissionAny, HasPermissionAny | |
46 | from rhodecode.lib.utils import repo_name_slug, make_db_config |
|
46 | from rhodecode.lib.utils import repo_name_slug, make_db_config | |
47 | from rhodecode.lib.utils2 import safe_int, str2bool, aslist, md5 |
|
47 | from rhodecode.lib.utils2 import safe_int, str2bool, aslist, md5, safe_unicode | |
48 | from rhodecode.lib.vcs.backends.git.repository import GitRepository |
|
48 | from rhodecode.lib.vcs.backends.git.repository import GitRepository | |
49 | from rhodecode.lib.vcs.backends.hg.repository import MercurialRepository |
|
49 | from rhodecode.lib.vcs.backends.hg.repository import MercurialRepository | |
50 | from rhodecode.lib.vcs.backends.svn.repository import SubversionRepository |
|
50 | from rhodecode.lib.vcs.backends.svn.repository import SubversionRepository | |
@@ -972,13 +972,13 b' def ValidIp():' | |||||
972 | # we ovveride the default to_python() call |
|
972 | # we ovveride the default to_python() call | |
973 | def to_python(self, value, state): |
|
973 | def to_python(self, value, state): | |
974 | v = super(_validator, self).to_python(value, state) |
|
974 | v = super(_validator, self).to_python(value, state) | |
975 | v = v.strip() |
|
975 | v = safe_unicode(v.strip()) | |
976 | net = ipaddress.ip_network(address=v, strict=False) |
|
976 | net = ipaddress.ip_network(address=v, strict=False) | |
977 | return str(net) |
|
977 | return str(net) | |
978 |
|
978 | |||
979 | def validate_python(self, value, state): |
|
979 | def validate_python(self, value, state): | |
980 | try: |
|
980 | try: | |
981 | addr = value.strip() |
|
981 | addr = safe_unicode(value.strip()) | |
982 | # this raises an ValueError if address is not IpV4 or IpV6 |
|
982 | # this raises an ValueError if address is not IpV4 or IpV6 | |
983 | ipaddress.ip_network(addr, strict=False) |
|
983 | ipaddress.ip_network(addr, strict=False) | |
984 | except ValueError: |
|
984 | except ValueError: |
@@ -261,7 +261,7 b' def test_revoke_perm(test_user):' | |||||
261 | def test_ip_range_generator(ip_range, expected, expect_errors): |
|
261 | def test_ip_range_generator(ip_range, expected, expect_errors): | |
262 | func = UserModel().parse_ip_range |
|
262 | func = UserModel().parse_ip_range | |
263 | if expect_errors: |
|
263 | if expect_errors: | |
264 |
pytest.raises( |
|
264 | pytest.raises(ValueError, func, ip_range) | |
265 | else: |
|
265 | else: | |
266 | parsed_list = func(ip_range) |
|
266 | parsed_list = func(ip_range) | |
267 | assert parsed_list == expected |
|
267 | assert parsed_list == expected |
General Comments 0
You need to be logged in to leave comments.
Login now