Skip to content

Commit

Permalink
Merge branch 'main' into initialize-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcornelissen authored Aug 18, 2023
2 parents a86dcbb + 7aed3b6 commit 76fb88c
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 92 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -75,12 +75,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Initialize CodeQL
uses: github/codeql-action/init@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/init@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
with:
config-file: ./.github/codeql.yml
languages: javascript
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/analyze@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
format:
name: Formatting
runs-on: ubuntu-22.04
Expand All @@ -102,7 +102,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
- name: Install tooling
uses: asdf-vm/actions/install@6a442392015fbbdd8b48696d41e0051b2698b2e4 # v2.2.0
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:
with:
args: . --sarif --output njsscan-results.sarif || true
- name: Upload njsscan report to GitHub
uses: github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
if: ${{ failure() || success() }}
with:
sarif_file: njsscan-results.sarif
Expand Down Expand Up @@ -250,7 +250,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version: ${{ matrix.node-version }}
Expand Down Expand Up @@ -301,7 +301,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -352,7 +352,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -395,7 +395,7 @@ jobs:
COMMIT_SHA="$(git rev-parse HEAD)"
echo "commit-sha=$COMMIT_SHA" >> "$GITHUB_OUTPUT"
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -447,7 +447,7 @@ jobs:
COMMIT_SHA="$(git rev-parse HEAD)"
echo "commit-sha=$COMMIT_SHA" >> "$GITHUB_OUTPUT"
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -494,7 +494,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -529,7 +529,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -575,7 +575,7 @@ jobs:
scan-ref: .
template: "@/contrib/sarif.tpl"
- name: Upload Trivy report to GitHub
uses: github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
if: ${{ failure() || success() }}
with:
sarif_file: trivy-results.sarif
Expand All @@ -600,7 +600,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/config-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
with:
fetch-depth: 0 # To fetch all tags
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down Expand Up @@ -79,19 +79,25 @@ jobs:
- name: Get release version
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
id: major_version
env:
VERSION: ${{ needs.check.outputs.version }}
with:
result-encoding: string
script: |
const version = "${{ needs.check.outputs.version }}"
const version = `${process.env.VERSION}`
const major = version.replace(/\.\d\.\d$/, "")
return major
- name: Create release tag
env:
VERSION: ${{ needs.check.outputs.version }}
run: |
git tag '${{ needs.check.outputs.version }}'
git push origin '${{ needs.check.outputs.version }}'
git tag "${VERSION}"
git push origin "${VERSION}"
- name: Update major version branch
env:
MAJOR_VERSION: ${{ steps.major_version.outputs.result }}
run: |
git push origin 'HEAD:${{ steps.major_version.outputs.result }}'
git push origin "HEAD:${MAJOR_VERSION}"
github:
name: GitHub
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -150,7 +156,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
ref: ${{ matrix.ref }}
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand Down
18 changes: 13 additions & 5 deletions .github/workflows/reusable-fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,20 @@ jobs:
- name: Create identifier
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
id: run-id
env:
OS: ${{ inputs.os }}
SHELL: ${{ inputs.shell }}
TARGET: ${{ matrix.target }}
with:
result-encoding: string
script: |
const path = "${{ inputs.shell }}"
const path = `${process.env.SHELL}`
const fileName = path.split(/\//g).pop()
const shellName = fileName.endsWith(".exe") ?
fileName.slice(0, -4) : fileName
return `${{ inputs.os }}-${shellName}-${{ matrix.target }}`
return `${process.env.OS}-${shellName}-${process.env.TARGET}`
- name: Install Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with:
cache: npm
node-version-file: .nvmrc
Expand All @@ -85,9 +89,11 @@ jobs:
id: fuzz
shell: bash {0}
env:
DURATION: ${{ inputs.duration }}
FUZZ_SHELL: ${{ inputs.shell }}
TARGET: ${{ matrix.target }}
run: |
timeout '${{ inputs.duration }}s' npm run fuzz '${{ matrix.target }}'
timeout "${DURATION}s" npm run fuzz "${TARGET}"
export EXIT_CODE=$?
if [[ ($EXIT_CODE == 124) ]]; then
echo 'fuzz-error=false' >> $GITHUB_OUTPUT
Expand All @@ -102,8 +108,10 @@ jobs:
fi
- name: Check for unexpected error
if: ${{ steps.fuzz.outputs.script-error == 'true' }}
env:
EXIT_CODE: ${{ steps.fuzz.outputs.exit-code }}
run: |
echo 'Unexpected error: ${{ steps.fuzz.outputs.exit-code }}'
echo "Unexpected error: ${EXIT_CODE}"
exit 1
- name: Upload crash (if any)
if: ${{ steps.fuzz.outputs.fuzz-error == 'true' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
env:
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}
- name: Upload Semgrep report to GitHub
uses: github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v2.21.4
if: ${{ failure() || success() }}
with:
sarif_file: semgrep.sarif
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ View the [testing] documentation for how to test code that uses Shescape.

Read the [tips] for additional ways to protect against shell injection.

---
## License

_Content licensed under [CC BY-SA 4.0]; Code snippets under the [MIT license]._
The source code is licensed under the `MPL-2.0` license, see [LICENSE] for
the full license text. The documentation text is licensed under [CC BY-SA 4.0];
code snippets under the [MIT license].

[ci-url]: https://github.com/ericcornelissen/shescape/actions/workflows/checks.yml
[ci-image]: https://github.com/ericcornelissen/shescape/actions/workflows/checks.yml/badge.svg
Expand All @@ -90,7 +92,7 @@ _Content licensed under [CC BY-SA 4.0]; Code snippets under the [MIT license]._
[cmd.exe]: https://en.wikipedia.org/wiki/Cmd.exe
[csh]: https://en.wikipedia.org/wiki/C_shell
[dash]: https://en.wikipedia.org/wiki/Almquist_shell#Dash "Debian Almquist Shell"
[license]: https://github.com/ericcornelissen/shescape/blob/main/LICENSE
[license]: ./LICENSE
[mit license]: https://opensource.org/license/mit/
[powershell]: https://en.wikipedia.org/wiki/PowerShell
[recipes]: docs/recipes.md
Expand Down
Loading

0 comments on commit 76fb88c

Please sign in to comment.