Skip to content

tools: report unsafe string and regex primordials as lint errors - #43393

Merged
aduh95 merged 1 commit into
nodejs:mainfrom
aduh95:lint-unsafe-primordials
Jun 15, 2022
Merged

tools: report unsafe string and regex primordials as lint errors#43393
aduh95 merged 1 commit into
nodejs:mainfrom
aduh95:lint-unsafe-primordials

Conversation

@aduh95

Copy link
Copy Markdown
Contributor
The string methodlooks up the property
String.prototype.matchSymbol.match
String.prototype.matchAllSymbol.matchAll
String.prototype.replaceSymbol.replace
String.prototype.replaceAllSymbol.replace
String.prototype.searchSymbol.search
String.prototype.splitSymbol.split

Functions that lookup the exec property on the prototype chain:

  • RegExp.prototype[Symbol.match]
  • RegExp.prototype[Symbol.matchAll]
  • RegExp.prototype[Symbol.replace]
  • RegExp.prototype[Symbol.search]
  • RegExp.prototype[Symbol.split]
  • RegExp.prototype.test

I'm leaving out RegExp.prototype[Symbol.replace] and RegExp.prototype[Symbol.split] until we have a better solution for them.

| The string method | looks up the property |
| ----------------------------- | --------------------- |
| `String.prototype.match` | `Symbol.match` |
| `String.prototype.matchAll` | `Symbol.matchAll` |
| `String.prototype.replace` | `Symbol.replace` |
| `String.prototype.replaceAll` | `Symbol.replace` |
| `String.prototype.search` | `Symbol.search` |
| `String.prototype.split` | `Symbol.split` |
Functions that lookup the `exec` property on the prototype chain:
* `RegExp.prototype[Symbol.match]`
* `RegExp.prototype[Symbol.matchAll]`
* `RegExp.prototype[Symbol.replace]`
* `RegExp.prototype[Symbol.search]`
* `RegExp.prototype[Symbol.split]`
* `RegExp.prototype.test`
@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem. tls Issues and PRs related to the tls subsystem. tools Issues and PRs related to the tools directory. labels Jun 12, 2022
@aduh95
aduh95 marked this pull request as draft June 12, 2022 13:46
@aduh95
aduh95 marked this pull request as ready for review June 12, 2022 16:40
@tniessen

Copy link
Copy Markdown
Member

LGTM since this only seems to affect the primordial versions of these functions.

