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
10 changes: 10 additions & 0 deletions containers/agent/seccomp-profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
"SCMP_ARCH_AARCH64"
],
"syscalls": [
{
"names": [
"ptrace",
"process_vm_readv",
"process_vm_writev"
],
"action": "SCMP_ACT_ERRNO",
"errnoRet": 1,
"comment": "Block process inspection/modification"
},
{
"names": [
"kexec_load",
Expand Down
3 changes: 3 additions & 0 deletions src/docker-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ describe('docker-manager', () => {
// Verify seccomp profile is configured
expect(agent.security_opt).toContain('seccomp=/tmp/awf-test/seccomp-profile.json');

// Verify no-new-privileges is enabled to prevent privilege escalation
expect(agent.security_opt).toContain('no-new-privileges:true');

// Verify resource limits
expect(agent.mem_limit).toBe('4g');
expect(agent.memswap_limit).toBe('4g');
Expand Down
7 changes: 5 additions & 2 deletions src/docker-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,11 @@ export function generateDockerCompose(
'SYS_RAWIO', // Prevents raw I/O access
'MKNOD', // Prevents device node creation
],
// Apply seccomp profile to restrict dangerous syscalls
security_opt: [`seccomp=${config.workDir}/seccomp-profile.json`],
// Apply seccomp profile and no-new-privileges to restrict dangerous syscalls and prevent privilege escalation
security_opt: [
'no-new-privileges:true',
`seccomp=${config.workDir}/seccomp-profile.json`,
],
// Resource limits to prevent DoS attacks (conservative defaults)
mem_limit: '4g', // 4GB memory limit
memswap_limit: '4g', // No swap (same as mem_limit)
Expand Down
Loading