OWASP / OWASP/Nest

Add Container Security Hardening to Production/Staging Docker Compose

Open
#3,982 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
451
Forks
707
Avg merge
22h 59m
Merged PRs (30d)
91

Description

**Is your feature request related to a problem? Please describe.**

Production and staging Docker Compose files currently run all 5 services (backend, frontend, cache, db, worker) with **default Docker permissions and no security constraints**. This means containers can escalate privileges, retain all Linux capabilities, have fully writable filesystems, and have no resource or process limits. This leaves unnecessary attack surface and contradicts the principle of least privilege at the container level.

**Describe the solution you'd like**

Apply container security hardening to **all services** in both compose files,

### Before vs After

**Before:**
```yaml
production-nest-cache:
image: redis:8.0.5-alpine3.21
restart: unless-stopped
# no security here
```

**After:**
```yaml
production-nest-cache:
image: redis:8.0.5-alpine3.21
restart: unless-stopped
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
tmpfs:
- /tmp
pids_limit: 100
mem_limit: 150m
```

**Are you going to work on implementing this?**

- [x] Yes
- [ ] No

Contributor guide

Open the contributing guide

Research direction

Locate the production and staging Docker Compose files and review the definitions for all five services: backend, frontend, cache, database, and worker. Apply the requested security and resource constraints consistently, then verify that both Compose configurations remain valid and that every service has the intended hardening.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose
Domain
devops, infrastructure, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.