Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update safe output regex and the docs #1805

Merged
merged 11 commits into from
Dec 23, 2023
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,12 @@ Support this project with a :star:
# Default: "\n"
recover_files_separator: ''

# Apply sanitization to output filenames before being set as
# output.
# Type: boolean
# Default: "true"
safe_output: ''

# Split character for output strings.
# Type: string
# Default: " "
Expand Down
47 changes: 33 additions & 14 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1355,8 +1355,8 @@

// if safeOutput is true, escape special characters for bash shell
if (safeOutput) {
cleanedValue = cleanedValue.replace(/[$()`|&;]/g, '\\$&')
cleanedValue = cleanedValue.replace(/[\x00-\x1F\x7F-\x9F\/\\:\*\?\"<>\|;`$()\&|\!]/g, '\\$&')
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
jackton1 marked this conversation as resolved.
Show resolved Hide resolved
}

Check failure on line 1359 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected control character(s) in regular expression: \x00, \x1f

Check failure on line 1359 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unnecessary escape character: \/

Check failure on line 1359 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unnecessary escape character: \*

Check failure on line 1359 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unnecessary escape character: \?

Check failure on line 1359 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unnecessary escape character: \"

Check failure on line 1359 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unnecessary escape character: \|

Check failure on line 1359 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unnecessary escape character: \&

Check failure on line 1359 in src/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unnecessary escape character: \!

core.setOutput(key, cleanedValue)

Expand Down