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
4 changes: 4 additions & 0 deletions .github/workflows/publish-insecure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
image: confusedcrib/insecure-api
context: ./insecure-api
dockerfile: ./insecure-api/Dockerfile
- name: insecure-ai
image: confusedcrib/insecure-ai
context: ./insecure-ai
dockerfile: ./insecure-ai/Dockerfile

steps:
- name: Check out the repo
Expand Down
26 changes: 26 additions & 0 deletions insecure-ai/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM python:3.12-slim
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security control: Docker Scan

Image User Should Not Be 'Root'

Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.

Severity: HIGH

Learn more about this issue


Fix suggestion:

This fix suggestion was generated by Jit. Please note that the suggestion might not always fit every use case. It is highly recommended that you check and review it before merging.

Suggestion guidelines

  • First of all, check if your container is running as a root user. In most of the cases, you can do it by running a command like this: docker run <image> whoami. If it returns root, then you should consider using a non-root user, by following one of the next steps:
    • If a non-root user already exists in your container, consider using it.
    • If not, you can create a new user by adding a USER command to the Dockerfile, with a non-root user as argument, for example: USER <non-root-user-name>.
Suggested change
FROM python:3.12-slim
FROM python:3.12-slim
RUN addgroup --system <group>
RUN adduser --system <user> --ingroup <group>
USER <user>:<group>

Jit Bot commands and options (e.g., ignore issue)

You can trigger Jit actions by commenting on this PR review:

  • #jit_ignore_fp Ignore and mark this specific single instance of finding as “False Positive”
  • #jit_ignore_accept Ignore and mark this specific single instance of finding as “Accept Risk”
  • #jit_ignore_type_in_file Ignore any finding of type "Image user should not be 'root'" in insecure-ai/Dockerfile; future occurrences will also be ignored.
  • #jit_undo_ignore Undo ignore command


WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
graphviz \
&& rm -rf /var/lib/apt/lists/*
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security control: Docker Scan

'Apt-Get' Missing '--No-Install-Recommends'

'apt-get' install should use '--no-install-recommends' to minimize image size.

Severity: HIGH

Learn more about this issue


Jit Bot commands and options (e.g., ignore issue)

You can trigger Jit actions by commenting on this PR review:

  • #jit_ignore_fp Ignore and mark this specific single instance of finding as “False Positive”
  • #jit_ignore_accept Ignore and mark this specific single instance of finding as “Accept Risk”
  • #jit_ignore_type_in_file Ignore any finding of type "'apt-get' missing '--no-install-recommends'" in insecure-ai/Dockerfile; future occurrences will also be ignored.
  • #jit_undo_ignore Undo ignore command


# Copy requirements first to leverage Docker cache
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt gunicorn

# Copy the rest of the application
COPY . .

# Expose the port the app runs on
EXPOSE 5000

# Set environment variables
ENV FLASK_APP=app.py
ENV FLASK_ENV=production

# Run the application with gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "--timeout", "120", "--config", "python:app", "app:app"]
52 changes: 52 additions & 0 deletions insecure-ai/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Code Security Analyzer

A Flask web application that allows users to analyze their code for security issues using the `latio` package.

## Features

- Paste code directly into the web interface
- Upload code as a ZIP file
- Real-time code analysis using `latio`
- Modern, responsive UI with syntax highlighting

## Prerequisites

- Python 3.7 or higher
- pip (Python package manager)
- `latio` package installed globally

## Installation

1. Clone this repository or download the files
2. Create a virtual environment (recommended):
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```
3. Install the required packages:
```bash
pip install -r requirements.txt
```

## Usage

1. Start the Flask application:
```bash
python app.py
```
2. Open your web browser and navigate to `http://localhost:5000`
3. Either paste your code into the text editor or upload a ZIP file containing your code
4. Click "Analyze Code" to run the security analysis
5. View the results in the results section below

## Security Considerations

- The application uses temporary directories for file processing
- File uploads are limited to 16MB
- Only ZIP files are accepted for upload
- All uploaded files are processed in isolated temporary directories
- The application runs in debug mode for development purposes

## License

MIT License
Loading
Loading