diff --git a/.env_temp b/.env_temp index d050c99..73ee07f 100644 --- a/.env_temp +++ b/.env_temp @@ -1,4 +1,4 @@ -APP_IMAGE=python-insecure-app:latest +APP_IMAGE=python-insecure-app:wolfi-distroless COMPOSE_FILE=docker-compose.yaml DEBUG=True LETSENCRYPT_EMAIL=info@example.com diff --git a/Dockerfile.alpine b/Dockerfile.alpine index 73ad7f4..2181413 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -3,7 +3,7 @@ FROM python:3.13-alpine@sha256:e5fa639e49b85986c4481e28faa2564b45aa8021413f31026c3856e5911618b1 AS alpine LABEL project="Python Insecure App" service="FastAPI" stage="alpine" -# RUN python3 -m pip install --upgrade pip~=25.3 +RUN python3 -m pip install --upgrade pip~=25.3 ENV NONROOT=nonroot \ LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ diff --git a/app/config.py b/app/config.py index 44c3c1c..0c44241 100644 --- a/app/config.py +++ b/app/config.py @@ -10,6 +10,6 @@ PUBLIC_IP_SERVICE_URL = os.getenv("PUBLIC_IP_SERVICE_URL") -SUPER_SECRET_NAME = "John Ripper" # FIXME: os.getenv("SUPER_SECRET_NAME") +SUPER_SECRET_NAME = os.getenv("SUPER_SECRET_NAME") -SUPER_SECRET_TOKEN = "5u93R53Cr3tT0k3n" # FIXME: os.getenv("SUPER_SECRET_TOKEN") +SUPER_SECRET_TOKEN = os.getenv("SUPER_SECRET_TOKEN") diff --git a/app/main.py b/app/main.py index cafefd2..a7d2812 100644 --- a/app/main.py +++ b/app/main.py @@ -28,14 +28,13 @@ async def try_hack_me(name: str = config.SUPER_SECRET_NAME): """ try: # Get the public IP address from an external service - public_ip_response = requests.get(config.PUBLIC_IP_SERVICE_URL) + public_ip_response = requests.get(config.PUBLIC_IP_SERVICE_URL, timeout=5) public_ip_response.raise_for_status() except (requests.HTTPError, requests.exceptions.InvalidSchema): public_ip = "Unknown" else: public_ip = public_ip_response.text name = name or config.SUPER_SECRET_NAME - content = f"
{public_ip}{{public_ip}}123.45.67.89