fix(scripts): apply CI output escaping to linting scripts#367
fix(scripts): apply CI output escaping to linting scripts#367WilliamBerryiii merged 2 commits intomainfrom
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #367 +/- ##
==========================================
- Coverage 52.46% 52.38% -0.08%
==========================================
Files 17 17
Lines 3084 3100 +16
==========================================
+ Hits 1618 1624 +6
- Misses 1466 1476 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR applies output escaping to linting scripts to prevent GitHub Actions workflow command injection vulnerabilities. The changes add escaping for special characters (%, \r, \n, ::) in error messages and file paths before emitting ::error:: or ::warning:: annotations.
Changes:
- Added inline escaping pattern to six linting scripts' catch blocks:
Invoke-LinkLanguageCheck.ps1,Invoke-PSScriptAnalyzer.ps1,Invoke-YamlLint.ps1,Link-Lang-Check.ps1,Markdown-Link-Check.ps1,Validate-MarkdownFrontmatter.ps1 - Enhanced
Write-GitHubAnnotationfunction inLintingHelpers.psm1with message and property escaping - Property values receive additional colon/comma escaping per GitHub Actions annotation syntax
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/linting/Validate-MarkdownFrontmatter.ps1 | Added escaping to catch block error output |
| scripts/linting/Modules/LintingHelpers.psm1 | Enhanced Write-GitHubAnnotation with message and file path escaping |
| scripts/linting/Markdown-Link-Check.ps1 | Added escaping to catch block error output |
| scripts/linting/Link-Lang-Check.ps1 | Added escaping to catch block error output |
| scripts/linting/Invoke-YamlLint.ps1 | Added escaping to catch block error output |
| scripts/linting/Invoke-PSScriptAnalyzer.ps1 | Added escaping to catch block error output |
| scripts/linting/Invoke-LinkLanguageCheck.ps1 | Added escaping to catch block error output |
auyidi1
left a comment
There was a problem hiding this comment.
looks good. you might want to consider accepting some of the copilot comments/suggestions.
yeah, making my way back to these after working on a bunch of the other PR's ... thanks for the review. This should help me refactor the build scripts to be safer and more testable/consistent. |
Apply ConvertTo-GitHubActionsEscaped to prevent workflow command injection. Closes #364 🔒 - Generated by Copilot
- add CIHelpers import to 6 linting scripts and LintingHelpers module - replace inline -replace chains with ConvertTo-GitHubActionsEscaped - use -ForProperty switch for file path escaping in annotations 🔧 - Generated by Copilot
9893139 to
49e398e
Compare
🤖 I have created a release *beep* *boop* --- ## [2.1.0](hve-core-v2.0.1...hve-core-v2.1.0) (2026-02-04) ### ✨ Features * add PowerShell script to validate copyright headers ([#370](#370)) ([92fce72](92fce72)) * **docs:** Replace deprecated chat.modeFilesLocations with chat.agentFilesLocations ([#413](#413)) ([67fb2ab](67fb2ab)) * **scripts:** add CIHelpers module for CI platform abstraction ([#348](#348)) ([23e7a7e](23e7a7e)) * **scripts:** add SecurityHelpers and CIHelpers modules ([#354](#354)) ([b93d990](b93d990)) * **workflow:** add copilot-setup-steps.yml for Coding Agent environment ([#398](#398)) ([085a38b](085a38b)) ### 🐛 Bug Fixes * **build:** increase release-please search depths to prevent 250-commit window issue ([#342](#342)) ([4bb857d](4bb857d)) * **build:** patch @isaacs/brace-expansion critical vulnerability ([#404](#404)) ([292ef51](292ef51)) * **ci:** disable errexit during spell check exit code capture ([#356](#356)) ([ed6ed46](ed6ed46)) * **ci:** exclude extension/README.md from frontmatter validation ([#362](#362)) ([e0d7378](e0d7378)) * exclude test fixtures from markdown link checker ([#345](#345)) ([58147f9](58147f9)) * **extension:** resolve path resolution issues in Windows/WSL environments ([#407](#407)) ([8529725](8529725)) * **linting:** use Write-Error instead of Write-Host for error output ([#377](#377)) ([2ca766b](2ca766b)) * **scripts:** apply CI output escaping to infrastructure scripts ([#369](#369)) ([251021e](251021e)) * **scripts:** apply CI output escaping to linting scripts ([#367](#367)) ([fdd75ed](fdd75ed)) * **scripts:** apply CI output escaping to security scripts ([#368](#368)) ([1237c9a](1237c9a)) * **scripts:** ensure reliable array count operations in linting and security scripts ([#395](#395)) ([de43e73](de43e73)) * **scripts:** standardize PowerShell requirements header block ([#385](#385)) ([6e26282](6e26282)) ### 📚 Documentation * add doc-ops agent to CUSTOM-AGENTS reference ([#358](#358)) ([15f7185](15f7185)) * add memory agent to CUSTOM-AGENTS.md ([#359](#359)) ([d92c4e1](d92c4e1)) * add missing agents to extension README ([#357](#357)) ([d58541c](d58541c)) * add task-reviewer agent to CUSTOM-AGENTS.md ([#363](#363)) ([0efb722](0efb722)) * **contributing:** add copyright header guidelines ([#382](#382)) ([881a567](881a567)) * **scripts:** update README.md with missing directory sections ([#355](#355)) ([ac2966f](ac2966f)) ### ♻️ Refactoring * **scripts:** align linting and tests with CIHelpers ([#401](#401)) ([3587e6a](3587e6a)) * **scripts:** extract Invoke-PackageExtension for testability ([#343](#343)) ([858a1be](858a1be)) * **scripts:** extract orchestration function for Prepare-Extension testability ([#344](#344)) ([9fd4bd1](9fd4bd1)) * **scripts:** replace raw GITHUB_OUTPUT with Set-CIOutput in Package-Extension ([#391](#391)) ([74a30bb](74a30bb)) * **security:** move DependencyViolation and ComplianceReport to shared module ([#378](#378)) ([1dd31ad](1dd31ad)) ### 🔧 Maintenance * add copyright headers to PowerShell scripts ([#381](#381)) ([d19c9b3](d19c9b3)) * add copyright headers to shell scripts ([#380](#380)) ([284b456](284b456)) * **deps-dev:** bump cspell from 9.6.1 to 9.6.2 in the npm-dependencies group ([#387](#387)) ([23c2b9f](23c2b9f)) * **workflows:** simplify Copilot setup steps workflow triggers ([#414](#414)) ([492a7b1](492a7b1)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: hve-core-release-please[bot] <254602402+hve-core-release-please[bot]@users.noreply.github.com> Co-authored-by: Bill Berry <wberry@microsoft.com>
Description
Apply output escaping to all linting scripts to prevent GitHub Actions workflow command injection vulnerabilities. When exception messages or file paths contain special characters (
%,\r,\n,::), they could be interpreted as workflow commands. This change escapes these characters before emitting::error::or::warning::annotations.Changes:
Invoke-LinkLanguageCheck.ps1,Invoke-PSScriptAnalyzer.ps1,Invoke-YamlLint.ps1,Link-Lang-Check.ps1,Markdown-Link-Check.ps1,Validate-MarkdownFrontmatter.ps1Write-GitHubAnnotationinLintingHelpers.psm1to escape both message content and file path properties:/,escaping per GitHub Actions annotation syntax requirementsRelated Issue(s)
Closes #364
Type of Change
Select all that apply:
Code & Documentation:
Infrastructure & Configuration:
AI Artifacts:
prompt-builderagent and addressed all feedback.github/instructions/*.instructions.md).github/prompts/*.prompt.md).github/agents/*.agent.md)Other:
.ps1,.sh,.py)Sample Prompts (for AI Artifact Contributions)
N/A - This is a script change, not an AI artifact contribution.
Testing
@actions/coreimplementation%,\r,\n,::in exception messagesChecklist
Required Checks
AI Artifact Contributions
N/A
Required Automated Checks
The following validation commands must pass before merging:
npm run lint:mdnpm run spell-checknpm run lint:frontmatternpm run lint:md-linksnpm run lint:psSecurity Considerations
Additional Notes
This is part of a series of PRs applying CI output escaping across the codebase. Related PRs address security scripts (#365) and infrastructure scripts (#366).