check-docker-user-permissions
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "check-docker-user-permissions" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-c67c1a01850bf2de2471b7da2ab6031f9bc8c2b641899270083caaf77fdf99a6. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Check Docker user and permission configurations. Detect issues such as running as root, incorrect file ownership, and missing necessary security constraints.
Introduction source: third_party · dykyi-roman · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Checks Docker user and permission configuration. Detects root execution, improper file ownership, and missing security constraints.
- Inputs and outputs
- ```markdown
- Testing
- Not tested
Browse files
Frontmatter
name: check-docker-user-permissions
description: Checks Docker user and permission configuration. Detects root execution, improper file ownership, and missing security constraints.Docker User and Permission Check
Analyze Docker configurations for user, ownership, and permission issues in PHP containers.
Permission Check Patterns
| Check | Risk | Detection |
|---|---|---|
| No USER instruction | Root execution | Missing USER in Dockerfile |
| Wrong UID/GID | Permission conflicts | Non-standard user IDs |
| COPY without --chown | Root-owned files | COPY without ownership |
| chmod 777 | World-writable files | Overly permissive mode |
| Volume permission mismatch | Read/write failures | Host vs container UID |
| Read-only FS incompatibility | Runtime crashes | Missing tmpfs for writable dirs |
Detection Patterns
1. USER Instruction Present
# INSECURE: No USER instruction (runs as root PID 1)
FROM php:8.4-fpm-alpine
COPY . /var/www/
CMD ["php-fpm"]
# SECURE: Non-root user defined
FROM php:8.4-fpm-alpine
RUN addgroup -g 1000 -S appgroup \
&& adduser -u 1000 -S appuser -G appgroup
USER appuser
CMD ["php-fpm"]
2. Correct UID/GID Convention
# Alpine: addgroup / adduser (BusyBox)
RUN addgroup -g 1000 -S appgroup \
&& adduser -u 1000 -S appuser -G appgroup -h /var/www -s /sbin/nologin
# Debian: groupadd / useradd (shadow)
RUN groupadd -g 1000 appgroup \
&& useradd -u 1000 -g appgroup -d /var/www -s /usr/sbin/nologin -M appuser
3. File Ownership After COPY
# INSECURE: Files owned by root after COPY
COPY . /var/www/
# SECURE: Set ownership during COPY
COPY --chown=appuser:appgroup . /var/www/
# SECURE: Set ownership in multi-stage
COPY --from=builder --chown=appuser:appgroup /app/vendor /var/www/vendor
4. No chmod 777
# INSECURE: World-writable permissions
RUN chmod -R 777 /var/www/var
# SECURE: Minimal permissions
RUN mkdir -p /var/www/var/cache /var/www/var/log \
&& chown -R appuser:appgroup /var/www/var \
&& chmod -R 755 /var/www/var
5. Volume Permissions
# PROBLEM: Host UID doesn't match container UID
services:
php-fpm:
volumes:
- ./src:/var/www/src # May cause permission issues
# SOLUTION: Read-only bind mounts + named volumes
services:
php-fpm:
user: "1000:1000"
volumes:
- ./src:/var/www/src:ro # Read-only (no permission issues)
- cache:/var/www/var/cache # Named volume
- logs:/var/www/var/log # Named volume
6. Read-Only Filesystem Compatibility
services:
php-fpm:
read_only: true
tmpfs:
- /tmp:noexec,nosuid,size=64m
- /var/run:noexec,nosuid,size=1m
volumes:
- cache:/var/www/var/cache
- logs:/var/www/var/log
User Creation: Alpine vs Debian
# Alpine (BusyBox): -g GID -S system -u UID -G group -h home -s shell
RUN addgroup -g 1000 -S appgroup \
&& adduser -u 1000 -S appuser -G appgroup -h /var/www -s /sbin/nologin
# Debian (shadow): -g GID/group -u UID -d home -s shell -M no home dir
RUN groupadd -g 1000 appgroup \
&& useradd -u 1000 -g appgroup -d /var/www -s /usr/sbin/nologin -M appuser
# Using existing www-data (UID 82 on Alpine, 33 on Debian)
USER www-data
Grep Patterns
# USER instruction
Grep: "^USER " --glob "**/Dockerfile*"
# User creation commands
Grep: "adduser|useradd|addgroup|groupadd" --glob "**/Dockerfile*"
# COPY without --chown
Grep: "^COPY(?!.*--chown)" --glob "**/Dockerfile*"
# Overly permissive chmod
Grep: "chmod.*(777|666|a\+[rw])" --glob "**/Dockerfile*"
# chown commands
Grep: "chown" --glob "**/Dockerfile*"
# Read-only filesystem
Grep: "read_only:" --glob "**/docker-compose*.yml"
# tmpfs mounts
Grep: "tmpfs:" --glob "**/docker-compose*.yml"
Severity Classification
| Pattern | Severity | Impact |
|---|---|---|
| No USER instruction (production) | Critical | Container runs as root |
| chmod 777 on application dirs | High | Any process can modify files |
| COPY without --chown (with USER) | High | Files inaccessible to app user |
| System UID (< 1000) for app user | Medium | Potential privilege confusion |
| Volume mount without :ro | Medium | Unnecessary write access |
| No read-only rootfs | Medium | Filesystem can be modified |
| Missing tmpfs for /tmp | Low | Temp files on persistent storage |
Output Format
### Permission Issue: [Check Name]
**Severity:** Critical/High/Medium/Low
**File:** `<file_path>:<line>`
**Check:** USER / Ownership / chmod / Volume / Read-only FS
**Detection:**
[How the issue was identified]
**Risk:**
[Security or operational impact]
**Current:**
```dockerfile
// Current configuration
Remediation:
// Secure configuration
Platform Notes:
- Alpine: [Alpine-specific instructions]
- Debian: [Debian-specific instructions]
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 Docker 用户权限安全检查能力,针对 PHP 容器场景,具有明确的安全价值
- 涵盖多种常见权限问题(如 root 执行、文件所有权、chmod 777 等),实用性强
Areas to improve
-
触发方式不明确 Reported severity: Minor
description 描述了功能但未提供具体的触发关键词或命令示例
Recommendation: 建议在 description 或 skill_body 开头补充触发方式,如 '使用方式:在终端运行 check-docker-permissions 命令' 或 '触发关键词:docker permission check'
Highlights
- 文档结构清晰,包含检查模式、代码示例、Grep 模式、严重性分类和输出格式
- frontmatter 完整,内容详实,便于用户理解和使用
Areas to improve
-
缺少执行入口说明 Reported severity: Major
Skill 提供了检测模式和修复建议,但未说明如何实际执行检查
Recommendation: 建议补充执行说明,如 '用户需提供 Dockerfile 路径' 或 '运行 check-docker-permissions /path/to/Dockerfile',并说明异常处理机制
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.