Page MenuHomePhabricator

Application Security Review Request : Pinia
Closed, ResolvedPublic

Description

Project Information

  • Name of tool/project: Pinia
  • Project home page: https://pinia.vuejs.org/
  • Name of team requesting review: Design Systems Team
  • Primary contact: Anne Tomasevich (@AnneT)
  • Target date for deployment: There is currently no project using Pinia, but its lack of security review is preventing teams from using it and leading them to opt for Vuex 4, which has been succeeded by Pinia. Any project built in Vue 3 that needs a state management library should use Pinia, so it will become necessary soon. I will update this if work on a project that uses Pinia begins.
  • Link to code repository / patchset: https://github.com/vuejs/pinia, https://www.npmjs.com/package/pinia

Description of the tool/project: Pinia is the new official state management library for use with Vue.js, succeeding Vuex 4. While Vuex 3 and 4 will continue to be maintained, no new features will be added, and the Vue core team recommends using Pinia for new projects (see the note on the Vuex website).

Description of how the tool will be used at WMF: Several WMF Vue projects use Vuex for state management (e.g. MediaSearch, MachineVision, WikiLambda), and some of them may continue to use Vuex if we determine that a migration is not worth it. However, any new project built with Vue 3 that requires complex state management should use Pinia, as recommended by the Vue core team, and to capitalize on its improvements over Vuex (notably its lighter weight, better type safety, modularity, and more intuitive patterns).

Dependencies
None

Has this project been reviewed before?
No. Vuex 4 was reviewed in T288768, but they are distinct projects.

Working test environment

Post-deployment
The Design Systems Team will be responsible for this library:

Details

Risk Rating
Low

Event Timeline

@AnneT - Is there a more specific target date for deployment, for any project that would wish to use Pinia? The Security-Team would likely be able to get to next quarter (Q1 FY23), at the earliest.

Hi @sbassett, we don't have a more specific target date for deployment as there is not yet a project using Pinia. This is a chicken-and-egg situation: teams are not using Pinia because it's not security reviewed, but it's not security reviewed because no one is using it.

Instead, teams are opting to use Vuex 4. This means they will either need to migrate to Pinia, which is not terribly straightforward since the APIs are quite different, or stick with a library that will see no further development (although it will be supported with security updates for a while, at least). We're seeing this with:

  • WMDE (Special:NewLexeme revival, see thread)
  • Structured Data (Special:Search updates)
  • Growth (GrowthExperiments features)

So, we're hoping to make Pinia available for use to reduce the need to future migrations and/or supporting a duplicative, outdated library in core.

Please do let us know if there's anything we (the Design Systems Team) can do to facilitate this review. We understand that it's hard to prioritize a review without an associated deadline, and as the "owners" of this library and its maintenance, we're happy to do anything we can to reduce the burden on the security team here.

sbassett changed the task status from Open to In Progress.Jul 6 2022, 5:53 PM
sbassett assigned this task to mmartorana.
sbassett triaged this task as Medium priority.

Security Review Summary - T308495 - 2022-09-26

Overall, the current vendor code under consideration looks pretty good.

I suggest switching over to this project since it is actively maintained by the Vue team, has no known security issues, and the development looks healthy. While, on the other hand, Vuex is in "maintenance mode" and won't receive any new improvements anymore.

The Vue team is very active at keeping the dependencies updated, between the start and end of this review, many vulnerable dependencies have been updated and mitigated.

The only vulnerable dependency (parse-url), and the outdated packages are actually dev dependency; therefore I would assign an overall risk rating of: low.

Pinia

General Security Information

Statistic/InfoValueRisk
Repositoryhttps://github.com/vuejs/pinia none
Relevant tag/branchorigin/v2 none
Last commit reviewed (if relevant)b638245 none
Recent contributions to code (6 months)174 low
Active developers with > 10 commits7 low
Current overall usage8.8k stars, 551 forks low
Current open security issues0 none
Methods for reporting security issuessecurity policy none

Vulnerable Packages (dev)

VulnerabilityPackageVulnerable versionPatched versionRiskInfo
Server-Side Request Forgery (SSRF)parse-url<8.1.0>=8.1.0 criticaladvisory link
Hostname Spoofingparse-url<8.1.0>=8.1.0 mediumadvisory link

Outdated Packages (dev)
As reported via npm outdated:
(no explicit vulnerabilities reported, simply noting for completeness' sake.)

PackageCurrentWantedLatest
@rollup/plugin-commonjs22.0.122.0.222.0.2
@rollup/plugin-node-resolve13.3.013.3.014.1.0
@types/jest28.1.428.1.829.0.3
@types/node16.11.4116.11.5918.7.18
@vue/compiler-sfc3.2.373.2.393.2.39
@vue/server-renderer3.2.373.2.393.2.39
chalk4.1.24.1.25.0.1
expect28.1.128.1.329.0.3
globby12.2.012.2.013.1.2
jest28.1.228.1.329.0.3
jest-environment-jsdom28.1.228.1.329.0.3
lint-staged12.5.012.5.013.0.3
pascalcase1.0.01.0.02.0.0
rollup2.75.72.79.02.79.0
rollup-plugin-typescript20.31.20.31.20.34.0
typedoc0.22.150.22.180.23.15
typedoc-plugin-markdown3.12.13.13.63.13.6
typescript4.6.34.8.34.8.3
vue3.2.373.2.393.2.39

risk low.

Static Analysis Findings

Semgrep, Snyk and other SAST tools have returned a few findings, most of them are false positives: Risk low.

  1. Possible writing/reading outside of the destination, make sure that the target path is nested in the intended destination:
packages/size-check/rollup.config.js:

        22┆ file: path.resolve(__dirname, `./dist/${file}.js`),
          ⋮ -----------------------------------------------------------
        25┆ input: path.resolve(__dirname, `./src/${file}.js`),

General Security Issues

  1. git secrets, gitleaks and whispers returned some generic API keys. Risk low.

Supplemental Materials
Please see attached:

Hi @AnneT - even though my review has an overall risk of low, do you have any plans for addressing those issues?

Thank you.

Just noting that the latest release 2.0.23 of pinia includes commit 050ede0, which updated the dependencies, including parse-url to the no longer vulnerable 8.1.0:

[migr:~/temp/2022-10-11/pinia] v2 ± git show 050ede0 | grep 'parse-url'
-      parse-url: 7.0.2
+      parse-url: 8.1.0
-  /parse-url/7.0.2:
+  /parse-url/8.1.0:
[migr:~/temp/2022-10-11/pinia] v2 ±

Static Analysis Findings

Semgrep, Snyk and other SAST tools have returned a few findings, most of them are false positives: Risk low.

  1. Possible writing/reading outside of the destination, make sure that the target path is nested in the intended destination:
packages/size-check/rollup.config.js:

        22┆ file: path.resolve(__dirname, `./dist/${file}.js`),
          ⋮ -----------------------------------------------------------
        25┆ input: path.resolve(__dirname, `./src/${file}.js`),

This may be a legitimate issue, but since rollup.config.js is the config file for the build tool, it only affects people running the build tool, not users of the library.

Thanks, @Michael and @Catrope! So @mmartorana, it seems there is no further action needed at the moment, but we will use a newer release of Pinia whenever we add it to core (and will audit the npm dependencies at that time to ensure no new critical vulnerabilities have come up). Let me know if I've missed anything!

mmartorana moved this task from Waiting to Our Part Is Done on the secscrum board.

Hi @AnneT - Thanks for investigating these issues. The review came in as low risk, so I am just going to resolve this ticket for the moment.

Feel free to create new tasks to address these remaining issues, if you want.