diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 16c25a29b..843c04871 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,4 @@ -# Use a Python image with uv pre-installed -FROM --platform=linux/amd64 ghcr.io/astral-sh/uv:python3.11-bookworm-slim +FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/python:3.11 # Makes installation faster ENV UV_COMPILE_BYTECODE=1 @@ -13,7 +12,7 @@ RUN apt-get update && apt-get install -y \ sudo \ unixodbc \ unixodbc-dev \ - libgl1-mesa-glx \ + libgl1 \ git \ curl \ xdg-utils \ @@ -48,19 +47,18 @@ RUN apt-get update \ libpulse0 \ && rm -rf /var/lib/apt/lists/* -ARG USERNAME=vscode -# Create the user and grant passwordless sudo -RUN groupadd $USERNAME \ - && useradd -g $USERNAME -m $USERNAME \ - && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers - -# Create pyrit-dev venv at /opt/venv (reusing base image's VIRTUAL_ENV path) with pyrit-dev prompt -RUN rm -rf /opt/venv \ +# Install uv system-wide and create pyrit-dev venv +RUN curl -LsSf https://astral.sh/uv/install.sh | sh \ + && mv /root/.local/bin/uv /usr/local/bin/uv \ + && rm -rf /opt/venv \ && uv venv /opt/venv --python 3.11 --prompt pyrit-dev \ && chown -R vscode:vscode /opt/venv \ && ls -la /opt/venv/bin/activate ENV PATH="/opt/venv/bin:$PATH" +# vscode user already exists in the base image, just ensure sudo access +RUN echo "vscode ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + # Pre-create common user caches and fix permissions RUN mkdir -p /home/vscode/.cache/pre-commit \ && mkdir -p /home/vscode/.vscode-server \ diff --git a/.devcontainer/devcontainer_setup.sh b/.devcontainer/devcontainer_setup.sh index 28a232c17..c3c73a68b 100644 --- a/.devcontainer/devcontainer_setup.sh +++ b/.devcontainer/devcontainer_setup.sh @@ -47,6 +47,8 @@ if [ ! -f "$HASH_FILE" ] || [ "$(cat $HASH_FILE)" != "$CURRENT_HASH" ]; then # Install dependencies uv pip install ipykernel uv pip install -e ".[dev,all]" + # Register the kernel with Jupyter + python -m ipykernel install --user --name=pyrit-dev --display-name="Python (pyrit-dev)" # Save the new hash echo "$CURRENT_HASH" > "$HASH_FILE" diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index f1337fc49..12eb85de6 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -16,6 +16,7 @@ services: - precommit-cache:/home/vscode/.cache/pre-commit:cached - mypy-cache:/workspace/.mypy_cache:cached - pylance-cache:/home/vscode/.cache/pylance:cached + - ~/.pyrit:/home/vscode/.pyrit:cached network_mode: "host" # Note: ports section is not needed with host network mode # The container will have direct access to all host network interfaces diff --git a/doc/code/converters/ansi_attack_converter.ipynb b/doc/code/converters/ansi_attack_converter.ipynb index cdd7dadf2..47a25e0cf 100644 --- a/doc/code/converters/ansi_attack_converter.ipynb +++ b/doc/code/converters/ansi_attack_converter.ipynb @@ -366,7 +366,6 @@ } ], "source": [ - "\n", "from pyrit.executor.attack import (\n", " AttackConverterConfig,\n", " AttackExecutor,\n",