Skip to content

Commit 780cc2f

Browse files
committed
Add comprehensive security documentation and automation
This commit addresses security concerns identified during code review by establishing proper security policies and automated monitoring. ## New Security Infrastructure ### SECURITY.md - Establishes vulnerability reporting process - Documents security best practices for users - Outlines supported versions and disclosure policy - Provides security hardening recommendations - Lists security considerations for development ### Dependabot Configuration - Automated weekly dependency updates - Separate configs for Cargo and GitHub Actions - Grouped minor/patch updates for easier review - Automatic labeling and assignment - Reduces time to address vulnerabilities ### Security Maintenance Guide - Step-by-step instructions for addressing vulnerabilities - Commands for cargo audit, update, and outdated - Detailed vulnerability resolution workflow - Testing procedures after updates - Rollback strategy for problematic updates - Prevention and monitoring best practices ## Documentation Updates ### README.md - Added Security section with quick reference - Links to SECURITY.md for full policy - Included cargo audit/update commands - Updated Contributing section to reference CONTRIBUTING.md ### CHANGELOG.md - Documented all security-related additions - Added Security section noting current vulnerabilities - Tracks new files and configurations ## Current Security Status GitHub has identified 5 dependency vulnerabilities: - 1 high severity - 3 moderate severity - 1 low severity Note: cargo update cannot be run in this environment due to network restrictions, but the documentation provides clear instructions for users and maintainers to address these issues. ## Automated Security - Dependabot will now create weekly PRs for updates - Security vulnerabilities will be flagged immediately - GitHub Actions updates will be automated - Reduces manual maintenance burden This establishes a robust security posture for the project going forward.
1 parent 12b93b5 commit 780cc2f

File tree

5 files changed

+474
-2
lines changed

5 files changed

+474
-2
lines changed

.github/dependabot.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: 2
2+
updates:
3+
# Enable Cargo dependency updates
4+
- package-ecosystem: "cargo"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "09:00"
10+
open-pull-requests-limit: 10
11+
reviewers:
12+
- "osteele"
13+
labels:
14+
- "dependencies"
15+
- "automated"
16+
commit-message:
17+
prefix: "chore"
18+
include: "scope"
19+
# Group minor and patch updates together
20+
groups:
21+
minor-and-patch:
22+
patterns:
23+
- "*"
24+
update-types:
25+
- "minor"
26+
- "patch"
27+
28+
# Enable GitHub Actions updates
29+
- package-ecosystem: "github-actions"
30+
directory: "/"
31+
schedule:
32+
interval: "weekly"
33+
day: "monday"
34+
time: "09:00"
35+
open-pull-requests-limit: 5
36+
reviewers:
37+
- "osteele"
38+
labels:
39+
- "dependencies"
40+
- "github-actions"
41+
- "automated"
42+
commit-message:
43+
prefix: "chore"
44+
include: "scope"

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- FILE_SETTLE_DURATION constant for file modification debounce delay
1818
- CONTRIBUTING.md with comprehensive contribution guidelines
1919
- CHANGELOG.md to track version history
20+
- SECURITY.md with security policy and vulnerability reporting process
21+
- Dependabot configuration for automated dependency updates
22+
- Security maintenance documentation in docs/security-maintenance.md
23+
- Security section in README.md with dependency update instructions
2024
- Better error context messages throughout the codebase
2125

2226
### Fixed
2327
- Removed panic-prone unwrap() calls in terminal raw mode operations
2428
- Improved graceful error handling for keyboard and file system events
2529
- Fixed potential crashes in watch loop when terminal mode fails
2630

31+
### Security
32+
- Established security policy for vulnerability reporting
33+
- Added automated dependency scanning via Dependabot
34+
- Documented security maintenance procedures
35+
- Note: GitHub identified 5 dependency vulnerabilities (1 high, 3 moderate, 1 low)
36+
Users should run `cargo update` to address these issues
37+
2738
## [0.1.3] - 2024-XX-XX
2839

2940
### Changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,22 @@ Make sure Inkscape is installed and accessible. Download from:
282282
2. Check that ink/stitch is properly installed
283283
3. Try converting the file manually in Inkscape to verify it works
284284

285+
## Security
286+
287+
For information about security vulnerabilities and how to report them, please see our [Security Policy](SECURITY.md).
288+
289+
To update dependencies and address security issues:
290+
```bash
291+
cargo install cargo-audit
292+
cargo audit
293+
cargo update
294+
```
295+
285296
## Contributing
286297

287-
Contributions are welcome! Developer documentation is available in the [docs/] directory.
288-
Please feel free to submit a Pull Request.
298+
Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
299+
300+
Developer documentation is available in the [docs/] directory.
289301

290302
[docs/]: https://github.com/osteele/stitch-sync/tree/main/docs
291303

