Compare commits

...

23 Commits

Author SHA1 Message Date
Kenneth Kehl
4a742a8873 code review feedback 2025-02-10 11:05:41 -08:00
ccostino
1cbd40f36b Merge pull request #1550 from GSA/notify-api-1548
try to fix dynamic scan warnings
2025-02-07 14:32:55 -05:00
Kenneth Kehl
f3d7d56e04 fix werkzeug server header 2025-02-04 07:39:42 -08:00
Kenneth Kehl
dea1ef5eae fix werkzeug server header 2025-02-04 07:30:39 -08:00
Kenneth Kehl
8a9d1b8a99 fix werkzeug server header 2025-02-04 07:18:27 -08:00
Kenneth Kehl
1657025cd0 fix werkzeug server header 2025-02-04 07:14:44 -08:00
Kenneth Kehl
fa0d308eff fix werkzeug server header 2025-02-03 14:38:43 -08:00
Kenneth Kehl
e65a9d87d4 ugh 2025-02-03 12:28:40 -08:00
Kenneth Kehl
d61f96d916 fix content-type conditionally 2025-02-03 12:06:21 -08:00
Kenneth Kehl
0de1dd1fd5 fix minor startup error 2025-02-03 11:50:32 -08:00
Kenneth Kehl
7743bc40c8 fix minor startup error 2025-02-03 11:40:19 -08:00
Kenneth Kehl
973506acad fix minor startup error 2025-02-03 11:09:04 -08:00
Kenneth Kehl
3d6f112324 fix minor startup error 2025-02-03 10:40:55 -08:00
Kenneth Kehl
0226c072f4 revert to last good 2025-02-03 09:38:50 -08:00
Kenneth Kehl
9933db8e05 revert to last good 2025-02-03 09:18:08 -08:00
Kenneth Kehl
d935e4a6f7 revert to last good 2025-02-03 08:55:38 -08:00
Kenneth Kehl
53c71213c4 revert to last good 2025-02-03 08:47:25 -08:00
Kenneth Kehl
073c747786 try to fix dynamic scan warnings 2025-02-03 08:23:44 -08:00
Kenneth Kehl
8a70e728f2 try to fix dynamic scan warnings 2025-02-03 08:08:47 -08:00
Kenneth Kehl
ec02da930b try to fix dynamic scan warnings 2025-02-03 07:56:30 -08:00
Carlo Costino
50d8beffa6 Merge pull request #1545 from GSA/notify-api-1544
Make a command to see a service's sms sender phone numbers
2025-02-03 10:53:53 -05:00
Kenneth Kehl
69c0abdff9 merge from main 2025-01-29 12:15:29 -08:00
Kenneth Kehl
798cfbca0a make command to see sms sender phones 2025-01-29 12:15:12 -08:00
9 changed files with 33 additions and 6 deletions

View File

@@ -91,4 +91,4 @@ jobs:
fail_action: true
allow_issue_writing: false
rules_file_name: 'zap.conf'
cmd_options: '-I -d'
cmd_options: '-I'

View File

@@ -286,6 +286,13 @@ def init_app(app):
@app.after_request
def after_request(response):
response.headers.add("X-Content-Type-Options", "nosniff")
# Some dynamic scan findings
response.headers.add("Cross-Origin-Opener-Policy", "same-origin")
response.headers.add("Cross-Origin-Embedder-Policy", "require-corp")
response.headers.add("Cross-Origin-Resource-Policy", "same-origin")
response.headers.add("Cross-Origin-Opener-Policy", "same-origin")
return response
@app.errorhandler(Exception)

View File

@@ -52,7 +52,8 @@ def cleanup_unfinished_jobs():
# The query already checks that the processing_finished time is null, so here we are saying
# if it started more than 4 hours ago, that's too long
try:
acceptable_finish_time = job.processing_started + timedelta(minutes=5)
if job.processing_started is not None:
acceptable_finish_time = job.processing_started + timedelta(minutes=5)
except TypeError:
current_app.logger.exception(
f"Job ID {job.id} processing_started is {job.processing_started}.",

View File

@@ -846,6 +846,19 @@ def create_new_service(name, message_limit, restricted, email_from, created_by_i
db.session.rollback()
@notify_command(name="get-service-sender-phones")
@click.option("-s", "--service_id", required=True, prompt=True)
def get_service_sender_phones(service_id):
sender_phone_numbers = """
select sms_sender, is_default
from service_sms_senders
where service_id = :service_id
"""
rows = db.session.execute(text(sender_phone_numbers), {"service_id": service_id})
for row in rows:
print(row)
@notify_command(name="promote-user-to-platform-admin")
@click.option("-u", "--user-email-address", required=True, prompt=True)
def promote_user_to_platform_admin(user_email_address):

View File

@@ -270,7 +270,6 @@ def get_notifications_for_job(
def get_recent_notifications_for_job(
service_id, job_id, filter_dict=None, page=1, page_size=None
):
print(f"FILTER_DICT AT DAO LEVEL {filter_dict}")
if page_size is None:
page_size = current_app.config["PAGE_SIZE"]
@@ -281,7 +280,6 @@ def get_recent_notifications_for_job(
stmt = _filter_query(stmt, filter_dict)
stmt = stmt.order_by(desc(Notification.job_row_number))
print(f"STMT {stmt}")
results = db.session.execute(stmt).scalars().all()
page_size = current_app.config["PAGE_SIZE"]

View File

@@ -128,7 +128,6 @@ def get_all_notifications_for_service_job(service_id, job_id):
@job_blueprint.route("/<job_id>/recent_notifications", methods=["GET"])
def get_recent_notifications_for_service_job(service_id, job_id):
data = notifications_filter_schema.load(request.args)
print(f"DATA COMING IN AT REST LEVEL IS {data}")
page = data["page"] if "page" in data else 1
page_size = (
data["page_size"]

View File

@@ -2,9 +2,12 @@
from __future__ import print_function
from flask import Flask
from werkzeug.serving import WSGIRequestHandler
from app import create_app
WSGIRequestHandler.version_string = lambda self: "SecureServer"
application = Flask("app")
create_app(application)

View File

@@ -76,6 +76,11 @@ class ResponseHeaderMiddleware(object):
if SPAN_ID_HEADER.lower() not in lower_existing_header_names:
headers.append((SPAN_ID_HEADER, str(req.span_id)))
headers = [
(key, value)
for key, value in headers
if key.lower() not in ["server", "last-modified"]
]
return start_response(status, headers, exc_info)
return self._app(environ, rewrite_response_headers)

View File

@@ -50,7 +50,7 @@
10061 WARN (X-AspNet-Version Response Header - Passive/release)
10062 FAIL (PII Disclosure - Passive/beta)
10095 IGNORE (Backup File Disclosure - Active/beta)
10096 WARN (Timestamp Disclosure - Passive/release)
10096 IGNORE (Timestamp Disclosure - Passive/release)
10097 WARN (Hash Disclosure - Passive/beta)
10098 WARN (Cross-Domain Misconfiguration - Passive/release)
10104 WARN (User Agent Fuzzer - Active/beta)
@@ -119,3 +119,4 @@
90030 WARN (WSDL File Detection - Passive/alpha)
90033 WARN (Loosely Scoped Cookie - Passive/release)
90034 WARN (Cloud Metadata Potentially Exposed - Active/beta)
100001 IGNORE (Unexpected Content-Type was returned)