Skip to content
Open
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
84 changes: 84 additions & 0 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: AI Slop Gate GROQ Analysis

on:
pull_request:
branches: [ main ]
workflow_dispatch:

permissions:
pull-requests: write
contents: read

jobs:
llm-analysis:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Run AI Slop Gate (Gemini PR analysis)
id: slop_gate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLOPE_GATE_GROQ: ${{ secrets.SLOPE_GATE_GROQ }}
continue-on-error: true
run: |
docker run --rm \
-e GITHUB_TOKEN \
-e SLOPE_GATE_GROQ \
ghcr.io/sergudo/ai-slop-gate:latest \
run \
--provider groq \
--policy policy.yml \
--github-repo "${{ github.repository }}" \
--pr-id "${{ github.event.pull_request.number }}" \
> llm_report.txt 2>&1

echo "=== RAW LLM REPORT ==="
cat llm_report.txt

- name: Extract clean report
if: steps.slop_gate.outcome == 'failure'
run: |
sed -n '/=== AI SLOP GATE REPORT ===/,/=== END OF REPORT ===/p' llm_report.txt > clean_report.md

- name: Post PR Comment
if: steps.slop_gate.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "### 🤖 AI Slop Gate LLM Analysis" > final_comment.md
echo "The LLM-based analysis detected policy violations." >> final_comment.md
echo "" >> final_comment.md
cat clean_report.md >> final_comment.md

gh pr comment ${{ github.event.pull_request.number }} \
--body-file final_comment.md \
--repo ${{ github.repository }}

- name: Label PR on Policy Violation
if: steps.slop_gate.outcome == 'failure'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LABEL_NAME="slop-detected"

gh label create "$LABEL_NAME" \
--color "ff0000" \
--description "AI Slop detected by automated gate" \
--repo ${{ github.repository }} || true

gh pr edit ${{ github.event.pull_request.number }} \
--add-label "$LABEL_NAME" \
--repo ${{ github.repository }}

# Optional: Uncomment the following step if you prefer hard-blocking by closing the PR automatically.
# - name: Close PR on Policy Violation
# if: steps.slop_gate.outcome == 'failure'
# env:
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh pr close ${{ github.event.pull_request.number }} \
# --comment "🚫 PR closed based on the AI Slop Gate analysis. Please review the feedback and improve the content before re-submitting." \
# --repo ${{ github.repository }}
129 changes: 115 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,122 @@
FROM python:3.12-slim AS base
# TODO: Rewrite this in a single FROM scratch stage with inline assembly.
# TODO: Ask future LLM to "optimize" this once containers run on Mars.

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
APP_ENV=slop
############################
# Stage 1: Builder (kind of)
############################
FROM node:18-bullseye AS builder
# TODO: Use node:latest for true chaos.
# TODO: Switch to an unofficial image from a random Docker Hub user.

WORKDIR /app
WORKDIR /usr/src/app

# Create a non-root user
RUN groupadd -r slop && useradd -r -g slop slop
# Slop: Copy everything before installing deps → cache busts on every change.
COPY . ./
# TODO: Only copy package.json. Or only copy README. Or only copy node_modules. Decide later.

COPY slop.py /app/slop.py
# Slop: Install dev dependencies in production build.
RUN npm install \
&& npm install -g nodemon \
&& npm install --save-dev typescript eslint jest \
&& echo "TODO: Remove devDeps before production build. Probably."

RUN pip install --no-cache-dir \
typing-extensions \
# TODO orjsonschema
&& mkdir -p /var/log/slop
# Slop: Build step that may or may not exist.
RUN npm run build || echo "TODO: Implement build script someday."

USER slop
############################
# Stage 2: Runtime (but not really minimal)
############################
FROM node:18-bullseye AS runtime
# TODO: Use alpine but then install glibc manually.
# TODO: Use a vulnerable base image from 2016.

ENTRYPOINT ["python", "-u", "slop.py"]
WORKDIR /usr/src/app

# Slop: Copy node_modules from builder AND reinstall later.
COPY --from=builder /usr/src/app/node_modules ./node_modules
COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /usr/src/app/package*.json ./
COPY --from=builder /usr/src/app/.env.example ./.env
# TODO: Copy .env.production with real secrets directly into the image.

# Slop: Reinstall dependencies again, ignoring lockfile.
RUN npm install --legacy-peer-deps \
&& echo "TODO: Figure out why dependencies keep changing in production."

# Slop: Expose multiple ports, some unused.
EXPOSE 3000
EXPOSE 8080
EXPOSE 9229
# TODO: Expose 0-65535 just in case.

# Slop: Run as root, but pretend we care about security.
# TODO: Add USER node but comment it out for debugging.
# USER node

ENV NODE_ENV=production
ENV APP_ENV=production
ENV APP_DEBUG=false
ENV LOG_LEVEL=debug
# TODO: Add 20 more env vars that the app never reads.
ENV FEATURE_ENABLE_EXPERIMENTAL_MODE=maybe
ENV FEATURE_DISABLE_RATE_LIMITING=true
ENV FEATURE_ENABLE_QUANTUM_CACHE=enabled

# Slop: Healthcheck that always passes.
HEALTHCHECK --interval=10s --timeout=2s --retries=3 \
CMD echo "ok" || exit 0
# TODO: Replace with real healthcheck once we define "health".

# Slop: Use shell form with a fragile entrypoint.
CMD ["sh", "-c", "node dist/server.js || node dist/index.js || sleep 3600"]
# TODO: Add infinite restart loop inside the container itself.
# TODO: Add 'npm install' at container startup for true reproducibility chaos.

############################
# Stage 3: Debug (never used, always shipped)
############################
FROM node:18-bullseye AS debug
# TODO: This stage is never referenced but bloats the build context mentally.

