Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos-mynij-dev
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mynij
slapos-mynij-dev
Commits
2c4227e2
Commit
2c4227e2
authored
Jul 15, 2020
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-frontend: Reject empty url and https-url
parent
409a6823
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
software/caddy-frontend/buildout.hash.cfg
software/caddy-frontend/buildout.hash.cfg
+1
-1
software/caddy-frontend/instance-apache-replicate.cfg.in
software/caddy-frontend/instance-apache-replicate.cfg.in
+3
-4
software/caddy-frontend/test/test.py
software/caddy-frontend/test/test.py
+20
-2
No files found.
software/caddy-frontend/buildout.hash.cfg
View file @
2c4227e2
...
...
@@ -26,7 +26,7 @@ md5sum = 23237969bbd9e974ac674b2052e8d67c
[template-caddy-replicate]
filename = instance-apache-replicate.cfg.in
md5sum =
e2d9c782835ea9816539ce7b4f924ca9
md5sum =
19debfbc27c464f451b1eb5bb5ce3c84
[template-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
...
...
software/caddy-frontend/instance-apache-replicate.cfg.in
View file @
2c4227e2
...
...
@@ -138,13 +138,12 @@ context =
{% do slave.__setitem__('server-alias', ' '.join(slave_server_alias_unclashed)) %}
{% endif %}
{% for url_key in ['url', 'https-url'] %}
{% if
slave.get(url_key)
%}
{% if
url_key in slave
%}
{% set url = (slave[url_key] or '').strip() %}
{% if url != slave[url_key] %}
{% do slave_warning_list.append('slave %s %r has been converted to %r' % (url_key, slave[url_key], url)) %}
{% endif %}
{% if subprocess_module.call([caddy_backend_url_validator, url]) == 1 or not validators.url(url) %}
{% do slave_error_list.append('slave %s %r invalid' % (url_key, url)) %}
{% elif url != slave[url_key] %}
{% do slave_warning_list.append('slave %s %r has been converted to %r' % (url_key, slave[url_key], url)) %}
{% endif %}
{% endif %}
{% endfor %}
...
...
software/caddy-frontend/test/test.py
View file @
2c4227e2
...
...
@@ -6075,6 +6075,10 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase):
'
url
': '
http
:
//
1
:
2
:
3
:
4
',
'
https
-
url
': '
http
:
//
host
.
domain
:
badport
',
},
'
empty
-
backend
': {
'
url
': '',
'
https
-
url
': '',
},
'
custom_domain
-
unsafe
': {
'
custom_domain
': '
$
{
section
:
option
}
afterspace
\
nafternewline
',
},
...
...
@@ -6143,8 +6147,8 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase):
'backend-client-caucase-url': 'http://[%s]:8990' % self._ipv6_address,
'domain': 'example.com',
'accepted-slave-amount': '7',
'rejected-slave-amount': '1
2
',
'slave-amount': '
19
',
'rejected-slave-amount': '1
3
',
'slave-amount': '
20
',
'rejected-slave-dict': {
'_https-url': ['slave https-url "
https
:
//
[
fd46
::
c2ae
]:
!
py
!
u
\
'123123
\
'
"'
' invalid'
],
...
...
@@ -6173,6 +6177,9 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase):
'_bad-backend'
:
[
"slave url 'http://1:2:3:4' invalid"
,
"slave https-url 'http://host.domain:badport' invalid"
],
'_empty-backend'
:
[
"slave url '' invalid"
,
"slave https-url '' invalid"
],
},
'warning-slave-dict'
:
{
'_ssl_ca_crt_only'
:
[
...
...
@@ -6535,3 +6542,14 @@ class TestSlaveRejectReportUnsafeDamaged(SlaveHttpFrontendTestCase):
},
parameter_dict
)
def
test_empty_backend
(
self
):
parameter_dict
=
self
.
parseSlaveParameterDict
(
'empty-backend'
)
self
.
assertEqual
(
{
'request-error-list'
:
[
"slave url '' invalid"
,
"slave https-url '' invalid"
],
},
parameter_dict
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment