This library is designed to be sourced directly from GitHub via curl. While convenient, this approach has important security implications:
- Man-in-the-Middle Attacks: Scripts are fetched over HTTPS, but compromised DNS or network infrastructure could redirect requests
- Repository Compromise: If the GitHub repository is compromised, malicious code could be distributed
- Supply Chain: Dependencies and external scripts could introduce vulnerabilities
- Unreviewed Updates: Using
masterbranch means getting latest changes without review
1. Pin to Specific Versions (Recommended)
# Instead of master branch
source /dev/stdin <<<"$(curl -s "https://raw.githubusercontent.com/dotbrains/utilities/master/utilities.sh")"
# Use tagged releases
source /dev/stdin <<<"$(curl -s "https://raw.githubusercontent.com/dotbrains/utilities/v1.0.0/utilities.sh")"2. Review Code Before Use
# Download and review first
curl -o utilities.sh "https://raw.githubusercontent.com/dotbrains/utilities/v1.0.0/utilities.sh"
less utilities.sh # Review the code
# Then use it
source utilities.sh3. Local Caching
For production or airgapped environments:
# Cache locally
mkdir -p "$HOME/.local/lib/utilities"
cd "$HOME/.local/lib/utilities"
git clone https://github.com/dotbrains/utilities.git
cd utilities
git checkout v1.0.0 # Pin to specific version
# Source locally
source "$HOME/.local/lib/utilities/utilities.sh"4. Verify Checksums (Future)
Future releases may include checksums for verification:
# Download
curl -o utilities.sh "https://raw.githubusercontent.com/dotbrains/utilities/v1.0.0/utilities.sh"
curl -o utilities.sh.sha256 "https://raw.githubusercontent.com/dotbrains/utilities/v1.0.0/utilities.sh.sha256"
# Verify
sha256sum -c utilities.sh.sha256
# Source if valid
source utilities.sh- Pin Versions: Always use tagged releases in production
- Review Changes: Review CHANGELOG.md before upgrading
- Test First: Test in non-production environments before deploying
- Limit Scope: Use
UTILITIES_MODULESto load only needed modules - Monitor Usage: Audit which scripts use these utilities
- Local Cache: Consider local caching for critical systems
- No Secrets: Never commit secrets, API keys, or credentials
- Input Validation: Validate all user inputs
- Safe Defaults: Use safe defaults that require explicit opt-in for risky operations
- Error Handling: Fail safely and provide clear error messages
- Privilege Escalation: Only request sudo when absolutely necessary
- Code Review: All changes should be reviewed before merging
Functions that require sudo privileges:
ask_for_sudo()- Request admin accesssymlink()- May require sudo for system pathsgem_install()- Installs gems with sudo- Various package manager operations
Best Practice: Only use sudo-requiring functions when necessary, and review what they do.
Functions that make network requests:
- All module loading (via curl from GitHub)
brew_bundle_install()- Downloads packages- Package installation functions
Best Practice: Use in trusted network environments or with cached versions.
Functions that modify files/directories:
symlink()- Creates symbolic linksmkd()- Creates directoriesextract()- Extracts archives- Configuration file modifications
Best Practice: Review target paths before execution.
- Open public issues for security vulnerabilities
- Disclose vulnerabilities publicly before they are fixed
- Email security concerns to the repository maintainer
- Include:
- Description of the vulnerability
- Steps to reproduce
- Potential impact
- Suggested fixes (if any)
- Allow reasonable time for a fix before public disclosure
Security updates will be:
- Released as patch versions (e.g., v1.0.1)
- Documented in CHANGELOG.md with
[SECURITY]prefix - Announced in GitHub Releases
- Applied to supported versions
| Version | Supported |
|---|---|
| 1.0.x | ✅ |
| < 1.0 | ❌ |
Future releases may include:
- GPG signatures for release tags
- Signed commits
- Checksums for verification
The git history provides a complete audit trail of all changes:
# View commit history
git log --oneline
# View specific file history
git log --follow scripts/modules/system/system.sh
# View changes in a commit
git show <commit-hash>If using in regulated environments (financial, healthcare, etc.):
- Fork and Review: Fork the repository and perform security review
- Internal Hosting: Host on internal infrastructure
- Version Control: Strictly control versions used
- Access Logging: Log all usage of utilities
- Compliance Review: Have compliance team review before use
For security questions or concerns, please contact the repository maintainer through GitHub.
Remember: Security is a shared responsibility. Always review code you execute, especially code with elevated privileges or network access.