Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency vite to v4.5.1 [security] #659

Merged
merged 1 commit into from
Dec 7, 2023

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 6, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
vite (source) 4.5.0 -> 4.5.1 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2023-49293

Summary

When Vite's HTML transformation is invoked manually via server.transformIndexHtml, the original request URL is passed in unmodified, and the html being transformed contains inline module scripts (<script type="module">...</script>), it is possible to inject arbitrary HTML into the transformed output by supplying a malicious URL query string to server.transformIndexHtml.

Impact

Only apps using appType: 'custom' and using the default Vite HTML middleware are affected. The HTML entry must also contain an inline script. The attack requires a user to click on a malicious URL while running the dev server. Restricted files aren't exposed to the attacker.

Patches

Fixed in [email protected], [email protected], [email protected]

Details

Suppose index.html contains an inline module script:

<script type="module">
  // Inline script
</script>

This script is transformed into a proxy script like

<script type="module" src="/index.html?html-proxy&index=0.js"></script>

due to Vite's HTML plugin:

https://github.com/vitejs/vite/blob/7fd7c6cebfcad34ae7021ebee28f97b1f28ef3f3/packages/vite/src/node/plugins/html.ts#L429-L465

When appType: 'spa' | 'mpa', Vite serves HTML itself, and htmlFallbackMiddleware rewrites req.url to the canonical path of index.html,

https://github.com/vitejs/vite/blob/73ef074b80fa7252e0c46a37a2c94ba8cba46504/packages/vite/src/node/server/middlewares/htmlFallback.ts#L44-L47

so the url passed to server.transformIndexHtml is /index.html.

However, if appType: 'custom', HTML is served manually, and if server.transformIndexHtml is called with the unmodified request URL (as the SSR docs suggest), then the path of the transformed html-proxy script varies with the request URL. For example, a request with path / produces

<script type="module" src="/@&#8203;id/__x00__/index.html?html-proxy&index=0.js"></script>

It is possible to abuse this behavior by crafting a request URL to contain a malicious payload like

"></script><script>alert('boom')</script>

so a request to http://localhost:5173/?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E produces HTML output like

<script type="module" src="/@&#8203;id/__x00__/?"></script><script>alert("boom")</script>?html-proxy&index=0.js"></script>

which demonstrates XSS.

PoC

Detailed Impact

This will probably predominantly affect development-mode SSR, where vite.transformHtml is called using the original req.url, per the docs:

https://github.com/vitejs/vite/blob/7fd7c6cebfcad34ae7021ebee28f97b1f28ef3f3/docs/guide/ssr.md?plain=1#L114-L126

However, since this vulnerability affects server.transformIndexHtml, the scope of impact may be higher to also include other ad-hoc calls to server.transformIndexHtml from outside of Vite's own codebase.

My best guess at bisecting which versions are vulnerable involves the following test script

import fs from 'node:fs/promises';
import * as vite from 'vite';

const html = `
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
  </head>
  <body>
    <script type="module">
      // Inline script
    </script>
  </body>
</html>
`;
const server = await vite.createServer({ appType: 'custom' });
const transformed = await server.transformIndexHtml('/?%22%3E%3C/script%3E%3Cscript%3Ealert(%27boom%27)%3C/script%3E', html);
console.log(transformed);
await server.close();

and using it I was able to narrow down to #​13581. If this is correct, then vulnerable Vite versions are 4.4.0-beta.2 and higher (which includes 4.4.0).


Release Notes

vitejs/vite (vite)

v4.5.1

Compare Source

Please refer to CHANGELOG.md for details.


Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

Copy link
Contributor

github-actions bot commented Dec 6, 2023

Overall Project NaN% NaN% 🍏

There is no coverage information present for the Files changed

@renovate renovate bot force-pushed the renovate/npm-vite-vulnerability branch from da9498e to 93e9176 Compare December 6, 2023 18:44
Copy link
Contributor

github-actions bot commented Dec 6, 2023

Current changelog

