Skip to content

Commit e5fa379

Browse files
EdwardAngertclaude
andcommitted
fix: resolve regex syntax error in branch validation
- Replace regex pattern with simple string comparisons - Check for specific unsafe shell characters individually - Provide more explicit validation for shell injection characters - Fix syntax error in conditional expression 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 7e150f2 commit e5fa379

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/actions/docs-analysis/action.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,18 @@ runs:
146146
echo "::warning::Documentation path '${{ inputs.docs-path }}' does not exist - some functions may not work correctly"
147147
fi
148148
149-
# Validate branch references with security checks but allow more chars used in branch names
150-
if [[ "${{ inputs.pr-ref }}" =~ [;&|'"'"`] ]]; then
149+
# Validate branch references with basic security checks for shell injection chars
150+
if [[ "${{ inputs.pr-ref }}" == *";"* || "${{ inputs.pr-ref }}" == *"&"* ||
151+
"${{ inputs.pr-ref }}" == *"|"* || "${{ inputs.pr-ref }}" == *">"* ||
152+
"${{ inputs.pr-ref }}" == *"<"* || "${{ inputs.pr-ref }}" == *"\`"* ]]; then
151153
echo "::error::Invalid characters in pr-ref - branch name contains potentially unsafe characters"
152154
exit 1
153155
fi
154156
155-
if [[ "${{ inputs.base-ref }}" =~ [;&|'"'"`] ]]; then
157+
# Similar validation for base-ref
158+
if [[ "${{ inputs.base-ref }}" == *";"* || "${{ inputs.base-ref }}" == *"&"* ||
159+
"${{ inputs.base-ref }}" == *"|"* || "${{ inputs.base-ref }}" == *">"* ||
160+
"${{ inputs.base-ref }}" == *"<"* || "${{ inputs.base-ref }}" == *"\`"* ]]; then
156161
echo "::error::Invalid characters in base-ref - branch name contains potentially unsafe characters"
157162
exit 1
158163
fi

0 commit comments

Comments
 (0)