rusackas opened a new pull request, #44742: URL: https://github.com/apache/superset/pull/44742
### SUMMARY `apache/superset/security/dependabot/9` (`underscore`, GHSA-cf4h-3jhx-xvhq / CVE-2021-23358, critical) stayed unresolved for years because it only ever reached this repo transitively, via `po2json` -> `nomnom` -> `underscore`. #44457 fixed that by swapping in `@hainenber/po2json`, a real fix, but a two-week-old, single-maintainer fork with no track record — the kind of dependency this repo shouldn't lean on long-term. Every `po2json` fork (the original, `@hainenber`'s, `@connectedcars`'s, ...) is really just a thin CLI wrapper around `gettext-parser` (actively maintained, ~3.9M downloads/month) plus a PO → Jed-JSON transform of maybe 40 lines. This replaces the fork with that transform, written and owned in-repo instead of depending on yet another narrow, po2json-shaped package: - `scripts/po2json.js` — pure library, `poToJed(poBuffer, domain)` → Jed 1.x language pack. Unit tested directly (`spec/scripts/po2json.test.ts`) against the real `gettext-parser` package, not a mock. - `scripts/po2json-cli.js` — thin CLI wrapper `po2json.sh` calls; no testable logic of its own. - `gettext-parser`'s header keys keep each PO file's own casing (its README claims they're lowercased — they aren't), looked up case-insensitively so a differently-cased file doesn't silently lose its `Language`/`Plural-Forms` value. - An untranslated entry is included exactly as `gettext-parser` parsed it (including an empty `msgstr`), rather than backfilled with the English source text the way some po2json forks do for empty plural forms — verified directly against the `jed` package this repo ships that `translate().fetch()` already falls back to the original `msgid`/`msgid_plural` whenever the stored value is empty or the key is missing entirely, so backfilling would be a no-op. `underscore`, `nomnom`, `po2json`, `@hainenber/po2json`, `commander` and `gettext-to-messageformat` are all gone from `package-lock.json`. ### TESTING INSTRUCTIONS ``` npx jest spec/scripts/po2json.test.ts packages/superset-core/src/translation npm run build-translation ``` - Verified byte-for-byte equivalent (modulo the harmless empty-vs-English-prefilled-plural difference explained above) against real `po2json` output across German (2-form plural rule), Russian (3-form), Arabic (6-form), and Chinese (fully untranslated file). - `npm run build-translation` regenerates all 30 `messages.json` files cleanly. - Confirmed directly against the `jed` package that both a missing key and a key with an empty `msgstr` correctly fall back to the original source string at render time. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [x] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
