mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 08:21:13 -05:00
Clean up xml finding from static-scan
This commit is contained in:
@@ -14,13 +14,13 @@ from app.notifications.notifications_ses_callback import (
|
||||
check_and_queue_callback_task,
|
||||
)
|
||||
|
||||
# sms_response_mapper = {
|
||||
# 'MMG': get_mmg_responses,
|
||||
# 'Firetext': get_firetext_responses,
|
||||
# }
|
||||
sms_response_mapper = {
|
||||
# 'MMG': get_mmg_responses,
|
||||
# 'Firetext': get_firetext_responses,
|
||||
}
|
||||
|
||||
|
||||
gUpdate with new providers")
|
||||
# gUpdate with new providers")
|
||||
@notify_celery.task(bind=True, name="process-sms-client-response", max_retries=5, default_retry_delay=300)
|
||||
def process_sms_client_response(self, status, provider_reference, client_name, detailed_status_code=None):
|
||||
# validate reference
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
from pathlib import Path
|
||||
|
||||
from lxml import etree
|
||||
from defusedxml.lxml import fromstring
|
||||
# there is no equivalent in defusedxml to validate a schema
|
||||
from lxml.etree import XMLSchema # nosec B410
|
||||
|
||||
|
||||
def validate_xml(document, schema_file_name):
|
||||
@@ -8,13 +10,6 @@ def validate_xml(document, schema_file_name):
|
||||
path = Path(__file__).resolve().parent / schema_file_name
|
||||
contents = path.read_text()
|
||||
|
||||
schema_root = etree.XML(contents.encode('utf-8'))
|
||||
schema = etree.XMLSchema(schema_root)
|
||||
parser = etree.XMLParser(schema=schema)
|
||||
|
||||
try:
|
||||
etree.fromstring(document, parser)
|
||||
except etree.XMLSyntaxError:
|
||||
return False
|
||||
|
||||
return True
|
||||
schema_root = fromstring(contents.encode('utf-8'))
|
||||
schema = XMLSchema(schema_root)
|
||||
return schema.validate(fromstring(document))
|
||||
|
||||
@@ -22,6 +22,7 @@ SQLAlchemy==1.4.40
|
||||
cachetools==5.1.0
|
||||
beautifulsoup4==4.11.1
|
||||
lxml==4.9.1
|
||||
defusedxml==0.7.1
|
||||
Werkzeug==2.1.1
|
||||
python-dotenv==0.20.0
|
||||
|
||||
|
||||
@@ -69,6 +69,8 @@ click-repl==0.2.0
|
||||
# via celery
|
||||
colorama==0.4.4
|
||||
# via awscli
|
||||
defusedxml==0.7.1
|
||||
# via -r requirements.in
|
||||
deprecated==1.2.13
|
||||
# via redis
|
||||
dnspython==2.2.1
|
||||
|
||||
Reference in New Issue
Block a user