You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: danger/README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,8 @@ jobs:
29
29
* type: string
30
30
* required: false
31
31
* default: `${{ github.token }}`
32
+
* extra-dangerfile: Path to an additional dangerfile to run custom checks.
33
+
* extra-install-packages: Additional packages that are required by the extra-dangerfile, you can find a list of packages here: https://packages.debian.org/search?suite=bookworm&keywords=curl.
# Validate extra-install-packages to prevent code injection
40
+
- name: Validate package names
41
+
if: ${{ inputs.extra-install-packages }}
42
+
shell: bash
43
+
run: |
44
+
packages="${{ inputs.extra-install-packages }}"
45
+
# Only allow alphanumeric characters, hyphens, periods, plus signs, underscores, and spaces
46
+
if ! echo "$packages" | grep -E '^[a-zA-Z0-9._+-]+( [a-zA-Z0-9._+-]+)*$' > /dev/null; then
47
+
echo "::error::Invalid package names in extra-install-packages. Only alphanumeric characters, hyphens, periods, plus signs, underscores, and spaces are allowed."
48
+
exit 1
49
+
fi
50
+
25
51
# Using a pre-built docker image in GitHub container registry instead of NPM to reduce possible attack vectors.
26
-
- name: Run DangerJS
27
-
id: danger
52
+
- name: Setup container
28
53
shell: bash
29
54
run: |
30
-
docker run \
55
+
# Start a detached container with all necessary volumes and environment variables
if(err.message&&err.message.includes('Cannot use import statement outside a module')){
207
+
warn(`External dangerfile uses ES6 imports. Please convert to CommonJS syntax (require/module.exports) or use .mjs extension with proper module configuration.\nFile: ${customPath}`);
208
+
}else{
209
+
warn(`Could not load custom Dangerfile: ${customPath}\n${err}`);
0 commit comments