Title: util.stripVTControlCharacters() fails to strip OSC 8 hyperlinks whose URI contains characters like "(" · Issue #64313 · nodejs/node · GitHub
Open Graph Title: util.stripVTControlCharacters() fails to strip OSC 8 hyperlinks whose URI contains characters like "(" · Issue #64313 · nodejs/node
X Title: util.stripVTControlCharacters() fails to strip OSC 8 hyperlinks whose URI contains characters like "(" · Issue #64313 · nodejs/node
Description: Version v22.22.3 (also reproduces on main) Platform Any (logic bug in a bundled regex, not platform-specific) Subsystem util What steps will reproduce the bug? import {stripVTControlCharacters} from 'node:util'; // OSC 8 hyperlink whose ...
Open Graph Description: Version v22.22.3 (also reproduces on main) Platform Any (logic bug in a bundled regex, not platform-specific) Subsystem util What steps will reproduce the bug? import {stripVTControlCharacters} fro...
X Description: Version v22.22.3 (also reproduces on main) Platform Any (logic bug in a bundled regex, not platform-specific) Subsystem util What steps will reproduce the bug? import {stripVTControlCharacters} fro...
Opengraph URL: https://github.com/nodejs/node/issues/64313
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"util.stripVTControlCharacters() fails to strip OSC 8 hyperlinks whose URI contains characters like \"(\"","articleBody":"### Version\n\nv22.22.3 (also reproduces on `main`)\n\n### Platform\n\nAny (logic bug in a bundled regex, not platform-specific)\n\n### Subsystem\n\nutil\n\n### What steps will reproduce the bug?\n\n```js\nimport {stripVTControlCharacters} from 'node:util';\n\n// OSC 8 hyperlink whose URI contains `(`, a character RFC 3986 allows unencoded.\nconst link = '\\u001B]8;;https://example.com/(foo\\u0007label\\u001B]8;;\\u0007';\n\nconsole.log(stripVTControlCharacters(link));\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways, whenever an OSC 8 hyperlink URI contains one of: `!`, `$`, `'`, `(`, `)`, `*`, `+`, `,`, `[`, `]`.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe visible label with all escape sequences removed:\n\n```\nlabel\n```\n\n### What do you see instead?\n\nThe hyperlink is not stripped and most of the URI (plus the BEL terminator) leaks into the output. The returned string is:\n\n```\n'ttps://example.com/(foo\\u0007label'\n```\n\n### Additional information\n\n`stripVTControlCharacters()` uses a bundled copy of [`chalk/ansi-regex`](https://github.com/chalk/ansi-regex) in `lib/internal/util/inspect.js`, pinned to ansi-regex [`f338e18`](https://github.com/chalk/ansi-regex/blob/f338e1814144efb950276aac84135ff86b72dc8e/index.js) (v6.1.0). That version matches OSC parameter/URI bytes with the restricted class `[-a-zA-Z\\d/#&.:=?%@~_]`, which omits ten characters RFC 3986 permits unencoded in a URI: `!`, `$`, `'`, `(`, `)`, `*`, `+`, `,`, `[`, `]`. When the URI contains any of them, the OSC branch never reaches the string terminator, so the sequence is left largely intact.\n\nansi-regex fixed this in v6.2.0 ([`72bc570`](https://github.com/chalk/ansi-regex/commit/72bc570aaf25fca25541b49c6a8564f3ec63e835)) by matching OSC sequences generically as `ESC ] … ST` (non-greedy up to the first string terminator) instead of enumerating allowed URI bytes. Syncing the bundled regex to ansi-regex >=6.2.0 resolves it.","author":{"url":"https://github.com/sindresorhus","@type":"Person","name":"sindresorhus"},"datePublished":"2026-07-06T00:00:52Z","url":"https://github.com/nodejs/node/issues/64313"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cad1cccb-cef1-a31b-7835-38f528a931d4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A51E:204D3A:4A02EB:64CA6B:6AED1C31 |
| html-safe-nonce | ebd955f02e1a68563b8660a22ae5d8b3e2142dbf1821d7d794d138cbd33294c3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTFFOjIwNEQzQTo0QTAyRUI6NjRDQTZCOjZBRUQxQzMxIiwidmlzaXRvcl9pZCI6IjczODMwMzEwODQwNTc2OTczMjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 91b1dd4e9f1e9b07abb7ec22a9d8ac1a6952e6f558471fd47904b9fbf80ab861 |
| hovercard-subject-tag | issue:4814943584 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/64313/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5d1689491a3fef14ec0a2d3c4c4287d10dec9b5cd3b5cfc65f5ced258ef4bc2c/nodejs/node/issues/64313 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5d1689491a3fef14ec0a2d3c4c4287d10dec9b5cd3b5cfc65f5ced258ef4bc2c/nodejs/node/issues/64313 |
| og:image:alt | Version v22.22.3 (also reproduces on main) Platform Any (logic bug in a bundled regex, not platform-specific) Subsystem util What steps will reproduce the bug? import {stripVTControlCharacters} fro... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sindresorhus |
| hostname | github.com |
| expected-hostname | github.com |
| None | e3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 707a24b346ac8a82878b9c084efaa38a997660cb |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width