From b291a749939a0ad26704a973f7cedcc3f5ea05b6 Mon Sep 17 00:00:00 2001 From: Michaela Wheeler Date: Mon, 17 Jan 2022 08:53:19 +1100 Subject: [PATCH] block changeme callsigns --- lambda/station_api_to_iot_core/__init__.py | 3 +++ lambda/station_api_to_iot_core/__main__.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lambda/station_api_to_iot_core/__init__.py b/lambda/station_api_to_iot_core/__init__.py index 6b7aa52..9ef1315 100644 --- a/lambda/station_api_to_iot_core/__init__.py +++ b/lambda/station_api_to_iot_core/__init__.py @@ -4,6 +4,7 @@ import base64 import datetime from email.utils import parsedate +CALLSIGN_BLOCK_LIST = ["CHANGEME_RDZTTGO"] import es @@ -48,6 +49,8 @@ def lambda_handler(event, context): payload["uploader_position"][2], f"{payload['uploader_position'][0]},{payload['uploader_position'][1]}", ) + if payload["uploader_callsign"] in CALLSIGN_BLOCK_LIST: + return {"statusCode": 403, "body": "callsign blocked or invalid"} index = datetime.datetime.utcnow().strftime("listeners-%Y-%m") payload["ts"] = datetime.datetime.utcnow().isoformat() diff --git a/lambda/station_api_to_iot_core/__main__.py b/lambda/station_api_to_iot_core/__main__.py index 74cd825..d5097f5 100644 --- a/lambda/station_api_to_iot_core/__main__.py +++ b/lambda/station_api_to_iot_core/__main__.py @@ -36,7 +36,7 @@ payload = { "timeEpoch": 1612051825409, }, "body": """ - {"software_name": "radiosonde_auto_rx", "software_version": "1.5.8-beta2", "uploader_callsign": "LZ3DJ-18", "uploader_position": [null,null,null], "uploader_antenna": "Dipole", "uploader_contact_email": "none@none.com", "mobile": false} + {"software_name": "radiosonde_auto_rx", "software_version": "1.5.8-beta2", "uploader_callsign": "CHANGEME_RDZTTGO", "uploader_position": [null,null,null], "uploader_antenna": "Dipole", "uploader_contact_email": "none@none.com", "mobile": false} """, "isBase64Encoded": False, }