Title: fix(schematics): escape values interpolated into generated Data Connect provider code by herdiyana256 · Pull Request #3727 · angular/angularfire · GitHub
Open Graph Title: fix(schematics): escape values interpolated into generated Data Connect provider code by herdiyana256 · Pull Request #3727 · angular/angularfire
X Title: fix(schematics): escape values interpolated into generated Data Connect provider code by herdiyana256 · Pull Request #3727 · angular/angularfire
Description: featureToRules's DataConnect case builds the generated provideDataConnect(...) call from two values read out of the project's own dataconnect.yaml/connector.yaml: config.package (passed as a module specifier to addRootProvider's external()) and the connectorConfig object's location/connector/service strings, interpolated directly into a double-quoted object literal (\${key}: "\${value}"). Neither was validated or escaped, so a value containing a quote character breaks out of its string literal and lands arbitrary source in the project's generated provider file. Confirmed with the exact two expressions from utils.ts: a connectorConfig.location of us-central1"; console.log("INJECTED"); const _z="x produced `getDataConnect({location: "us-central1"; console.log("INJECTED"); const _z="x",...})`` — a live statement, not an unusual string value. config.package is now checked against a conservative allow-list pattern (rejects quotes, backslashes, newlines) before being used as a module specifier, falling back to the connectorConfig object form otherwise. The connectorConfig values are now serialized with JSON.stringify instead of raw string interpolation, which also fixes a pre-existing as ConnectorConfig cast that assumed connectorConfig was always defined whenever package was falsy (it isn't — both are set together or neither is, per parseDataConnectConfig). Related but separate PR for a different sink in the same general area: #3726 (the deploy schematic's Cloud Run gcloud invocation). npx tsc --noEmit and npx eslint src/schematics/utils.ts both pass clean. Note on the import changes in utils.ts: adding the spec file means utils.ts is loaded as an ES module for the first time, and Node's ESM resolver requires fully specified paths. The @angular-devkit/schematics/tasks and ./common imports therefore need their explicit .js/index.js suffixes, matching the convention update/v21/index.ts already follows for the same reason. Without them the suite fails only at test time, so please keep them if you are tidying imports in this file.
Open Graph Description: featureToRules's DataConnect case builds the generated provideDataConnect(...) call from two values read out of the project's own dataconnect.yaml/connector.yaml: config.package (passed as ...
X Description: featureToRules's DataConnect case builds the generated provideDataConnect(...) call from two values read out of the project's own dataconnect.yaml/connector.yaml: config.package (pa...
Opengraph URL: https://github.com/angular/angularfire/pull/3727
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1bbe5d2b-b455-d1ed-479e-b46c5daa526b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B7AC:1DA36E:1128CBA:15E6E7D:6B03C764 |
| html-safe-nonce | e1bafb8f7b086a569f1d0a5960c36632db0b23323152130dffb53263599c6346 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCN0FDOjFEQTM2RToxMTI4Q0JBOjE1RTZFN0Q6NkIwM0M3NjQiLCJ2aXNpdG9yX2lkIjoiNDA3NDY2NjQ5ODA1OTM4ODc3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d69540aae917e30c1100f76716085da9fc2f2896110b2728984aae4b59a6ddce |
| hovercard-subject-tag | pull_request:4180271316 |
| 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/angularfire/pull/3727/files |
| twitter:image | https://avatars.githubusercontent.com/u/82978131?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/82978131?s=400&v=4 |
| og:image:alt | featureToRules's DataConnect case builds the generated provideDataConnect(...) call from two values read out of the project's own dataconnect.yaml/connector.yaml: config.package (passed as ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/angular/angularfire git https://github.com/angular/angularfire.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 49453413 |
| octolytics-dimension-repository_nwo | angular/angularfire |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49453413 |
| octolytics-dimension-repository_network_root_nwo | angular/angularfire |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width