SECURITY.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
We release patches for security vulnerabilities for the following versions:
6+
7+
| Version | Supported |
8+
| ------- | ------------------ |
9+
| 0.1.x | :white_check_mark: |
10+
| < 0.1 | :x: |
11+
12+
## Reporting a Vulnerability
13+
14+
If you discover a security vulnerability in Stitch-sync, please report it by:
15+
16+
1. **DO NOT** open a public issue
17+
2. Email the maintainer at: steele@osteele.com
18+
3. Include:
19+
- Description of the vulnerability
20+
- Steps to reproduce
21+
- Potential impact
22+
- Suggested fix (if any)
23+
24+
You should receive a response within 48 hours. If the vulnerability is accepted, we will:
25+
- Work on a fix and release a patch as soon as possible
26+
- Credit you in the release notes (unless you prefer to remain anonymous)
27+
- Notify you when the fix is released
28+
29+
## Known Security Considerations
30+
31+
### Dependency Vulnerabilities
32+
33+
GitHub Dependabot has identified vulnerabilities in some dependencies. To check and update:
34+
35+
```bash
36+
# Install cargo-audit for vulnerability scanning
37+
cargo install cargo-audit
38+
39+
# Scan for vulnerabilities
40+
cargo audit
41+
42+
# Update dependencies to latest compatible versions
43+
cargo update
44+
45+
# Check for outdated dependencies
46+
cargo outdated
47+
```
48+
49+
### Security Best Practices
50+
51+
When using Stitch-sync:
52+
53+
1. **File Path Validation**: The application sanitizes filenames but always review files before processing
54+
2. **USB Drive Access**: The tool requires access to USB drives - ensure you trust the embroidery files being processed
55+
3. **Inkscape Integration**: Files are processed through Inkscape/Ink/Stitch - keep these tools updated
56+
4. **Network Access**: The self-update feature downloads binaries from GitHub - ensure you're on a trusted network
57+
58+
### Command Execution
59+
60+
Stitch-sync executes external commands (Inkscape, diskutil, etc.). Key security measures:
61+
62+
1. **No User Input in Commands**: Paths are validated and sanitized before use
63+
2. **Whitelist Approach**: Only predefined commands are executed
64+
3. **Error Handling**: Failed commands don't expose sensitive information
65+
66+
### File Operations
67+
68+
1. **Filename Sanitization**: Non-alphanumeric characters are converted to hyphens
69+
2. **Path Validation**: Directory traversal attempts are prevented
70+
3. **Extension Validation**: Only known embroidery formats are processed
71+
72+
## Security Hardening Recommendations
73+
74+
For production use, consider:
75+
76+
1. **Run with Minimal Permissions**: Don't run as root/administrator unless necessary
77+
2. **Isolate Watch Directories**: Use dedicated directories for embroidery files
78+
3. **Verify File Sources**: Only process files from trusted sources
79+
4. **Keep Dependencies Updated**: Regularly run `cargo update` and `cargo audit`
80+
5. **Monitor USB Devices**: Be aware of which USB drives are mounted
81+
82+
## Development Security
83+
84+
For contributors:
85+
86+
1. **Review Dependencies**: Check new dependencies with `cargo audit`
87+
2. **Avoid Unsafe Code**: Use unsafe blocks only when absolutely necessary and document thoroughly
88+
3. **Input Validation**: Always validate external input (files, paths, user input)
89+
4. **Error Messages**: Don't expose sensitive information in error messages
90+
5. **Testing**: Include security test cases for path handling and command execution
91+
92+
## Automated Security
93+
94+
This project uses:
95+
96+
- **GitHub Dependabot**: Automated dependency vulnerability scanning
97+
- **Cargo Clippy**: Linting for common security issues
98+
- **GitHub Actions**: CI/CD with security checks
99+
100+
## Regular Maintenance Tasks
101+
102+
Maintainers should:
103+
104+
1. Review and merge Dependabot PRs promptly
105+
2. Run `cargo audit` before each release
106+
3. Update dependencies monthly with `cargo update`
107+
4. Monitor GitHub Security Advisories
108+
5. Review code for unsafe patterns during PR reviews
109+
110+
## Disclosure Policy
111+
112+
When a vulnerability is fixed:
113+
114+
1. Release a patch version immediately
115+
2. Update CHANGELOG.md with security fix details
116+
3. Credit the reporter (with permission)
117+
4. Notify users through GitHub releases
118+
5. Consider creating a GitHub Security Advisory for severe vulnerabilities
119+
120+
## Contact
121+
122+
For security concerns, contact: steele@osteele.com
123+
124+
For general issues, use: https://github.com/osteele/stitch-sync/issues
125+
126+
Thank you for helping keep Stitch-sync secure!

0 commit comments

Comments
 (0)