From 7dc4b15cce161fe4d304e4e963bf3418b2bed555 Mon Sep 17 00:00:00 2001 From: Gertjan Franken Date: Tue, 27 Feb 2024 18:54:13 +0100 Subject: [PATCH 1/2] Update image name in docker-compose.yml and add timeout to /report/?leak= endpoint callback --- docker-compose.yml | 2 +- flask/experiments.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4be6e12..2bba90e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '3' services: web: - image: "registry.gitlab.kuleuven.be/distrinet/research/bughog/experiment-server:latest" + image: "bughog/web" pull_policy: never container_name: bh_web build: . diff --git a/flask/experiments.py b/flask/experiments.py index 64acfaa..9c37d04 100644 --- a/flask/experiments.py +++ b/flask/experiments.py @@ -64,7 +64,8 @@ def report_leak(): try: requests.post( f"http://{remote_ip}:5001/report/", - json=response_data + json=response_data, + timeout=5 ) except requests.exceptions.ConnectionError: print(f'WARNING: Could not propagate request to collector at {remote_ip}:5000') From 6de17c28aa0946f732a9d0a49b77a18ece572d35 Mon Sep 17 00:00:00 2001 From: Gertjan Franken Date: Mon, 18 Mar 2024 18:00:54 +0100 Subject: [PATCH 2/2] Abbreviate `resources` folder to `res` --- .gitignore | 2 +- docker-compose.yml | 2 +- experiments/README.md | 10 +++++----- flask/experiments.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index b33e126..09c83bd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ experiments/pages/** -experiments/resources/** +experiments/res/** # Created by https://www.toptal.com/developers/gitignore/api/macos,pycharm,flask,python # Edit at https://www.toptal.com/developers/gitignore?templates=macos,pycharm,flask,python diff --git a/docker-compose.yml b/docker-compose.yml index 2bba90e..0ee2577 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,4 +10,4 @@ services: - "443:443" volumes: - ./experiments/pages:/experiments/pages - - ./experiments/resources:/app/static/resources + - ./experiments/res:/app/static/res diff --git a/experiments/README.md b/experiments/README.md index eaf2e53..1b32d96 100644 --- a/experiments/README.md +++ b/experiments/README.md @@ -16,13 +16,13 @@ experiments | | |-- ... | |-- [project 2] | |-- ... -|-- resources +|-- res ``` - Experiments are grouped within projects inside the `pages` folder, representing sets of related experiments. -- The `resources` folder is intended to host resources that are used by multiple experiments and/or projects (e.g., scripts, images, videos) -Every resource is hosted on supported domains. +- The `res` folder is intended to host resources that are used by multiple experiments and/or projects (e.g., scripts, images, videos) +Every resource is hosted on all supported domains. ## Experiments @@ -122,10 +122,10 @@ Detecting unvisited sanity check URLs can help identify failed experiments and p ## Resources -The `resources` folder is intended to host resources shared between projects (e.g., images, videos, scripts). +The `res` folder is intended to host resources shared between projects (e.g., images, videos, scripts). All resources are hosted on each supported domain. -The example resource `experiments/resources/example.html` is hosted at the endpoints `https://[domain]/resources/example.html`, where `[domain]` can be any supported domain. +The example resource `experiments/res/example.html` is hosted at the endpoints `https://[domain]/res/example.html`, where `[domain]` can be any supported domain. ## Additional help diff --git a/flask/experiments.py b/flask/experiments.py index 9c37d04..2a7cb1a 100644 --- a/flask/experiments.py +++ b/flask/experiments.py @@ -117,9 +117,9 @@ def report_leak_if_contains(expected_header_name: str, expected_header_value: st return "Redirect", 307, {"Location": "https://adition.com/report/", "Allow-CSP-From": "*"} -@exp_bp.route("/resources/") +@exp_bp.route("/res/") def resources(path): - file_path = os.path.join("/app/static/resources/", path) + file_path = os.path.join("/app/static/res/", path) if not os.path.isfile(file_path): return "Resource not found", 404 if path.endswith(".swf"):