Skip to content

Commit 1b2ec15

Browse files
fix(ci): Prevent shell injection in commit message handling + failing console width test (#341)
1 parent 3bfb904 commit 1b2ec15

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

.github/workflows/build-native-only.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ jobs:
3939
COMMIT_MESSAGE="${{ github.event.head_commit.message }}"
4040
fi
4141
# Export for use in other steps (multiline-safe)
42-
echo "commit_message<<EOF" >> $GITHUB_OUTPUT
43-
echo "$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
44-
echo "EOF" >> $GITHUB_OUTPUT
42+
# Use printf with %s to avoid interpreting special characters
43+
{
44+
echo "commit_message<<EOF"
45+
printf "%s\n" "$COMMIT_MESSAGE"
46+
echo "EOF"
47+
} >> $GITHUB_OUTPUT
4548
4649
check-trigger-condition:
4750
runs-on: ubuntu-latest

.github/workflows/ci-cd.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ jobs:
5252
COMMIT_MESSAGE='${{ github.event.head_commit.message }}'
5353
fi
5454
# Export for use in other steps (multiline-safe)
55-
echo "commit_message<<EOF" >> $GITHUB_OUTPUT
56-
echo "$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
57-
echo "EOF" >> $GITHUB_OUTPUT
55+
# Use printf with %s to avoid interpreting special characters
56+
{
57+
echo "commit_message<<EOF"
58+
printf "%s\n" "$COMMIT_MESSAGE"
59+
echo "EOF"
60+
} >> $GITHUB_OUTPUT
5861
5962
lint:
6063
needs: [get-commit-message]

src/aignostics/utils/_console.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def _get_console() -> Console:
2424
"error": "red1",
2525
}),
2626
width=int(os.environ.get("AIGNOSTICS_CONSOLE_WIDTH", "0")) or None,
27+
legacy_windows=False, # Modern Windows (10+) doesn't need width adjustment
2728
)
2829

2930

0 commit comments

Comments
 (0)