|
| 1 | +# Security Policy |
| 2 | + |
| 3 | +## Supported Versions |
| 4 | + |
| 5 | +We release patches for security vulnerabilities. Currently supported versions: |
| 6 | + |
| 7 | +| Version | Supported | |
| 8 | +| ------- | ------------------ | |
| 9 | +| latest | :white_check_mark: | |
| 10 | +| < latest| :x: | |
| 11 | + |
| 12 | +## Reporting a Vulnerability |
| 13 | + |
| 14 | +We take the security of PSScriptModule seriously. If you believe you have found a security vulnerability, please report it to us as described below. |
| 15 | + |
| 16 | +### Please Do Not |
| 17 | + |
| 18 | +- **Do not** open a public GitHub issue for security vulnerabilities |
| 19 | +- **Do not** disclose the vulnerability publicly until it has been addressed |
| 20 | + |
| 21 | +### Please Do |
| 22 | + |
| 23 | +1. **Report via GitHub Security Advisories**: |
| 24 | + - Navigate to the repository's "Security" tab |
| 25 | + - Click "Report a vulnerability" |
| 26 | + - Provide detailed information about the vulnerability |
| 27 | + |
| 28 | +1. **Include in Your Report**: |
| 29 | + - Description of the vulnerability |
| 30 | + - Steps to reproduce the issue |
| 31 | + - Potential impact |
| 32 | + - Suggested fix (if available) |
| 33 | + - Your contact information |
| 34 | + |
| 35 | +## Security Best Practices |
| 36 | + |
| 37 | +When using this PowerShell module template: |
| 38 | + |
| 39 | +### Code Security |
| 40 | + |
| 41 | +- **Never commit credentials**: Use `SecureString` or credential management systems |
| 42 | +- **Validate all inputs**: Use parameter validation attributes |
| 43 | +- **Sanitize user input**: Prevent injection attacks |
| 44 | +- **Use approved verbs**: Follow PowerShell naming conventions |
| 45 | +- **Handle errors properly**: Don't expose sensitive information in error messages |
| 46 | + |
| 47 | +### Development Security |
| 48 | + |
| 49 | +- **Run PSScriptAnalyzer**: All code must pass static analysis |
| 50 | +- **Run InjectionHunter tests**: Check for injection vulnerabilities |
| 51 | +- **Review dependencies**: Regularly update modules in `requirements.psd1` |
| 52 | + |
| 53 | +### Deployment Security |
| 54 | + |
| 55 | +- **Sign your scripts**: Use code signing certificates for production |
| 56 | +- **Verify execution policy**: Use appropriate PowerShell execution policies |
| 57 | +- **Limit permissions**: Follow principle of least privilege |
| 58 | +- **Audit module usage**: Enable PowerShell logging in production environments |
| 59 | + |
| 60 | +## Known Security Considerations |
| 61 | + |
| 62 | +### PowerShell Execution |
| 63 | + |
| 64 | +This module requires PowerShell script execution. Ensure: |
| 65 | + |
| 66 | +- Execution policy is set appropriately for your environment |
| 67 | +- Scripts are obtained from trusted sources |
| 68 | +- Code signing is enforced in production environments |
| 69 | + |
| 70 | +### External Dependencies |
| 71 | + |
| 72 | +This project uses external PowerShell modules: |
| 73 | + |
| 74 | +- **InvokeBuild**: Build orchestration |
| 75 | +- **Pester**: Testing framework |
| 76 | +- **PSScriptAnalyzer**: Static code analysis |
| 77 | +- **platyPS**: Documentation generation |
| 78 | + |
| 79 | +Review the security advisories for these dependencies regularly. |
| 80 | + |
| 81 | +## Security Testing |
| 82 | + |
| 83 | +### Automated Tests |
| 84 | + |
| 85 | +Every PR runs: |
| 86 | + |
| 87 | +1. **PSScriptAnalyzer**: Static code analysis for common issues |
| 88 | +1. **InjectionHunter**: Detection of potential injection vulnerabilities |
| 89 | +1. **Pester Tests**: Functional testing including security scenarios |
| 90 | +1. **Dependency Checks**: Ensure dependencies are up-to-date |
| 91 | + |
| 92 | +## Security Update Process |
| 93 | + |
| 94 | +When a security vulnerability is confirmed: |
| 95 | + |
| 96 | +1. **Assessment**: Evaluate severity and impact |
| 97 | +1. **Fix Development**: Create patch in private branch |
| 98 | +1. **Testing**: Thoroughly test the security fix |
| 99 | +1. **Release**: |
| 100 | + - Use `+semver: patch` for minor security fixes |
| 101 | + - Use `+semver: major` for breaking security changes |
| 102 | +1. **Disclosure**: Publish security advisory after fix is released |
| 103 | +1. **Notification**: Notify users of the security update |
| 104 | + |
| 105 | +## Additional Resources |
| 106 | + |
| 107 | +- [PowerShell Security Best Practices](https://docs.microsoft.com/en-us/powershell/scripting/learn/security/powershell-security-best-practices) |
| 108 | +- [PSScriptAnalyzer Rules](https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/Rules/README.md) |
| 109 | +- [OWASP Secure Coding Practices](https://owasp.org/www-project-secure-coding-practices-quick-reference-guide/) |
| 110 | + |
| 111 | +## Contact |
| 112 | + |
| 113 | +For security-related questions that are not vulnerabilities, please open a regular GitHub issue or discussion. |
| 114 | + |
| 115 | +--- |
| 116 | + |
| 117 | +**Thank you for helping keep PSScriptModule and its users safe!** |
0 commit comments