Feature/security#82
Open
xurxodev wants to merge 6 commits intodevelopmentfrom
Open
Conversation
- Enable core pack in prepare script - Add packageManager in package.json - Install Yarn 4 in the project - Update .gitignore - Update README
- Add .husky/pre-push running prettify, lint, update-po, and test - Add .husky/post-merge and .githooks/dep-check to run yarn install when yarn.lock changes - Remove obsolete husky.hooks from package.json (Husky 7 uses .husky scripts only)
… transitive deps Align DHIS2 GEE app with EyeSeeTea app-skeleton patterns where practical: Yarn 4, refreshed lockfile, eslint-config-react-app + TypeScript 5.7, Vitest, and Husky pre-push (prettify, lint, update-po, test). Remove Cypress (e2e harness, config, example spec), jest-puppeteer config, and the placeholder example route. Update README and .gitignore accordingly. ESLint: extend testing-library rules only to *.spec/*.test files to avoid false positives in domain code; keep skeleton-style TypeScript/React rules; drop no-misused-promises for async click handlers; do not enforce $/ absolute imports. Vite: reliable proxy skip for production build and Vitest; ESLint in vite-plugin-checker; Vitest include/exclude aligned with skeleton; Vitest uses ephemeral port and no DHIS2 proxy so it does not clash with VITE_PORT / yarn start; invoke `vite build` directly in build-folder. App: @dhis2/app-runtime Provider props for 3.12; validate-gee-api script tweaks; test fixture / i18n template updates (POT/PO) from localize flow. Security: bump axios and pin transitive packages via Yarn resolutions (e.g. lodash, semver, path-to-regexp, qs, node-fetch, minimist, json5, glob-parent, brace-expansion, moment, handlebars, nanoid, underscore, @babel/runtime, form-data, i18next) to patched versions. Note: `yarn npm audit` may still report remaining findings (e.g. legacy babel-eslint / @babel/traverse, Vite advisory window); treat as follow-up if a fully clean audit is required.
| <meta name="dhis2-base-url" content="__DHIS2_BASE_URL__" /> | ||
| <title>GEE App</title> | ||
|
|
||
| <script src="//code.jquery.com/jquery-latest.min.js"></script> |
BundleMonNo change in files bundle size Groups updated (1)
Final result: ✅ View report in BundleMon website ➡️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 References
📝 Implementation
🛡️ Vulnerabilities fixed / mitigated
The items below are mitigated in this repository via direct upgrades and/or Yarn
resolutions(forced transitive versions).Critical
7.26.10High
1.13.54.0.4Medium (resolutions)
1.1.135.1.24.7.91.0.24.18.13.1.31.2.62.30.13.3.82.6.71.9.06.14.27.5.21.13.8Notes
package.json#resolutionsin this repo.The items below are still reported by
corepack yarn npm audit --recursiveand/or remain present inyarn.lock.Some have no patch available in the affected major line; others require upstream upgrades/removals (tooling or major version bumps).
1.0.6(Missing Release of Resource after Effective Lifetime —SNYK-JS-INFLIGHT-6095116)inflight(unmaintained). Present in lockfile (inflight@1.0.6).2.1.0(Prototype Pollution —SNYK-JS-NODEGETTEXT-6100943)node-gettext@2.1.0).4.5.3(multiple dev-server/security advisories)4.5.3. Audit still reports multiple Vite advisories that require upgrading Vite to a newer patched release.babel-eslint)@babel/traversepulled by deprecatedbabel-eslint. Requires migrating away frombabel-eslint(e.g. to@babel/eslint-parser) and/or upgrading the Babel toolchain.google-p12-pem)node-forgepulled bygoogle-p12-pem. Requires upgrading/removing the dependency chain that brings it in.6.26.0(SNYK-JS-BABELTRAVERSE-5962463)babel-traverse@6line. Path (Snyk):@dhis2/d2-ui-forms@7.3.3 → d2@31.1.1 → babel-jest@22.4.4 → babel-plugin-istanbul@4.1.6 → istanbul-lib-instrument@1.10.2 → babel-traverse@6.26.01.8.5(SNYK-JS-BRACES-6838727,npm:braces:20180219)@dhis2/d2-ui-forms@7.3.3 → d2@31.1.1 → babel-jest@22.4.4 → babel-plugin-istanbul@4.1.6 → test-exclude@4.2.3 → micromatch@2.3.11 → braces@1.8.5.10.0.0(SNYK-JS-MARKDOWNIT-2331914,SNYK-JS-MARKDOWNIT-6483324)12.3.2/13.0.2. Current path (Snyk):@dhis2/d2-ui-forms@7.3.3 → d2@31.1.1 → jsdoc@3.6.7 → markdown-it@10.0.0.2.1.3(SNYK-JS-MARKED-2342073,SNYK-JS-MARKED-2342082)4.0.10. Current path (Snyk):@dhis2/d2-ui-forms@7.3.3 → d2@31.1.1 → jsdoc@3.6.7 → marked@2.1.3.2.3.11(SNYK-JS-MICROMATCH-6838728)4.0.8. Current path (Snyk):@dhis2/d2-ui-forms@7.3.3 → d2@31.1.1 → babel-jest@22.4.4 → babel-plugin-istanbul@4.1.6 → test-exclude@4.2.3 → micromatch@2.3.11.2.6.2(SNYK-JS-TAFFYDB-2992450)@dhis2/d2-ui-forms@7.3.3 → d2@31.1.1 → jsdoc@3.6.7 → taffydb@2.6.2.Used plan: Migrate to Yarn 4 with coexistence in other projects
Current situation (example for this repo)
.yarnrcor.npmrc; there is nopackageManagerorenginesin package.json."$": "link:./src"in package.json; thelink:protocol is compatible with Yarn 4.How coexistence works
Corepack (included in Node 16.10+) allows you to pin the Yarn version per project using the
packageManagerfield inpackage.json. You don’t need to change the global Yarn installation on your machine.Typical setup when you work with multiple projects:
yarninstalled withnpm -g, uninstall it withnpm uninstall -g yarn).packageManager:Result:
yarnuses Yarn 4.12.0 (as specified inpackageManager).packageManager,yarnuses Yarn 1.22.22 (or whatever you activated with Corepack).flowchart LR subgraph proyecto_yarn4 [This project] A[packageManager: yarn@4.x] end subgraph otros [Other projects] C[No packageManager or yarn@1] end Corepack[Corepack] Corepack --> A Corepack --> Cyarnwill use the version declared inpackageManager(Yarn 4) via Corepack, without needing to vendor Yarn into.yarn/releases.packageManageror have a different version, they will keep using your global Yarn (1.x or whatever they use).Requirement: have Corepack enabled once on the machine (
corepack enable). There is no need to install Yarn 4 globally.Implementation steps
1. One-time machine setup (per developer)
Run this once on your machine (not per project), to let Corepack manage Yarn versions and keep Yarn 1.x as the default for old projects:
After this, any project without
packageManagerwill use Yarn 1.22.22, and projects withpackageManager: "yarn@4.x.x"will use Yarn 4 via Corepack.2. Migrate this project to Yarn 4
Recommended order:
packageManagerin package.json with an exact version (for example"yarn@4.12.0"). This way Corepack already knows which version to use before.yarn/releasesexists.yarn set versionruns with the right major):corepack use yarn@4.12.0 yarn --version # should print 4.12.0.yarnrc.ymland updates Yarn metadata for the project via Corepack):yarn set version 4.12.0node_modules(as now) and avoid large changes in tooling (Vite, etc.), in .yarnrc.yml (created withset version) keep or add:The lockfile will be converted to Yarn 4 format (yarn.lock with a
__metadataheader).There is no need to touch the
"$": "link:./src"dependency; thelink:protocol is still supported.3. Update .gitignore
Add typical Yarn 4 entries so cache and installation state are not committed:
.yarn/cache(package cache).yarn/install-state.gz.yarn/unplugged.yarn/build-state.yml.pnp.*(if PnP is used in the future)4. Scripts and lifecycle
yarn localize): Still supported in Yarn 4; no changes required.pre/posthooks that need to be rewritten according to the migration guide.5. Documentation
In README.md you can add a short section under Setup to explain that the project uses Yarn 4 + Corepack and how to fix conflicts with a global Yarn 1. For example:
This project uses Yarn 4 managed by Corepack and declares:
If you have Yarn 1 globally and see a packageManager error
If running
yarnshows an error like:do the following once on your machine:
Then, in this project (normal case, once Corepack is enabled):
If for some reason
yarn --versionstill shows1.xinside this repo, you can force Yarn 4 explicitly:corepack use yarn@4.12.0 yarn --version # should now print 4.12.0 yarn install📹 Screenshots/Screen capture
🔥 Testing