feat(vcs): dropped validate SSL for vcs-operations.
- This is very error prone - With docker we don't need it anymore
This commit is contained in:
parent
1a00627df3
commit
c859407811
11 changed files with 6 additions and 65 deletions
|
|
@ -82,7 +82,7 @@ class AdminSettingsView(BaseAppView):
|
|||
if k == '/':
|
||||
k = 'root_path'
|
||||
|
||||
if k in ['push_ssl', 'publish', 'enabled']:
|
||||
if k in ['publish', 'enabled']:
|
||||
v = str2bool(v)
|
||||
|
||||
if k.find('.') != -1:
|
||||
|
|
@ -164,7 +164,6 @@ class AdminSettingsView(BaseAppView):
|
|||
return Response(html)
|
||||
|
||||
try:
|
||||
model.update_global_ssl_setting(form_result['web_push_ssl'])
|
||||
model.update_global_hook_settings(form_result)
|
||||
|
||||
model.create_or_update_global_svn_settings(form_result)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ from rhodecode.lib.utils2 import AttributeDict
|
|||
from rhodecode.lib.exc_tracking import store_exception, format_exc
|
||||
from rhodecode.subscribers import (
|
||||
scan_repositories_if_enabled, write_js_routes_if_enabled,
|
||||
write_metadata_if_needed, write_usage_data)
|
||||
write_metadata_if_needed, write_usage_data, import_license_if_present)
|
||||
from rhodecode.lib.statsd_client import StatsdClient
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -400,7 +400,8 @@ def includeme(config, auth_resources=None):
|
|||
pyramid.events.ApplicationCreated)
|
||||
config.add_subscriber(write_js_routes_if_enabled,
|
||||
pyramid.events.ApplicationCreated)
|
||||
|
||||
config.add_subscriber(import_license_if_present,
|
||||
pyramid.events.ApplicationCreated)
|
||||
|
||||
# Set the default renderer for HTML templates to mako.
|
||||
config.add_mako_renderer('.html')
|
||||
|
|
|
|||
|
|
@ -570,7 +570,6 @@ class DbManage(object):
|
|||
self.create_ui_settings(path)
|
||||
|
||||
ui_config = [
|
||||
('web', 'push_ssl', 'False'),
|
||||
('web', 'allow_archive', 'gz zip bz2'),
|
||||
('web', 'allow_push', '*'),
|
||||
('web', 'baseurl', '/'),
|
||||
|
|
|
|||
|
|
@ -339,21 +339,6 @@ class SimpleVCS(object):
|
|||
log.exception('Failed to read http scheme')
|
||||
return 'http'
|
||||
|
||||
def _check_ssl(self, environ, start_response):
|
||||
"""
|
||||
Checks the SSL check flag and returns False if SSL is not present
|
||||
and required True otherwise
|
||||
"""
|
||||
org_proto = environ['wsgi._org_proto']
|
||||
# check if we have SSL required ! if not it's a bad request !
|
||||
require_ssl = str2bool(self.repo_vcs_config.get('web', 'push_ssl'))
|
||||
if require_ssl and org_proto == 'http':
|
||||
log.debug(
|
||||
'Bad request: detected protocol is `%s` and '
|
||||
'SSL/HTTPS is required.', org_proto)
|
||||
return False
|
||||
return True
|
||||
|
||||
def _get_default_cache_ttl(self):
|
||||
# take AUTH_CACHE_TTL from the `rhodecode` auth plugin
|
||||
plugin = loadplugin('egg:rhodecode-enterprise-ce#rhodecode')
|
||||
|
|
@ -373,12 +358,6 @@ class SimpleVCS(object):
|
|||
meta.Session.remove()
|
||||
|
||||
def _handle_request(self, environ, start_response):
|
||||
if not self._check_ssl(environ, start_response):
|
||||
reason = ('SSL required, while RhodeCode was unable '
|
||||
'to detect this as SSL request')
|
||||
log.debug('User not allowed to proceed, %s', reason)
|
||||
return HTTPNotAcceptable(reason)(environ, start_response)
|
||||
|
||||
if not self.url_repo_name:
|
||||
log.warning('Repository name is empty: %s', self.url_repo_name)
|
||||
# failed to get repo name, we fail now
|
||||
|
|
|
|||
|
|
@ -386,8 +386,7 @@ def config_data_from_db(clear_session=True, repo=None):
|
|||
safe_str(setting.section), safe_str(setting.key),
|
||||
safe_str(setting.value)))
|
||||
if setting.key == 'push_ssl':
|
||||
# force set push_ssl requirement to False, rhodecode
|
||||
# handles that
|
||||
# force set push_ssl requirement to False this is deprecated, and we must force it to False
|
||||
config.append((
|
||||
safe_str(setting.section), safe_str(setting.key), False))
|
||||
log.debug(
|
||||
|
|
|
|||
|
|
@ -468,7 +468,6 @@ def ApplicationUiSettingsForm(localizer):
|
|||
_ = localizer
|
||||
|
||||
class _ApplicationUiSettingsForm(_BaseVcsSettingsForm):
|
||||
web_push_ssl = v.StringBoolean(if_missing=False)
|
||||
largefiles_usercache = All(
|
||||
v.ValidPath(localizer),
|
||||
v.UnicodeString(strip=True, min=2, not_empty=True))
|
||||
|
|
|
|||
|
|
@ -501,7 +501,6 @@ class VcsSettingsModel(object):
|
|||
|
||||
SVN_BRANCH_SECTION = 'vcs_svn_branch'
|
||||
SVN_TAG_SECTION = 'vcs_svn_tag'
|
||||
SSL_SETTING = ('web', 'push_ssl')
|
||||
PATH_SETTING = ('paths', '/')
|
||||
|
||||
def __init__(self, sa=None, repo=None):
|
||||
|
|
@ -713,10 +712,6 @@ class VcsSettingsModel(object):
|
|||
# branch/tags patterns
|
||||
self._create_svn_settings(self.global_settings, data)
|
||||
|
||||
def update_global_ssl_setting(self, value):
|
||||
self._create_or_update_ui(
|
||||
self.global_settings, *self.SSL_SETTING, value=value)
|
||||
|
||||
@assert_repo_settings
|
||||
def delete_repo_svn_pattern(self, id_):
|
||||
ui = self.repo_settings.UiDbModel.get(id_)
|
||||
|
|
|
|||
|
|
@ -5,22 +5,7 @@
|
|||
|
||||
<%def name="vcs_settings_fields(suffix='', svn_branch_patterns=None, svn_tag_patterns=None, repo_type=None, display_globals=False, **kwargs)">
|
||||
% if display_globals:
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading" id="general">
|
||||
<h3 class="panel-title">${_('General')}<a class="permalink" href="#general"> ¶</a></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="field">
|
||||
<div class="checkbox">
|
||||
${h.checkbox('web_push_ssl' + suffix, 'True')}
|
||||
<label for="web_push_ssl${suffix}">${_('Require SSL for vcs operations')}</label>
|
||||
</div>
|
||||
<div class="label">
|
||||
<span class="help-block">${_('Activate to set RhodeCode to require SSL for pushing or pulling. If SSL certificate is missing it will return a HTTP Error 406: Not Acceptable.')}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
% endif
|
||||
|
||||
% if display_globals or repo_type in ['git', 'hg']:
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ def test_get_config(user_util, baseapp, request_stub):
|
|||
|
||||
expected_config = [
|
||||
('vcs_svn_tag', 'ff89f8c714d135d865f44b90e5413b88de19a55f', '/tags/*'),
|
||||
('web', 'push_ssl', 'False'),
|
||||
('web', 'allow_push', '*'),
|
||||
('web', 'allow_archive', 'gz zip bz2'),
|
||||
('web', 'baseurl', '/'),
|
||||
|
|
|
|||
|
|
@ -239,7 +239,6 @@ class TestShadowRepoExposure(object):
|
|||
"""
|
||||
controller = StubVCSController(
|
||||
baseapp.config.get_settings(), request_stub.registry)
|
||||
controller._check_ssl = mock.Mock()
|
||||
controller.is_shadow_repo = True
|
||||
controller._action = 'pull'
|
||||
controller._is_shadow_repo_dir = True
|
||||
|
|
@ -267,7 +266,6 @@ class TestShadowRepoExposure(object):
|
|||
"""
|
||||
controller = StubVCSController(
|
||||
baseapp.config.get_settings(), request_stub.registry)
|
||||
controller._check_ssl = mock.Mock()
|
||||
controller.is_shadow_repo = True
|
||||
controller._action = 'pull'
|
||||
controller._is_shadow_repo_dir = False
|
||||
|
|
@ -291,7 +289,6 @@ class TestShadowRepoExposure(object):
|
|||
"""
|
||||
controller = StubVCSController(
|
||||
baseapp.config.get_settings(), request_stub.registry)
|
||||
controller._check_ssl = mock.Mock()
|
||||
controller.is_shadow_repo = True
|
||||
controller._action = 'push'
|
||||
controller.stub_response_body = (b'dummy body value',)
|
||||
|
|
|
|||
|
|
@ -578,17 +578,6 @@ class TestCreateOrUpdateRepoHgSettings(object):
|
|||
assert str(exc_info.value) == 'Repository is not specified'
|
||||
|
||||
|
||||
class TestUpdateGlobalSslSetting(object):
|
||||
def test_updates_global_hg_settings(self):
|
||||
model = VcsSettingsModel()
|
||||
with mock.patch.object(model, '_create_or_update_ui') as create_mock:
|
||||
model.update_global_ssl_setting('False')
|
||||
Session().commit()
|
||||
|
||||
create_mock.assert_called_once_with(
|
||||
model.global_settings, 'web', 'push_ssl', value='False')
|
||||
|
||||
|
||||
class TestCreateOrUpdateGlobalHgSettings(object):
|
||||
FORM_DATA = {
|
||||
'extensions_largefiles': False,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue