Declarative .mdcกฎ Cursor/Claude/Windsurf และเวิร์กโฟลว์ n8nกฎ IDEตรวจสอบการรั่วไหลแบบ Zero-Secret แล้ว
กฎแซนด์บ็อกซ์คอนเทนเนอร์ Docker และ OCI แบบไม่ต้องรูทสำหรับเซิร์ฟเวอร์ MCP
นโยบาย IDE ที่ประกาศบังคับใช้การสร้าง distroless แบบหลายขั้นตอน, การดำเนินการ UID 65532 ที่ไม่ใช่รูท, --cap-drop=ALL และระบบไฟล์รูทแบบอ่านอย่างเดียวสำหรับคอนเทนเนอร์ MCP
ไฟล์กฎตัวแทนและ IDE ที่ประกาศ
---
description: Harden Dockerfiles and OCI MCP containers with non-root users, dropped Linux capabilities, and read-only filesystems
globs: **/{Dockerfile*,*compose*.yml,*compose*.yaml}
alwaysApply: false
---
# Rootless OCI & Docker Sandboxing Rules for AI Agents
- Build production binaries/wheels in multi-stage Dockerfiles and copy only runtime artifacts into minimal `distroless` or `alpine` pinned-digest images.
- Always declare a non-root user (`USER 65532:65532` or `USER appuser`) before `ENTRYPOINT`/`CMD`; never run MCP STDIO servers as `root`.
- Run untrusted third-party MCP containers with `--read-only --tmpfs /tmp:rw,noexec,nosuid,size=64m --cap-drop=ALL --security-opt=no-new-privileges`.
- Add `--network=none` for local filesystem, AST, or SQLite MCP containers that do not require external internet egress.
- Never bake `.env` files, SSH keys, or npm/pip auth tokens into image layers; use BuildKit `--mount=type=secret` when build-time auth is needed.
## Verification Check
```bash
grep -L '^USER ' Dockerfile* && exit 1 || echo 'Non-root USER verified'
```หมายเหตุการตั้งค่าชุมชนและบทวิจารณ์การผลิต (0)
ยังไม่มีบันทึกของชุมชน แบ่งปันเคล็ดลับการกำหนดค่าการใช้งานจริงของคุณด้านล่าง
เครื่องมือ MCP ที่เปิดเผยและตัวตรวจสอบสคีมาทรัพยากร
| เครื่องมือ / ตัวระบุทรัพยากร | พารามิเตอร์อินพุต | พฤติกรรมการดำเนินการ |
|---|---|---|
| non_root_readonly_oci | **/Dockerfile*, compose*.yml | Mandates USER 65532:65532, --read-only, and --security-opt=no-new-privileges. |