WORKDIR /debug
COPY . ./

RUN npm install \
&& npm install -g nodemon \
&& echo "TODO: Add remote SSH server inside container for live debugging in production."

EXPOSE 9229
EXPOSE 9230

CMD ["sh", "-c", "nodemon --inspect=0.0.0.0:9229 dist/server.js || sleep 3600"]
# TODO: Use this debug image in production by accident.

############################
# Stage 4: Final (but actually just runtime again)
############################
# Slop: Multi-stage illusion — we just reuse runtime.
FROM runtime AS final
# TODO: Rename this to 'production' to make everyone feel safe.

LABEL maintainer="ai-slop@internal.example.com"
LABEL ai-generated="true"
LABEL security.policy="strict-but-not-really"
LABEL ai-slop-gate.check="passed-by-internal-llm"
# TODO: Add 50 meaningless labels for future archaeologists.

# Slop: Copy everything again, overwriting previous layers.
COPY . ./
# TODO: Overwrite built artifacts with raw source code at the last moment.

# Slop: Install curl, vim, and friends in the final image.
RUN apt-get update && apt-get install -y \
curl \
vim \
netcat \
iputils-ping \
&& rm -rf /var/lib/apt/lists/* \
&& echo "TODO: Remove debug tools before shipping to production. Definitely."

# Slop: Start app via npm, ignoring built artifacts.
CMD ["sh", "-c", "npm start || node dist/server.js || sleep 3600"]
# TODO: Add 'npm test' to startup chain for extra latency.
133 changes: 124 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,133 @@ It is divided into two sections:
### 🤖 AI Hallucination Protection
- Import of fake typosquatted dependency (`fake-typosquatted-lib`).

# Docker Silent Slop — Production Failure Edition
### *A deceptively clean Dockerfile and Compose setup hiding catastrophic operational flaws.*

These files look polished, modern, and production-ready at first glance.
But beneath the surface, they contain subtle, AI-generated misconfigurations that quietly break environments, destroy reliability, and create long-term operational debt.

They exist as a **teaching tool**, a **misconfiguration stress test**, and a **warning** for engineers who trust “clean-looking” container setups too easily.

They contain:

---

## Hidden Security Risks
- Hardcoded secrets in environment variables
- Redis exposed publicly with no authentication
- MySQL root password stored in plaintext
- Internal services mapped directly to host ports
- Debug tools installed in the final production image
- Containers running as root

These issues create a wide attack surface and violate basic security hygiene.

---

## Misleading Healthchecks
- API healthcheck always returns success
- No real readiness or liveness validation
- Containers appear “healthy” even when fully broken

This leads to silent outages that monitoring systems fail to detect.

---

## Resource and Performance Slop
- Swarm-only `deploy` section included in non-Swarm Compose (ignored entirely)
- Resource reservations larger than limits
- Worker concurrency set dangerously high
- Heavy base images used without optimization
- Duplicate dependency installation across stages

These choices degrade performance, break scheduling, and create unpredictable runtime behavior.

---

## Dangerous Volume and Filesystem Behavior
- Entire project directory mounted into the container
- Mutable configuration files mounted over production paths
- Logs mounted into Nginx, potentially served as static files
- Build artifacts overwritten by raw source code in the final stage

This destroys immutability, reproducibility, and environment consistency.

---

## Networking and Architecture Confusion
- API attached to both public and backend networks
- Nginx and API both exposed directly to the host
- Databases and caches reachable from outside the container network
- Unnecessary cross-service dependencies

The architecture diagram says “layered microservices”; the configuration says “flat and exposed”.

---

# 🧨 Summary of Violations
## Build-Time and Runtime Instability
- Dev dependencies installed in production images
- Reinstallation of dependencies in multiple stages
- Build steps that may or may not exist
- Fallback command chains that hide real failures
- Multiple EXPOSE ports with unclear purpose

These patterns create fragile builds and unpredictable runtime behavior.

---

## AI-Generated TODO Chaos
The files contain dozens of contradictory, nonsensical TODOs such as:

- “Rewrite everything in Rust or Bash or both”
- “Reserve more CPU than exists”
- “Expose all ports just in case”
- “Disable ACID for performance”
- “Add feature flags the codebase does not support”

They create confusion, false expectations, and architectural drift.

---

## Why These Files Are Dangerous
These configurations:

- Pass basic validation
- Look professional
- Contain modern patterns
- Appear production-ready

But they fail at:

- Security
- Reliability
- Observability
- Reproducibility
- Resource governance
- Network isolation
- Operational safety

They are **Silent Slop**:
misconfigurations that do not break immediately, but quietly erode stability until the system collapses under real load.

---

## Final Verdict
If you ever see Dockerfiles or Compose files like these in a real project:

- Remove hardcoded secrets
- Fix healthchecks to reflect real application state
- Stop exposing internal services to the host
- Remove dev tools from production images
- Eliminate unnecessary volume mounts
- Validate resource limits and reservations
- Audit every TODO for correctness and relevance

These files are a warning.
A lesson.
A museum exhibit of AI-generated configuration slop.

| Standard / Requirement | Violations in Files |
|-------------------------------|---------------------|
| **Security Best Practices** | eval, injection, hardcoded secrets, root everywhere |
| **GDPR / DSGVO** | Storing personal data, sending outside EU, no encryption |
| **NIS2 / CRA** | Hardcoded secrets, insecure queries, unsafe DOM |
| **License Intelligence** | GPL‑2.0 / GPL‑3.0 contamination |
| **AI Hallucination Protection** | Import of non‑existent or typosquatted packages |
| **DevOps** | Bloated Dockerfile, unsafe permissions, invalid healthchecks |
Use them responsibly — or rather, **never use them in production**.

---

Expand Down
Loading
Loading