@tniessentniessen added request-ci Add this label to start a Jenkins CI on a PR. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels Jun 13, 2022
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 13, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@aduh95aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 15, 2022
@nodejs-github-botnodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jun 15, 2022
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/43393
✔ Done loading data for nodejs/node/pull/43393
----------------------------------- PR info ------------------------------------
Title tools: report unsafe string and regex primordials as lint errors (#43393)
⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch aduh95:lint-unsafe-primordials -> nodejs:main
Labels tls, repl, tools, author ready, needs-ci
Commits 1
- tools: report unsafe string and regex primordials as lint errors
Committers 1
- Antoine du Hamel PR-URL: https://github.com/nodejs/node/pull/43393
Reviewed-By: Tobias Nießen Reviewed-By: James M Snell ------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/43393
Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --------------------------------------------------------------------------------
ℹ This PR was created on Sun, 12 Jun 2022 13:45:56 GMT
✔ Approvals: 2
✔ - Tobias Nießen (@tniessen) (TSC): https://github.com/nodejs/node/pull/43393#pullrequestreview-1003647323
✔ - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/43393#pullrequestreview-1004615237
✖ Last GitHub CI failed
ℹ Last Full PR CI on 2022-06-15T20:44:05Z: https://ci.nodejs.org/job/node-test-pull-request/44598/
- Querying data for job/node-test-pull-request/44598/
✔ Last Jenkins CI successful
--------------------------------------------------------------------------------
✔ Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/2505419325

@aduh95
aduh95 merged commit 9119382 into nodejs:mainJun 15, 2022
@aduh95

Copy link
Copy Markdown
ContributorAuthor

Landed in 9119382

@aduh95
aduh95 deleted the lint-unsafe-primordials branch June 15, 2022 22:22
danielleadams pushed a commit that referenced this pull request Jun 16, 2022
| The string method | looks up the property |
| ----------------------------- | --------------------- |
| `String.prototype.match` | `Symbol.match` |
| `String.prototype.matchAll` | `Symbol.matchAll` |
| `String.prototype.replace` | `Symbol.replace` |
| `String.prototype.replaceAll` | `Symbol.replace` |
| `String.prototype.search` | `Symbol.search` |
| `String.prototype.split` | `Symbol.split` |
Functions that lookup the `exec` property on the prototype chain:
* `RegExp.prototype[Symbol.match]`
* `RegExp.prototype[Symbol.matchAll]`
* `RegExp.prototype[Symbol.replace]`
* `RegExp.prototype[Symbol.search]`
* `RegExp.prototype[Symbol.split]`
* `RegExp.prototype.test`
`RegExp.prototype[Symbol.replace]` and `RegExp.prototype[Symbol.split]`
are still allowed for a lack of a better solution.
PR-URL: #43393
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@danielleadamsdanielleadams mentioned this pull request Jun 16, 2022
aduh95 added a commit to aduh95/node that referenced this pull request Aug 1, 2022
| The string method | looks up the property |
| ----------------------------- | --------------------- |
| `String.prototype.match` | `Symbol.match` |
| `String.prototype.matchAll` | `Symbol.matchAll` |
| `String.prototype.replace` | `Symbol.replace` |
| `String.prototype.replaceAll` | `Symbol.replace` |
| `String.prototype.search` | `Symbol.search` |
| `String.prototype.split` | `Symbol.split` |
Functions that lookup the `exec` property on the prototype chain:
* `RegExp.prototype[Symbol.match]`
* `RegExp.prototype[Symbol.matchAll]`
* `RegExp.prototype[Symbol.replace]`
* `RegExp.prototype[Symbol.search]`
* `RegExp.prototype[Symbol.split]`
* `RegExp.prototype.test`
`RegExp.prototype[Symbol.replace]` and `RegExp.prototype[Symbol.split]`
are still allowed for a lack of a better solution.
PR-URL: nodejs#43393
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Aug 2, 2022
| The string method | looks up the property |
| ----------------------------- | --------------------- |
| `String.prototype.match` | `Symbol.match` |
| `String.prototype.matchAll` | `Symbol.matchAll` |
| `String.prototype.replace` | `Symbol.replace` |
| `String.prototype.replaceAll` | `Symbol.replace` |
| `String.prototype.search` | `Symbol.search` |
| `String.prototype.split` | `Symbol.split` |
Functions that lookup the `exec` property on the prototype chain:
* `RegExp.prototype[Symbol.match]`
* `RegExp.prototype[Symbol.matchAll]`
* `RegExp.prototype[Symbol.replace]`
* `RegExp.prototype[Symbol.search]`
* `RegExp.prototype[Symbol.split]`
* `RegExp.prototype.test`
`RegExp.prototype[Symbol.replace]` and `RegExp.prototype[Symbol.split]`
are still allowed for a lack of a better solution.
PR-URL: #43393
Backport-PR-URL: #44081
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
@targostargos mentioned this pull request Aug 3, 2022
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
| The string method | looks up the property |
| ----------------------------- | --------------------- |
| `String.prototype.match` | `Symbol.match` |
| `String.prototype.matchAll` | `Symbol.matchAll` |
| `String.prototype.replace` | `Symbol.replace` |
| `String.prototype.replaceAll` | `Symbol.replace` |
| `String.prototype.search` | `Symbol.search` |
| `String.prototype.split` | `Symbol.split` |
Functions that lookup the `exec` property on the prototype chain:
* `RegExp.prototype[Symbol.match]`
* `RegExp.prototype[Symbol.matchAll]`
* `RegExp.prototype[Symbol.replace]`
* `RegExp.prototype[Symbol.search]`
* `RegExp.prototype[Symbol.split]`
* `RegExp.prototype.test`
`RegExp.prototype[Symbol.replace]` and `RegExp.prototype[Symbol.split]`
are still allowed for a lack of a better solution.
PR-URL: nodejs/node#43393
Backport-PR-URL: nodejs/node#44081
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-failedAn error occurred while landing this pull request using GitHub Actions.needs-ciPRs that need a full CI run.replIssues and PRs related to the REPL subsystem.tlsIssues and PRs related to the tls subsystem.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@aduh95@tniessen@nodejs-github-bot@jasnell@targos