Moved SSL test out of BaseFuzzTestCase
Change-Id: I8cd5d7c651a324faaa9ceb9b4a79740b4b8b99bc
This commit is contained in:
parent
84e0e57941
commit
d1ca60c5f2
|
@ -12,7 +12,6 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import os
|
||||
import re
|
||||
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
|
@ -136,22 +135,6 @@ class BaseFuzzTestCase(base.BaseTestCase):
|
|||
defined here
|
||||
"""
|
||||
|
||||
target = self.init_request.url
|
||||
domain = urlparse(target).hostname
|
||||
regex = r"\bhttp://{0}".format(domain)
|
||||
response_text = self.resp.text
|
||||
|
||||
if re.search(regex, response_text):
|
||||
self.register_issue(
|
||||
Issue(test="SSL_ERROR",
|
||||
severity="Medium",
|
||||
confidence="High",
|
||||
text=("Make sure that all the returned endpoint URIs"
|
||||
" use 'https://' and not 'http://'"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
if self.resp.status_code >= 500:
|
||||
self.register_issue(
|
||||
Issue(test="500_errors",
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
# Copyright 2016 Intel
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
import os
|
||||
import re
|
||||
|
||||
from six.moves.urllib.parse import urlparse
|
||||
|
||||
from syntribos.clients.http import client
|
||||
from syntribos.clients.http import parser
|
||||
from syntribos.issue import Issue
|
||||
from syntribos.tests import base
|
||||
|
||||
|
||||
class SSLTestCase(base.BaseTestCase):
|
||||
|
||||
test_name = "SSL"
|
||||
test_type = "headers"
|
||||
client = client()
|
||||
failures = []
|
||||
|
||||
@classmethod
|
||||
def get_test_cases(cls, filename, file_content):
|
||||
|
||||
request_obj = parser.create_request(
|
||||
file_content, os.environ.get("SYNTRIBOS_ENDPOINT")
|
||||
)
|
||||
cls.resp = cls.client.send_request(request_obj)
|
||||
yield cls
|
||||
|
||||
def test_case(self):
|
||||
|
||||
target = self.resp.url
|
||||
domain = urlparse(target).hostname
|
||||
regex = r"\bhttp://{0}".format(domain)
|
||||
response_text = self.resp.text
|
||||
|
||||
if re.search(regex, response_text):
|
||||
self.register_issue(
|
||||
Issue(test="SSL_ERROR",
|
||||
severity="Medium",
|
||||
confidence="High",
|
||||
text=("Make sure that all the returned endpoint URIs"
|
||||
" use 'https://' and not 'http://'"
|
||||
)
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue