Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -13,7 +12,7 @@ RUN apt-get update && apt-get install -y \
sudo \
unixodbc \
unixodbc-dev \
libgl1-mesa-glx \
libgl1 \
git \
curl \
xdg-utils \
Expand Down Expand Up @@ -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 \
Expand Down
2 changes: 2 additions & 0 deletions .devcontainer/devcontainer_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion doc/code/converters/ansi_attack_converter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@
}
],
"source": [
"\n",
"from pyrit.executor.attack import (\n",
" AttackConverterConfig,\n",
" AttackExecutor,\n",
Expand Down