Skip to content

chore: patch moment/minimatch advisories, sync package.json version, refresh stale docs - #46

Merged
jphan32 merged 4 commits into
devfrom
chore/dependency-hygiene
Nov 1, 2026
Merged

jphan32 merged 4 commits into
devfrom
chore/dependency-hygiene

Conversation

@jphan32

@jphan32 jphan32 commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Follow-ups found after merging the Dependabot PRs #43–#45. Both Dependabot security updates (moment, minimatch) had failed because upstream version ranges block the patched releases.

1. moment alert #35 (GHSA-4p3w-j4w9-5jqw) — closed

  • obsidian pins moment to exactly 2.29.4. Added the npm override moment: ^2.31.0.
  • moment is used only for the type declarations in obsidian.d.ts and is never bundled. The production main.js / styles.css are byte-identical before and after.

2. minimatch alert #37 (GHSA-g3hv-75wg-m249) — vulnerable code replaced; alert will stay open

The only patched release is 11.0.1, and no upstream release (not even eslint 10) accepts 11.

  • Overridden to ^11.0.1 under eslint, @eslint/config-array, @eslint/eslintrc, @typescript-eslint/typescript-estree and eslint-plugin-n.
    • These packages use only the named Minimatch / minimatch exports, which 11 keeps.
    • This replaces 9.0.9 and 10.2.5, the copies that actually contain the vulnerable code. ESLint's own file/config matching now runs on 11.0.3.
  • Left alone on purpose: eslint-plugin-import / eslint-plugin-react (3.x) and eslint-plugin-json-schema-validator (8.x, pinned by eslint-plugin-obsidianmd).
  • Tried and dropped: a callable shim delivered through a file: override. npm 11 resolves file: overrides relative to each consumer (broken links). An npm alias to a workspace goes to the registry instead.
  • Rationale and removal criteria are documented in docs/DEVELOPMENT.md.

3. package.json version drift

  • The docs said to keep package.json in sync with manifest.json, but nothing checked it, and it stayed at 1.1.5 through 1.2.0–1.2.2.
  • Bumped package.json / package-lock.json to 1.2.2.
  • scripts/validate.mjs now fails CI on a mismatch. Confirmed it fails on the old state.
  • Added the step to CONTRIBUTING.md, DEVELOPMENT.md, CLAUDE.md and the release PR checklist.

4. Stale docs

  • Corrected the src/main.ts line count in CLAUDE.md (~900 → ~1,850).
  • Fixed the dependabot.yml comment that still said "plain CommonJS with no build step".

No user-visible change and no release needed.

Test plan

  • Full CI gate: npm ci && npm run lint && npm run build && node --check main.js && node scripts/validate.mjs
  • npm ls moment → 2.31.0 everywhere. npm audit no longer reports moment. The remaining minimatch findings are only the 3.1.5 / 8.0.7 copies above.
  • Differential test, minimatch 3.1.5 vs 11.0.3, on the option sets ESLint and eslint-plugin-n pass: 3,300 cases. The only differences are patterns containing .., which our config does not use.
  • eslint --print-config src/main.ts is identical before and after, and the same files are linted.
  • main.js / styles.css hashes unchanged.
  • New transitive deps (brace-expansion 5.0.12 etc.) support Node 20 (CI).

🤖 Generated with Claude Code

jphan32 and others added 4 commits November 2, 2026 03:49
`obsidian` pins `moment` to exactly 2.29.4, so Dependabot's security
update for alert #35 fails with "latest possible version ... is 2.29.4".
Force the patched release with an npm `overrides` entry instead.

`moment` is only consumed for the type declarations in obsidian.d.ts;
src/ never imports it and esbuild never bundles it (Obsidian provides
its own copy at runtime). Type-check and lint pass, and the production
main.js / styles.css are byte-identical before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release docs already said to keep package.json's version in sync with
manifest.json, but nothing checked it, and it stayed at 1.1.5 through the
1.2.0, 1.2.1 and 1.2.2 releases. Bump package.json / package-lock.json to
1.2.2 and make scripts/validate.mjs fail CI when either disagrees with
manifest.version.

List the package.json bump (`npm version <x.y.z> --no-git-tag-version`) as an
explicit step in CONTRIBUTING.md, docs/DEVELOPMENT.md, CLAUDE.md and the
release PR checklist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- src/main.ts is ~1,850 lines now, not ~900.
- dependabot.yml still described the plugin as "plain CommonJS with no build
  step", which predates the TypeScript + esbuild toolchain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-g3hv-75wg-m249)

The globParts-amplification DoS is only fixed in minimatch 11.0.1, and no
upstream release (not even eslint 10) accepts 11, so Dependabot's security
update fails. Override minimatch to ^11.0.1 under the consumers that only use
the named `Minimatch` / `minimatch` exports, which 11 keeps:

  eslint, @eslint/config-array, @eslint/eslintrc,
  @typescript-eslint/typescript-estree, eslint-plugin-n

This replaces the copies that actually contain the vulnerable code (9.0.9,
10.2.5) and moves ESLint's own file/config matching to 11.0.3.

Left alone on purpose: eslint-plugin-import / eslint-plugin-react (3.x) and
eslint-plugin-json-schema-validator (8.x, pinned by eslint-plugin-obsidianmd)
call the module itself or its default export. minimatch >= 10 exports a plain
object, so forcing 11 there would crash them. 3.x predates the vulnerable
preprocessing, and the json-schema-validator rules are not enabled for src/.
A callable shim via a `file:` override was tried and dropped: npm 11 resolves
`file:` overrides relative to each consumer, which produces broken links.

Verification:
- differential test, minimatch 3.1.5 vs 11.0.3, on the option sets ESLint and
  eslint-plugin-n pass: 3300 cases, only diffs are patterns containing `..`
  (11 normalizes them), which our config does not use
- `eslint --print-config src/main.ts` is identical before and after, and the
  same files are linted
- full CI gate passes; production main.js is unaffected (dev toolchain only)

Rationale and removal criteria are documented in docs/DEVELOPMENT.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jphan32 jphan32 changed the title chore: close moment advisory, sync package.json version, refresh stale docs chore: patch moment/minimatch advisories, sync package.json version, refresh stale docs Nov 1, 2026
@jphan32 jphan32 mentioned this pull request Nov 1, 2026
@jphan32
jphan32 merged commit 9510128 into dev Nov 1, 2026
1 check passed
@jphan32
jphan32 deleted the chore/dependency-hygiene branch November 1, 2026 19:22
@jphan32 jphan32 mentioned this pull request Nov 1, 2026
5 of 9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant