Skip to content

Conversation

@zenyr
Copy link
Owner

@zenyr zenyr commented Oct 25, 2025

Summary

Umbrella PR for Phase 6.2 Security Hardening implementation.

This PR covers all security hardening tasks from issue #23, including command injection prevention, privilege escalation bypass fixes, PTY write injection filtering, shell metachar attacks protection, and environment variable pollution mitigation.

Tasks

  • Critical Issues (Pre-Release): sec-1 to sec-15
  • Medium Priority (Post v1.0): sec-16 to sec-26

Stacked PRs will be created under this umbrella for individual task implementations.

@zenyr zenyr force-pushed the feature/security-hardening branch 2 times, most recently from fda028c to df4ad7d Compare October 25, 2025 10:32
zenyr added 9 commits October 25, 2025 20:22
- Transport reuse causes 400 errors when reconnecting after server restart
- Defer connection until first request, consistent with new session init
- Create fresh transport for each reconnection attempt
- Verified with manual reconnection test scenario
- Log method, session ID, and content headers for each request
- Uses console.log for visibility in pm2 logs
- Non-destructive to request handling (no body reading)
- Add string pattern detection for fork bomb (:(){ :|:& };:)
- Re-enable fork bomb test case
- Part of sec-1 security hardening implementation
- AgentLog: 032-security-hardening-sec1-fork-bomb-detection.md
- Mark sec-1~6 as completed
- Reorganize sec-7~26 priorities based on risk assessment
- Add rejected section for unnecessary items
- Update roadmap with current status

AgentLog: 032-security-hardening-sec1-fork-bomb-detection.md
- Update sec-2 to include sh -c argument validation
- Update sec-3 to specify AST-based recursive validation
- Addresses potential bypass via sh -c 'malicious'
…source limits)

- Add environment variable sanitization to remove dangerous vars (LD_PRELOAD, etc.)
- Implement recursive AST validation for sh -c arguments to prevent bypass attacks
- Add PTY count limit per session (10 max) to prevent resource exhaustion
- Add execution timeout for PTY processes with activity-based reset
- Add comprehensive tests for all security features
- Add comprehensive agentlog documenting all security measures
- Minor style fixes: import reordering, test cleanup
- Remove PATH from DANGEROUS_ENV_VARS as it breaks basic commands like ls
- Rely on existing validateCommandAST for security instead
- Maintains usability while preventing library injection attacks
@zenyr zenyr force-pushed the feature/security-hardening branch from 4638008 to a2d51d7 Compare October 25, 2025 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants