mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-22 16:31:15 -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,
|
check_and_queue_callback_task,
|
||||||
)
|
)
|
||||||
|
|
||||||
# sms_response_mapper = {
|
sms_response_mapper = {
|
||||||
# 'MMG': get_mmg_responses,
|
# 'MMG': get_mmg_responses,
|
||||||
# 'Firetext': get_firetext_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)
|
@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):
|
def process_sms_client_response(self, status, provider_reference, client_name, detailed_status_code=None):
|
||||||
# validate reference
|
# validate reference
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
from pathlib import Path
|
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):
|
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
|
path = Path(__file__).resolve().parent / schema_file_name
|
||||||
contents = path.read_text()
|
contents = path.read_text()
|
||||||
|
|
||||||
schema_root = etree.XML(contents.encode('utf-8'))
|
schema_root = fromstring(contents.encode('utf-8'))
|
||||||
schema = etree.XMLSchema(schema_root)
|
schema = XMLSchema(schema_root)
|
||||||
parser = etree.XMLParser(schema=schema)
|
return schema.validate(fromstring(document))
|
||||||
|
|
||||||
try:
|
|
||||||
etree.fromstring(document, parser)
|
|
||||||
except etree.XMLSyntaxError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ SQLAlchemy==1.4.40
|
|||||||
cachetools==5.1.0
|
cachetools==5.1.0
|
||||||
beautifulsoup4==4.11.1
|
beautifulsoup4==4.11.1
|
||||||
lxml==4.9.1
|
lxml==4.9.1
|
||||||
|
defusedxml==0.7.1
|
||||||
Werkzeug==2.1.1
|
Werkzeug==2.1.1
|
||||||
python-dotenv==0.20.0
|
python-dotenv==0.20.0
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ click-repl==0.2.0
|
|||||||
# via celery
|
# via celery
|
||||||
colorama==0.4.4
|
colorama==0.4.4
|
||||||
# via awscli
|
# via awscli
|
||||||
|
defusedxml==0.7.1
|
||||||
|
# via -r requirements.in
|
||||||
deprecated==1.2.13
|
deprecated==1.2.13
|
||||||
# via redis
|
# via redis
|
||||||
dnspython==2.2.1
|
dnspython==2.2.1
|
||||||
|
|||||||
Reference in New Issue
Block a user