From 2fe51da3bc6fe388d3ae93e90e4e549478969d05 Mon Sep 17 00:00:00 2001 From: hvalfangst <121831102+hvalfangst@users.noreply.github.com> Date: Thu, 26 Dec 2024 23:22:43 +0100 Subject: [PATCH] Incorporated OIDC for authenticating towards Azure in GH Action --- client/package.json | 2 +- hvalfangst_function/function_app.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/package.json b/client/package.json index 8c13d7e..93e97d7 100644 --- a/client/package.json +++ b/client/package.json @@ -16,7 +16,7 @@ }, "scripts": { "start": "react-scripts start", - "build": "react-scripts build", + "build": "GENERATE_SOURCEMAP=false react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, diff --git a/hvalfangst_function/function_app.py b/hvalfangst_function/function_app.py index af2ce89..5817a3d 100644 --- a/hvalfangst_function/function_app.py +++ b/hvalfangst_function/function_app.py @@ -74,10 +74,12 @@ def validate_jwt(token: str, audience: str) -> bool: @app.route(route="upload_csv", auth_level=func.AuthLevel.ANONYMOUS) -@app.blob_output(arg_name="outbound", path="hvalfangstcontainer/in/input.csv", connection="AzureWebJobsStorage") +@app.blob_output(arg_name="outbound", path="hvalfangstcontainer/in/input.csv", connection="") def upload_csv(req: func.HttpRequest, outbound: func.Out[str]) -> str: try: + logging.info("Received HTTP request to upload CSV") + # Validate JWT token token = req.headers.get("Authorization").split(" ")[1] # Extract Bearer token if not validate_jwt(token, audience=os.environ.get("FUNCTION_APP_CLIENT_ID")): return func.HttpResponse("Unauthorized", status_code=401)