test(scripts): add Pester tests for security validation scripts#218
Merged
WilliamBerryiii merged 6 commits intomainfrom Jan 21, 2026
Merged
test(scripts): add Pester tests for security validation scripts#218WilliamBerryiii merged 6 commits intomainfrom
WilliamBerryiii merged 6 commits intomainfrom
Conversation
- add Test-DependencyPinning.Tests.ps1 for SHA and download security - add Test-SHAStaleness.Tests.ps1 for token and staleness detection - add Update-ActionSHAPinning.Tests.ps1 for workflow updates - add workflow and security fixtures for test isolation 🧪 - Generated by Copilot
- add Test-DependencyPinning.Tests.ps1 for SHA and download security - add Test-SHAStaleness.Tests.ps1 for token and staleness detection - add Update-ActionSHAPinning.Tests.ps1 for workflow updates - add workflow and security fixtures for test isolation 🧪 - Generated by Copilot
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive Pester test coverage for three security validation scripts in the scripts/security/ directory. The tests validate SHA pinning enforcement, staleness checking, and GitHub Actions SHA update functionality.
Changes:
- Added 166 Pester tests across three test files covering security validation scripts
- Created YAML and JSON test fixtures to support workflow and checksum validation testing
- Added shell script fixture for testing insecure download detection
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/tests/security/Update-ActionSHAPinning.Tests.ps1 |
46 tests for Get-ActionReference, Get-SHAForAction, and Update-WorkflowFile functions |
scripts/tests/security/Test-SHAStaleness.Tests.ps1 |
54 tests for GitHub token validation, API retry logic, and version comparison |
scripts/tests/security/Test-DependencyPinning.Tests.ps1 |
66 tests for SHA pinning validation, shell download security, and compliance reporting |
scripts/tests/Fixtures/Workflows/unpinned-workflow.yml |
Test fixture with unpinned GitHub Actions for validation testing |
scripts/tests/Fixtures/Workflows/shell-downloads.yml |
Test fixture demonstrating secure and insecure download patterns |
scripts/tests/Fixtures/Workflows/pinned-workflow.yml |
Test fixture with properly SHA-pinned GitHub Actions |
scripts/tests/Fixtures/Workflows/mixed-pinning-workflow.yml |
Test fixture with both pinned and unpinned actions |
scripts/tests/Fixtures/Security/valid-checksums.json |
Test fixture with current tool version and checksums |
scripts/tests/Fixtures/Security/outdated-checksums.json |
Test fixture with outdated tool version for staleness testing |
scripts/tests/Fixtures/Security/insecure-download.sh |
Bash script fixture demonstrating downloads without checksum verification |
- add shebang to insecure-download.sh fixture for proper shell script detection - use TestDrive:/ paths for cross-platform temp file handling in tests - extract script-level variables via AST to avoid main block execution - filter class methods/constructors from function extraction to prevent duplicates - refactor tautological test to validate actual function behavior 🔧 - Generated by Copilot
🔧 - Generated by Copilot
katriendg
approved these changes
Jan 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds comprehensive Pester test coverage for the three security validation scripts in
scripts/security/, completing the test suite for security tooling.Coverage summary:
Test-DependencyPinning.ps1Test-SHAPinning,Test-ShellDownloadSecurity,Get-DependencyViolation,Export-ComplianceReportTest-SHAStaleness.ps1Test-GitHubToken,Invoke-GitHubAPIWithRetry,Write-SecurityLog,Compare-ToolVersionUpdate-ActionSHAPinning.ps1Get-ActionReference,Get-SHAForAction,Update-WorkflowFileTotal: 166 tests covering parameter validation, boundary conditions, error handling, and mock-based scenarios.
Supporting fixtures added:
Fixtures/Security/- JSON fixtures for checksum validation testingFixtures/Workflows/- YAML workflow files for pinning validation testingRelated Issue(s)
Closes #199
Type of Change
Testing
Test execution results:
Validation commands:
All 21 PowerShell files pass PSScriptAnalyzer with no warnings or errors.
Checklist
Security Considerations
No production code is modified. All changes are test infrastructure only.
Additional Notes
Minor documentation updates included:
applyToquoting inuv-projects.instructions.md.cspell.json(removed unused words, adjusted ignore patterns)