Bug Fixes

  • skip birthdate validation when not found (#658) (9946853)

Copy link
Contributor

github-actions bot commented Dec 6, 2023

Overall Project NaN% NaN% 🍏

There is no coverage information present for the Files changed

Copy link

sonarcloud bot commented Dec 6, 2023

[forest-client-frontend] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

github-actions bot commented Dec 6, 2023

Frontend unit Test Coverage

Coverage after merging renovate/npm-vite-vulnerability into main will be
55.70%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   App.vue48.39%50%0%68.42%108, 36, 39–40, 44, 52–53, 62
   directivesMap.ts100%100%100%100%
src/components
   DataFetcher.vue85%60%83.33%95.83%33–35, 50, 55
   MainHeaderComponent.vue79.69%76.56%58.33%88.46%100, 107, 111, 122, 124, 134, 136, 147, 173, 176, 185, 201, 217, 217, 217, 230, 249, 41, 50–51, 55
   UserProfileComponent.vue80%33.33%100%85.71%17, 17, 19, 23
src/components/forms
   AutoCompleteInputComponent.vue75.38%58.54%80.95%83.82%110–111, 127, 132–133, 201, 46, 59, 61, 61, 61, 61, 61–63, 65, 65, 65–67, 77, 80, 80, 80, 80, 80, 82, 84
   DropdownInputComponent.vue89.11%83.87%83.33%94.23%111, 136, 152, 67, 81, 81, 81–82
   MultiselectInputComponent.vue91.49%87.50%85.71%95.92%100, 109, 122, 80, 89
   RadioInputComponent.vue88.46%91.67%75%92.86%38, 43, 82
   ReadOnlyComponent.vue66.67%100%100%66.67%2
   TextInputComponent.vue86.49%77.27%84.62%92.31%122–123, 130, 55, 84, 89–90, 98
src/components/forms/DateInputComponent
   DateInputPart.vue91.30%75%100%100%46, 50
   common.ts100%100%100%100%
   index.vue81.32%75.28%75%86.18%137, 172–174, 182–185, 185, 185–186, 213, 215, 218–219, 225, 269–270, 280–281, 296–298, 300–301, 311–312, 316, 319–320, 330–333, 340, 352, 381, 384, 450, 460, 467, 473, 479
src/components/grouping
   AddressGroupComponent.vue1.22%0%0%2.73%104–105, 107, 107, 107, 111–112, 114–115, 115, 115, 115, 117, 124, 131, 140–141, 141, 141, 141, 143, 145, 147, 151, 153–154, 154, 154–155, 155, 155, 155, 157, 159, 161, 164, 168–169, 169, 169, 169, 171, 173, 175, 179–180, 180, 180, 183, 185–186, 186–187, 187, 189, 19, 192, 194–196, 196, 196, 196, 196–198, 206, 208–209, 212, 214, 219–220, 220, 220–225, 225, 225–227, 230, 234–235, 235, 235–236, 247, 247, 247, 254, 254, 254–255, 255, 255–256, 256, 268, 268, 268, 270, 270, 270, 274, 274, 274, 28, 285, 285, 285–286, 286, 292, 292, 292, 294, 294, 294–295, 295, 295, 297, 297, 304, 304, 304, 312, 312, 312–313, 313, 313, 317, 317, 317, 333, 333, 333–334, 334, 334, 34, 345, 345, 345, 348, 348, 348–349, 349, 349, 35, 353, 353, 355, 355, 355, 37, 40, 42, 42, 42, 46, 46, 46, 49–51, 53–54, 57, 61–63, 66–68, 72, 76, 76, 76, 76, 76, 76–77, 82, 84, 87–88, 88, 88, 88, 88–89, 92, 95
   ContactGroupComponent.vue67.18%83.33%46.67%64.15%100, 114, 120, 137, 145, 154, 161, 170, 177, 185, 193, 201, 215, 42, 55–56, 83, 83, 83–84, 90, 90, 90–91, 99, 99, 99
   ErrorNotificationGroupingComponent.vue74.67%62.86%57.14%90.91%110, 117, 117, 117, 121, 129, 129, 138, 150, 175, 175, 58, 63, 81, 90, 98
src/composables
   useFetch.ts90.77%73.68%100%97.56%117, 121, 130, 17, 51, 88
   useFocus.ts25.93%6.67%30%34.48%28, 28, 28–30, 30, 30–32, 34, 44, 49–50, 50, 50, 53, 53, 53, 55–57, 63, 63, 63, 66–67, 70, 85, 85, 85, 92, 95, 98
   useScreenSize.ts100%100%100%100%
   useSvg.ts100%100%100%100%
src/helpers
   CustomDirectives.ts21.43%13.04%50%22.22%10, 17–18, 18, 18–19, 19, 19–21, 21, 21–22, 24, 27, 27, 27–28, 35–36, 36, 36–37, 43–45, 45, 45–48, 5, 5–7, 7, 7–8, 8, 8–9
   DataConversors.ts75.61%79.17%50%73.33%33, 38, 38, 38, 38, 38–39, 4, 41
   

Copy link
Contributor

github-actions bot commented Dec 6, 2023

Frontend component Test Coverage

Coverage after merging renovate/npm-vite-vulnerability into main will be
92.91%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   App.vue100%100%100%100%
   CoreConstants.ts100%100%100%100%
   directivesMap.ts100%100%100%100%
   main.ts100%100%100%100%
   routes.ts100%100%100%100%
   shims-vue.d.ts100%100%100%100%
src/components
   DataFetcher.vue97.14%80%100%100%33
   MainHeaderComponent.vue100%100%100%100%
   UserProfileComponent.vue100%100%100%100%
src/components/forms
   AutoCompleteInputComponent.vue92.74%91.43%85.71%95.59%201, 40, 46, 67, 80, 82
   DropdownInputComponent.vue90.63%88.46%83.33%94.23%111, 136, 152, 81, 81–82
   MultiselectInputComponent.vue90.11%80.95%85.71%95.92%100, 109, 122, 41, 47, 89
   RadioInputComponent.vue100%100%100%100%
   ReadOnlyComponent.vue100%100%100%100%
   TextInputComponent.vue88.73%78.95%84.62%94.87%122–123, 130, 148, 55, 98
src/components/forms/DateInputComponent
   DateInputPart.vue100%100%100%100%
   common.ts100%100%100%100%
   index.vue100%100%100%100%
src/components/grouping
   AddressGroupComponent.vue89.67%89.89%90.70%89.09%115, 131, 141, 147, 154–155, 155, 155, 155, 157, 159, 161, 169, 175, 186, 208–209, 225, 274, 317, 355
   ContactGroupComponent.vue91.41%95.56%90%88.68%100, 137, 209, 215, 84, 91, 99, 99
   ErrorNotificationGroupingComponent.vue100%100%100%100%
src/composables
   useFetch.ts100%100%100%100%
   useFocus.ts100%100%100%100%
   useScreenSize.ts100%100%100%100%
   useSvg.ts100%100%100%100%
src/dto
   ApplyClientNumberDto.ts100%100%100%100%
   CommonTypesDto.ts100%100%100%100%
src/helpers
   CustomDirectives.ts100%100%100%100%
   DataConversors.ts100%100%100%100%
   ForestClientUserSession.ts100%100%100%100%
src/helpers/validators
   BCeIDFormValidations.ts100%100%100%100%
   GlobalValidators.ts100%100%100%100%
   SubmissionValidators.ts100%100%100%100%
src/pages
   ErrorPage.vue100%100%100%100%
   FormBCSCPage.vue100%100%100%100%
   FormBCeIDPage.vue100%100%100%100%
   FormSubmittedPage.vue100%100%100%100%
   LandingPage.vue100%100%100%100%
   NotFoundPage.vue100%100%100%100%
   SubmissionListPage.vue100%100%100%100%
   SubmissionReviewPage.vue100%100%100%100%
   UserLoadingPage.vue100%100%100%100%
src/pages/bceidform
   AddressWizardStep.vue100%100%100%100%
   BusinessInformationWizardStep.vue100%100%100%100%
   ContactWizardStep.vue100%100%100%100%
   ReviewWizardStep.vue100%100%100%100%
src/services
   ForestClientService.ts100%100%100%100%

Copy link
Contributor

github-actions bot commented Dec 6, 2023

Frontend e2e Test Coverage

Coverage after merging renovate/npm-vite-vulnerability into main will be
72.68%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   App.vue83.87%75%50%100%62
   CoreConstants.ts100%100%100%100%
   directivesMap.ts100%100%100%100%
   main.ts100%100%100%100%
   routes.ts100%100%100%100%
   shims-vue.d.ts100%100%100%100%
src/components
   DataFetcher.vue97.14%80%100%100%33
   MainHeaderComponent.vue47.58%50%8.33%53.85%100, 107, 122, 134, 141, 150, 173, 173–174, 174–175, 175–176, 176, 185, 185, 185, 197, 197, 197, 201, 217, 217, 217, 230, 249, 41, 41–42, 50, 50, 50, 50–51, 53–55, 55–56, 56, 56–57, 59, 66–67, 70–72, 81, 87, 87, 87–88, 90
   UserProfileComponent.vue30%0%0%42.86%11–12, 15, 17, 17, 17, 17, 19, 21, 23, 4
src/components/forms
   AutoCompleteInputComponent.vue93.55%94.29%85.71%95.59%201, 46, 67, 80, 82
   DropdownInputComponent.vue96.88%96.15%94.44%98.08%111, 136
   MultiselectInputComponent.vue90.11%80.95%85.71%95.92%100, 109, 122, 41, 47, 89
   RadioInputComponent.vue90%80%83.33%96.43%38, 48, 84
   ReadOnlyComponent.vue66.67%100%100%66.67%2
   TextInputComponent.vue92.96%84.21%92.31%97.44%122, 130, 148, 55
src/components/forms/DateInputComponent
   DateInputPart.vue91.30%75%100%100%46, 50
   common.ts100%100%100%100%
   index.vue83.86%74.29%93.75%86.18%108, 117, 120, 122, 137, 149, 203, 218, 225, 269–270, 280–281, 296–298, 300–301, 311–312, 316, 330–333, 340–342, 344–345, 347–348, 350, 352, 352–353, 467, 473, 479
src/components/grouping
   AddressGroupComponent.vue89.67%89.89%90.70%89.09%115, 131, 141, 147, 154–155, 155, 155, 155, 157, 159, 161, 169, 175, 186, 208–209, 225, 274, 317, 355
   ContactGroupComponent.vue98.44%100%100%96.23%84, 91
   ErrorNotificationGroupingComponent.vue38.03%12.90%57.14%57.58%110, 110, 117, 117, 117, 121, 121, 129, 129, 138, 138, 150, 150, 164, 175, 175, 175, 175, 30–31, 31, 34, 58–59, 59, 63, 63–64, 64, 64, 66–67, 67, 69, 73–74, 74, 76, 90, 98, 98
src/composables
   useFetch.ts100%100%100%100%
   useFocus.ts100%100%100%100%
   useScreenSize.ts100%100%100%100%
   useSvg.ts100%100%100%100%
src/dto
   ApplyClientNumberDto.ts100%100%100%100%
   CommonTypesDto.ts100%100%100%100%
src/helpers
   CustomDirectives.ts100%100%100%100%
   DataConversors.ts100%100%100%100%
   ForestClientUserSession.ts100%100%100%100%
src/helpers/validators
   BCeIDFormValidations.ts100%100%100%100%
   GlobalValidators.ts100%100%100%100%
   SubmissionValidators.ts100%100%100%100%
src/pages
   ErrorPage.vue25%100%100%25%11–12, 2
   FormBCSCPage.vue83.41%66.67%71.88%91.97%120–121, 134, 204, 264, 266, 275, 290–292, 315, 315, 315, 317–318, 323, 364, 455, 477, 49–51, 513, 513, 513, 62, 79
   FormBCeIDPage.vue56.17%49.35%33.33%66.40%110–112, 118, 118–119, 124, 124, 124, 127–128, 133, 239, 241, 250, 260–261, 261, 261, 261, 261, 261–264, 279, 279–284, 298, 298–299, 304, 304–305, 305–306, 306, 311, 317–318, 320, 320–322, 327–328, 337, 340–344, 354, 354, 356–358, 430, 460, 460, 460, 477, 477, 477, 525, 528, 528, 528, 547, 68–70, 89, 93–94, 96, 99
   FormSubmittedPage.vue61.11%25%0%83.33%12, 30, 32, 32, 32
   LandingPage.vue75%42.86%100%92.31%18, 18–19, 48, 58
   SubmissionListPage.vue8.05%0%0%12.73%103–105, 137, 153, 153, 178, 178, 23, 26–28, 31–34, 37–38, 41–42, 42–43, 46, 46, 46, 49–51, 54–55, 55, 55, 55, 55, 57, 59, 61, 63, 67–69, 69, 72–73, 75–76, 79–82, 82, 82–83, 85, 88, 91–92, 92–93, 96–97, 97, 97, 97–99
   SubmissionReviewPage.vue19.92%0%0%40.17%102, 104–106, 115, 115–116, 116, 121–122, 122–125, 129, 129, 143, 149–152, 152, 152–153, 155, 158, 161–162, 162–164, 167–168, 168–169, 171–172, 172–173, 176–177, 177–178, 178, 178–179, 182–183, 183, 183, 183, 183, 185, 187, 189, 191, 217, 217, 222, 222, 234, 234, 234, 234, 246, 246, 246, 246, 246, 265, 265, 265, 265, 265, 274, 274, 283, 32, 35–36, 381, 381, 39, 415, 415, 451, 451, 451–452, 452, 452, 456, 456,

@paulushcgcj paulushcgcj merged commit 936f864 into main Dec 7, 2023
18 checks passed
@paulushcgcj paulushcgcj deleted the renovate/npm-vite-vulnerability branch December 7, 2023 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant