Title: fix(@angular-devkit/schematics): prevent schematic writes from escaping the workspace via symlinks by adilburaksen · Pull Request #33325 · angular/angular-cli · GitHub
Open Graph Title: fix(@angular-devkit/schematics): prevent schematic writes from escaping the workspace via symlinks by adilburaksen · Pull Request #33325 · angular/angular-cli
X Title: fix(@angular-devkit/schematics): prevent schematic writes from escaping the workspace via symlinks by adilburaksen · Pull Request #33325 · angular/angular-cli
Description: The schematics Tree and ScopedHost confine writes to the workspace lexically only: _normalizePath rejects .. escapes and ScopedHost._resolve joins paths to the workspace root. But the real-filesystem commit (NodeJsSyncHost.write / delete / rename) uses writeFileSync / rmSync / renameSync, which follow symlinks, with no realpath check (grep lstat|realpathSync|O_NOFOLLOW across core/node + core/src/virtual-fs returns nothing). So if a workspace contains a symlinked directory pointing outside it (e.g. shipped by a cloned repository), a built-in schematic or ng update migration writing a lexically in-workspace path can create/overwrite/delete a file outside the workspace. Fix Wrap the NodeWorkflow host so write / delete / rename assert that the real (symlink-resolved) path stays within the workspace root, walking up to the first existing ancestor for not-yet-created files. This mirrors the realpath-based root restriction the CLI already implements in the MCP host (createRootRestrictedHost). In-workspace operations are unaffected. Validation (against the published packages) A real use-application-builder migration whose karmaConfig resolves through a symlinked directory (src/symdir -> ../../outside) no longer overwrites the outside target (the write is rejected); without the fix it overwrote the outside file. The same migration on an in-workspace karma config still applies normally. (Happy to add a dedicated spec — the existing node-workflow_spec.ts is minimal; pointing me at the preferred test style for a symlinked-workspace fixture would help.)
Open Graph Description: The schematics Tree and ScopedHost confine writes to the workspace lexically only: _normalizePath rejects .. escapes and ScopedHost._resolve joins paths to the workspace root. But the real-filesyst...
X Description: The schematics Tree and ScopedHost confine writes to the workspace lexically only: _normalizePath rejects .. escapes and ScopedHost._resolve joins paths to the workspace root. But the real-filesyst...
Opengraph URL: https://github.com/angular/angular-cli/pull/33325
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:71fdcaf7-b390-ad9a-0ba9-a9f28db573f8 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | ABFA:2FDF33:632E67:8930EE:6A603CDD |
| html-safe-nonce | 60f64dd1351b5c332510df0b047d909c1f32dd696b4e37fb5365488b32955991 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQkZBOjJGREYzMzo2MzJFNjc6ODkzMEVFOjZBNjAzQ0REIiwidmlzaXRvcl9pZCI6IjEzNzc5NDI4MjczNzMxODIxNzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 639822003b90bebbe707d6561d76e7f13f02ebf5f6213e3128360e91b3adf1e9 |
| hovercard-subject-tag | pull_request:3822999250 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/angular/angular-cli/pull/33325/files |
| twitter:image | https://avatars.githubusercontent.com/u/56400880?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/56400880?s=400&v=4 |
| og:image:alt | The schematics Tree and ScopedHost confine writes to the workspace lexically only: _normalizePath rejects .. escapes and ScopedHost._resolve joins paths to the workspace root. But the real-filesyst... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60da8c2a42fa2bbf5f7567474990ec467836a84444262a58e200fa91b7f3d2d0 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9824515e740d83d5eb82168a089b806ab0fe04a1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width