René's URL Explorer Experiment


Title: Inconsistent validation of custom signals · Issue #44749 · nodejs/node · GitHub

Open Graph Title: Inconsistent validation of custom signals · Issue #44749 · nodejs/node

X Title: Inconsistent validation of custom signals · Issue #44749 · nodejs/node

Description: Version 18.9.0 Platform Darwin Subsystem child_process os What steps will reproduce the bug? In the current implementation, spawn and related functions throw synchronous errors for invalid signals, e.g.: import { spawn } from 'node:child...

Open Graph Description: Version 18.9.0 Platform Darwin Subsystem child_process os What steps will reproduce the bug? In the current implementation, spawn and related functions throw synchronous errors for invalid signals,...

X Description: Version 18.9.0 Platform Darwin Subsystem child_process os What steps will reproduce the bug? In the current implementation, spawn and related functions throw synchronous errors for invalid signals,...

Opengraph URL: https://github.com/nodejs/node/issues/44749

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistent validation of custom signals","articleBody":"### Version\r\n\r\n18.9.0\r\n\r\n### Platform\r\n\r\nDarwin\r\n\r\n### Subsystem\r\n\r\nchild_process\r\nos\r\n\r\n### What steps will reproduce the bug?\r\n\r\nIn the current implementation, `spawn` and related functions throw synchronous errors for invalid signals, e.g.:\r\n\r\n```js\r\nimport { spawn } from 'node:child_process';\r\n\r\n// TypeError [ERR_UNKNOWN_SIGNAL]\r\nspawn(process.execPath, ['-v'], { killSignal: 12345 });\r\n```\r\n\r\nAnyway, it's easy to define custom signals that pass the validation:\r\n\r\n```js\r\nimport { spawn } from 'node:child_process';\r\nimport { constants } from 'node:os';\r\n\r\nconstants.signals.FOOBAR = 12345;\r\n// no error\r\nspawn(process.execPath, ['-v'], { killSignal: 12345 });\r\n```\r\n\r\nThe same applies when signals are identified by name, i.e:\r\n\r\n```js\r\nimport { spawn } from 'node:child_process';\r\n\r\n// TypeError [ERR_UNKNOWN_SIGNAL]\r\nspawn(process.execPath, ['-v'], { killSignal: 'FOOBAR' });\r\n```\r\n\r\nand\r\n\r\n```js\r\nimport { spawn } from 'node:child_process';\r\nimport { constants } from 'node:os';\r\n\r\nconstants.signals.FOOBAR = 12345;\r\n// no error\r\nspawn(process.execPath, ['-v'], { killSignal: 'FOOBAR' });\r\n```\r\n\r\n**but** if a custom signal is added after the internal mapping of numeric codes to names signals has been generated, validation fails for numeric codes (but not for signal names):\r\n\r\n```js\r\nimport { spawn } from 'node:child_process';\r\nimport { constants } from 'node:os';\r\n\r\nspawn(process.execPath, ['-v'], { killSignal: 1 });\r\nconstants.signals.FOOBAR = 12345;\r\nspawn(process.execPath, ['-v'], { killSignal: 'FOOBAR' }); // no error\r\nspawn(process.execPath, ['-v'], { killSignal: 12345 }); // TypeError [ERR_UNKNOWN_SIGNAL]\r\n```\r\n\r\nThis strikes to me as issue of improper memoization:\r\n\r\nhttps://github.com/nodejs/node/blob/9ae2af4aaebe5c6efad774989c4958ba6d32c0fd/lib/internal/util.js#L272-L283\r\n\r\nwhere `signalsToNamesMapping` never changes once created.\r\n\r\nOn the other hand, I'm not convinced that the current behavior - being able to add, remove, and change signals at will - is intended. If it is, then the validation logic should be fixed. If it is not, then `constants.signals` should be better frozen to prevent changes.\r\n\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nAll the time.\r\n\r\n### What is the expected behavior?\r\n\r\nEither custom numeric signals should always be accepted as valid, or they should always be rejected. If they should be rejected, then custom string signals should be rejected, too.\r\n\r\n### What do you see instead?\r\n\r\nInconsistent behavior, depending on (possibly unrelated) previous operations.\r\n\r\n### Additional information\r\n\r\n_No response_","author":{"url":"https://github.com/fasttime","@type":"Person","name":"fasttime"},"datePublished":"2022-09-22T17:50:07.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/44749/node/issues/44749"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:83ff1d7b-14ef-e0f9-6bca-eb85a08eefab
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBBC2:306DA5:482F29:6191F5:6A4C764A
html-safe-nonceb5f894945ae8beb8dd24d429d18850ffd309ede8b4cf63f5574be1c1eeb86c30
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQkMyOjMwNkRBNTo0ODJGMjk6NjE5MUY1OjZBNEM3NjRBIiwidmlzaXRvcl9pZCI6IjM0Mzc4MzczMjYxMDg4ODI1MDYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf768f098e20c2d56ddf1bc9873c9c217f9a3ac1cae12db439087181d30922df1
hovercard-subject-tagissue:1382811018
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/44749/issue_layout
twitter:imagehttps://opengraph.githubassets.com/a5c2fb484ded6284d99726c162869b500ff3bf444a6ff84e639577062a5b4f9a/nodejs/node/issues/44749
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/a5c2fb484ded6284d99726c162869b500ff3bf444a6ff84e639577062a5b4f9a/nodejs/node/issues/44749
og:image:altVersion 18.9.0 Platform Darwin Subsystem child_process os What steps will reproduce the bug? In the current implementation, spawn and related functions throw synchronous errors for invalid signals,...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamefasttime
hostnamegithub.com
expected-hostnamegithub.com
None3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release56ac743bebb13694b888673bb7257f4b97a4b7fd
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/44749#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F44749
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F44749
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/44749
Reloadhttps://github.com/nodejs/node/issues/44749
Reloadhttps://github.com/nodejs/node/issues/44749
Please reload this pagehttps://github.com/nodejs/node/issues/44749
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/44749
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 964 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
#61038https://github.com/nodejs/node/pull/61038
Inconsistent validation of custom signalshttps://github.com/nodejs/node/issues/44749#top
#61038https://github.com/nodejs/node/pull/61038
child_processIssues and PRs related to the child_process subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22child_process%22
good first issueIssues that are suitable for first-time contributors.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22good%20first%20issue%22
https://github.com/fasttime
fasttimehttps://github.com/fasttime
on Sep 22, 2022https://github.com/nodejs/node/issues/44749#issue-1382811018
node/lib/internal/util.jshttps://github.com/nodejs/node/blob/9ae2af4aaebe5c6efad774989c4958ba6d32c0fd/lib/internal/util.js#L272-L283
9ae2af4https://github.com/nodejs/node/commit/9ae2af4aaebe5c6efad774989c4958ba6d32c0fd
child_processIssues and PRs related to the child_process subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22child_process%22
good first issueIssues that are suitable for first-time contributors.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22good%20first%20issue%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.