-
Notifications
You must be signed in to change notification settings - Fork 8
feat: add option to disallow code generation from strings #144
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,11 @@ on: | |
required: false | ||
default: '["20", "22"]' | ||
type: string | ||
check-disallow-code-generation-from-strings: | ||
description: 'Enables --disallow-code-generation-from-strings flag for Node.js' | ||
required: false | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
dependency-review: | ||
|
@@ -110,12 +115,23 @@ jobs: | |
matrix: | ||
node-version: ${{ fromJson(inputs.node-versions) }} | ||
os: [macos-latest, ubuntu-latest, windows-latest] | ||
disallow-code-generation-from-strings: ${{ inputs.check-disallow-code-generation-from-strings == true && ['true', 'false'] || ['false'] }} | ||
Fdawgs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
exclude: | ||
- os: macos-latest | ||
node-version: 14 | ||
- os: macos-latest | ||
node-version: 16 | ||
steps: | ||
- name: Set node flags | ||
id: node-flags | ||
shell: bash | ||
run: | | ||
if [ "${{ matrix.disallow-code-generation-from-strings }}" = "true" ]; then | ||
echo "flags=--disallow-code-generation-from-strings" >> $GITHUB_OUTPUT | ||
else | ||
echo "flags=" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Check out repo | ||
uses: actions/checkout@v4 | ||
with: | ||
|
@@ -130,7 +146,7 @@ jobs: | |
run: npm i --ignore-scripts | ||
|
||
- name: Run tests | ||
run: npm test | ||
run: NODE_OPTIONS="${{ steps.node-flags.outputs.flags }}" npm test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would expect this as a different job, not as an edit of this one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't understand. Since it is in a matrix config, it will run 2 different jobs. 1 for false value, and one for true. (or only 1 if it's not enabled) |
||
|
||
fastify-dependency-integration: | ||
name: Test Fastify Integration | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,14 +62,15 @@ jobs: | |
|
||
### Inputs | ||
|
||
| Input Name | Required | Type | Default | Description | | ||
| ---------------------------------- | ---------- | ------- | --------- | ---------------------------------------------------------------------------------- | | ||
| `auto-merge-exclude` | false | string | `fastify` | Provide a semicolon separated list of packages that you do not want to be auto-merged. | | ||
| `fastify-dependency-integration` | false | boolean | `false` | Set to `true` to run fastify tests with the (proposed) changes. | | ||
| `license-check` | false | boolean | `false` | Set to `true` to check that a repository's production dependencies use permissive licenses: 0BSD, Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, or ISC. | | ||
| `license-check-allowed-additional` | false | string | | Provide a semicolon separated list of SPDX-license identifiers that you want to additionally allow. | | ||
| `lint` | false | boolean | `false` | Set to `true` to run the `lint` script in a repository's `package.json`. | | ||
| `node-versions` | false | string | `'["20", "22"]'` | Provide A JSON array that specifies the Node.js versions on which the job should run. | | ||
| Input Name | Required | Type | Default | Description | | ||
|-----------------------------------------------|----------|---------|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| `auto-merge-exclude` | false | string | `fastify` | Provide a semicolon separated list of packages that you do not want to be auto-merged. | | ||
| `fastify-dependency-integration` | false | boolean | `false` | Set to `true` to run fastify tests with the (proposed) changes. | | ||
| `license-check` | false | boolean | `false` | Set to `true` to check that a repository's production dependencies use permissive licenses: 0BSD, Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, or ISC. | | ||
| `license-check-allowed-additional` | false | string | | Provide a semicolon separated list of SPDX-license identifiers that you want to additionally allow. | | ||
| `lint` | false | boolean | `false` | Set to `true` to run the `lint` script in a repository's `package.json`. | | ||
| `node-versions` | false | string | `'["20", "22"]'` | Provide A JSON array that specifies the Node.js versions on which the job should run. | | ||
| `check-disallow-code-generation-from-strings` | false | boolean | `false` | Enables --disallow-code-generation-from-strings flag for Node.js | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer to remove the "check-" prefix |
||
|
||
## Benchmark PR workflow | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the simplest way to express this? Apologies for ignorance but I find this expression hard to follow without a comment, I wonder if other readers if this code feel the same.