René's URL Explorer Experiment


Title: permission: do not create symlinks if target is relative by tniessen · Pull Request #49156 · nodejs/node · GitHub

Open Graph Title: permission: do not create symlinks if target is relative by tniessen · Pull Request #49156 · nodejs/node

X Title: permission: do not create symlinks if target is relative by tniessen · Pull Request #49156 · nodejs/node

Description: The permission model's security guarantees fall apart in the presence of relative symbolic links. When an application attempts to create a relative symlink, the permission model currently resolves the relative path into an absolute path based on the process's current working directory, checks whether the process has the relevant permissions, and then creates the symlink using the absolute target path. This behavior is plainly incorrect for two reasons: The target path should never be resolved relative to the current working directory. If anything, it should be resolved relative to the symlink's location. (Of course, there is one insane exception to this rule: on Windows, each process has a current working directory per drive, and symlinks can be created with a target path relative to the current working directory of a specific drive. In that case, the relative path will be resolved relative to the current working directory for the respective drive, and the symlink will be created on disk with the resulting absolute path. Other relative symlinks will be stored as-is.) Silently creating an absolute symlink when the user requested a relative symlink is wrong. The user may (or may not) rely on the symlink being relative. For example, npm heavily relies on relative symbolic links such that node_modules directories can be moved around without breaking. Because we don't know the user's intentions, we don't know if creating an absolute symlink instead of a relative symlink is acceptable. This patch prevents the faulty behavior by not (incorrectly) resolving relative symlink targets when the permission model is enabled, and by instead simply refusing the create any relative symlinks. The fs APIs accept Uint8Array objects for paths to be able to handle arbitrary file name charsets, however, checking whether such an object represents a relative part in a reliable and portable manner is tricky. Other parts of the permission model incorrectly convert such objects to strings and then back to an Uint8Array (see 1f64147), however, for now, this bug fix will simply throw on non-string symlink targets when the permission model is enabled. (The permission model already breaks existing applications in various ways, so this shouldn't be too dramatic.)

Open Graph Description: The permission model's security guarantees fall apart in the presence of relative symbolic links. When an application attempts to create a relative symlink, the permission model currently resol...

X Description: The permission model's security guarantees fall apart in the presence of relative symbolic links. When an application attempts to create a relative symlink, the permission model currently r...

Opengraph URL: https://github.com/nodejs/node/pull/49156

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/commits/:range(.:format)
route-controllerpull_requests
route-actioncommits
fetch-noncev2:f6078f4b-f5d5-94d1-8ee4-61d114b03c52
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD05C:1768C8:DE4F7:130C5F:69976689
html-safe-nonced521dbc0d9c81e6fd4877414f5da54156cc38b2af186db9804476708356d1b79
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMDVDOjE3NjhDODpERTRGNzoxMzBDNUY6Njk5NzY2ODkiLCJ2aXNpdG9yX2lkIjoiNjI2ODI3NDI1NTA5Mzc4NjI0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac317911afb085cdd4c1d4eab12c9b2b13cc52bd835c7ad43b751b073515b2dc56
hovercard-subject-tagpull_request:1473528555
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/commits
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
twitter:imagehttps://avatars.githubusercontent.com/u/3109072?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/3109072?s=400&v=4
og:image:altThe permission model's security guarantees fall apart in the presence of relative symbolic links. When an application attempts to create a relative symlink, the permission model currently resol...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None3f6df5422af98e8455c055522f48ada1a19fab299cf47471bdd590f8b7291770
turbo-cache-controlno-preview
diff-viewunified
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 full-width
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9b5cbb0725d622d54f9a26cbf0adbfbe35459c44
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fpull%2F49156%2Fcommits%2F13b72a771592d9fcb5b368561502070b2e7eec78
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
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
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
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%2Fpull%2F49156%2Fcommits%2F13b72a771592d9fcb5b368561502070b2e7eec78
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%2Fpull_requests%2Fshow%2Fcommits&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
Reloadhttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
Reloadhttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 34.8k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 116k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.8k https://github.com/nodejs/node/issues
Pull requests 712 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects 3 https://github.com/nodejs/node/projects
Security 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 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fnodejs%2Fnode%2Fissues%2Fnew%2Fchoose
nodejs-github-bothttps://github.com/nodejs-github-bot
nodejs:mainhttps://github.com/nodejs/node/tree/main
tniessen:permission-no-relative-symlink-creationhttps://github.com/tniessen/node/tree/permission-no-relative-symlink-creation
Conversation 27 https://github.com/nodejs/node/pull/49156
Commits 1 https://github.com/nodejs/node/pull/49156/commits
Checks 0 https://github.com/nodejs/node/pull/49156/checks
Files changed https://github.com/nodejs/node/pull/49156/files
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
permission: do not create symlinks if target is relative https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#top
Show all changes 1 commit https://github.com/nodejs/node/pull/49156/files
13b72a7 permission: do not create symlinks if target is relative tniessen Aug 11, 2023 https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
Clear filters https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
fs.js https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
promises.js https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
test-permission-fs-symlink-relative.js https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-a1b80f01757f4c24d1ace1fb1ea09536e6bb30de1176eb02abae3e4ad9df74cb
1f64147https://github.com/nodejs/node/commit/1f64147eb607f82060e08884f993597774c69280
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
https://github.com/tniessen
tniessenhttps://github.com/nodejs/node/commits?author=tniessen
lib/fs.jshttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
View file https://github.com/tniessen/node/blob/13b72a771592d9fcb5b368561502070b2e7eec78/lib/fs.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/49156/commits/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
RafaelGSShttps://github.com/RafaelGSS
Oct 10, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1352303859
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
tniessenhttps://github.com/tniessen
Oct 10, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1352342548
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
RafaelGSShttps://github.com/RafaelGSS
Oct 15, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1359957776
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
tniessenhttps://github.com/tniessen
Nov 19, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1398409160
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
@RafaelGSShttps://github.com/RafaelGSS
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
RafaelGSShttps://github.com/RafaelGSS
Nov 21, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1399939181
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
anonrighttps://github.com/anonrig
Nov 19, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1398415067
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
tniessenhttps://github.com/tniessen
Nov 20, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1399148895
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
anonrighttps://github.com/anonrig
Nov 20, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1399222589
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
tniessenhttps://github.com/tniessen
Nov 20, 2023https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#r1399254712
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-9b2c5bf36570be7a09ba2597abdf6d9bc2cc1e19866b6674b0cf275c1188dcad
lib/internal/fs/promises.jshttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
View file https://github.com/tniessen/node/blob/13b72a771592d9fcb5b368561502070b2e7eec78/lib/internal/fs/promises.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/49156/commits/{{ revealButtonHref }}
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
https://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-408a6d8eb0a23c586754d4f3af46c8b1927a32d80a6bdfd3bbd87c0f2a012b1a
test/parallel/test-permission-fs-symlink-relative.jshttps://github.com/nodejs/node/pull/49156/commits/13b72a771592d9fcb5b368561502070b2e7eec78#diff-a1b80f01757f4c24d1ace1fb1ea09536e6bb30de1176eb02abae3e4ad9df74cb
View file https://github.com/tniessen/node/blob/13b72a771592d9fcb5b368561502070b2e7eec78/test/parallel/test-permission-fs-symlink-relative.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/nodejs/node/pull/49156/commits/{{ revealButtonHref }}
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.