Add a security scanner api config object for params
Change SecScanAPI to use a uri creation func instead of test context Pass config provider through validator context Remove app config dependency for validators
This commit is contained in:
parent
554d4f47a8
commit
7df8ed4a60
47 changed files with 305 additions and 166 deletions
|
@ -405,7 +405,10 @@ class SuperUserConfigValidate(ApiResource):
|
|||
# this is also safe since this method does not access any information not given in the request.
|
||||
if not config_provider.config_exists() or SuperUserPermission().can():
|
||||
config = request.get_json()['config']
|
||||
validator_context = ValidatorContext.from_app(config, request.get_json().get('password', ''), app, ip_resolver)
|
||||
validator_context = ValidatorContext.from_app(config, request.get_json().get('password', ''), app,
|
||||
ip_resolver=ip_resolver,
|
||||
config_provider=config_provider)
|
||||
|
||||
return validate_service_for_config(service, validator_context)
|
||||
|
||||
abort(403)
|
||||
|
|
|
@ -10,7 +10,6 @@ from auth.decorators import require_session_login
|
|||
from auth.permissions import AdministerRepositoryPermission
|
||||
from data import model
|
||||
from endpoints.decorators import route_show_if, parse_repository_name
|
||||
from util.config import URLSchemeAndHostname
|
||||
from util.http import abort
|
||||
|
||||
|
||||
|
@ -27,7 +26,6 @@ def attach_github_build_trigger(namespace_name, repo_name):
|
|||
permission = AdministerRepositoryPermission(namespace_name, repo_name)
|
||||
if permission.can():
|
||||
code = request.args.get('code')
|
||||
# url_scheme_and_hostname = URLSchemeAndHostname(app.config['PREFERRED_URL_SCHEME'], app.config['SERVER_HOSTNAME'])
|
||||
token = github_trigger.exchange_code_for_token(app.config, client, code)
|
||||
repo = model.repository.get_repository(namespace_name, repo_name)
|
||||
if not repo:
|
||||
|
|
|
@ -10,7 +10,6 @@ from auth.decorators import require_session_login
|
|||
from auth.permissions import AdministerRepositoryPermission
|
||||
from data import model
|
||||
from endpoints.decorators import route_show_if
|
||||
from util.config import URLSchemeAndHostname
|
||||
from util.http import abort
|
||||
|
||||
|
||||
|
@ -35,7 +34,6 @@ def attach_gitlab_build_trigger():
|
|||
permission = AdministerRepositoryPermission(namespace, repository)
|
||||
if permission.can():
|
||||
code = request.args.get('code')
|
||||
# url_scheme_and_hostname = URLSchemeAndHostname(app.config['PREFERRED_URL_SCHEME'], app.config['SERVER_HOSTNAME'])
|
||||
token = gitlab_trigger.exchange_code_for_token(app.config, client, code,
|
||||
redirect_suffix='/trigger')
|
||||
if not token:
|
||||
|
|
Reference in a new issue