Skip to content

Security: Upgrade pymdown-extensions to 10.21.3 (CVE-2026-46338)#182

Open
scotmatson wants to merge 1 commit into
mainfrom
security/upgrade-pymdown-extensions-cve-2026-46338-clean
Open

Security: Upgrade pymdown-extensions to 10.21.3 (CVE-2026-46338)#182
scotmatson wants to merge 1 commit into
mainfrom
security/upgrade-pymdown-extensions-cve-2026-46338-clean

Conversation

@scotmatson
Copy link
Copy Markdown
Contributor

@scotmatson scotmatson commented May 21, 2026

Summary

Upgrades pymdown-extensions from 10.21.2 to 10.21.3 to address CVE-2026-46338, a medium-severity path traversal vulnerability in the snippets preprocessor.

Origin: This security issue was surfaced by Dependabot alert #13.

Risk Assessment

Actual exposure: MINIMAL

  • The vulnerable pymdownx.snippets feature is enabled but not used (zero instances in docs)
  • Default configuration (restrict_base_path: true) provides protection
  • No secrets or sensitive files in repository root
  • Code review process would catch malicious snippet syntax

Vulnerability Details

CVE: CVE-2026-46338 / GHSA-62q4-447f-wv8h
Affected: pymdown-extensions 10.0.1 - 10.21.2
Fixed in: 10.21.3 (released 2026-05-13)
Dependabot alert: #13

Technical issue: Path traversal in pymdownx.snippets preprocessor allows reading files outside base_path using sibling prefix bypass. The vulnerable code uses filename.startswith(base) for path containment checks, which doesn't enforce directory boundaries. This allows snippet directives like --8<-- "../docs_secret/file.txt" to bypass restrict_base_path settings and read files from sibling directories that share the same prefix (e.g., docs vs docs_secret).

Attack scenario:

  1. Attacker contributes a PR with malicious markdown containing: --8<-- "../sensitive_dir/secrets.txt"
  2. During docs build, the snippet preprocessor reads the file
  3. Sensitive content gets embedded in generated HTML
  4. HTML is published to GitHub Pages, exposing secrets

Impact: Arbitrary file read within the host filesystem, bounded by prefix matching. In CI/CD contexts, could expose secrets or sensitive files in documentation builds.

Testing

  • ✅ Clean rebase from latest main (eec1379)
  • ✅ Documentation builds successfully (mkdocs build --strict)
  • ✅ Only uv.lock changed (no merge conflicts)
  • ✅ Sanity tests pass locally
  • ✅ Pre-commit hooks pass (ruff format, ruff lint, interrogate)
  • ✅ CI will run full test suite (6,772+ tests with ≥90% coverage)

Changes

  • uv.lock: pymdown-extensions 10.21.2 → 10.21.3
  • Single patch version bump, no breaking changes expected
  • Transitive dependency via mkdocs-material (no pyproject.toml changes needed)

Post-Merge Actions

References

Addresses path traversal vulnerability in pymdownx.snippets preprocessor
that allows reading files outside base_path using sibling prefix bypass.

Risk assessment: MINIMAL
- Snippets extension is enabled but not used (zero instances of --8<--)
- Default restrict_base_path configuration is safe
- No secrets or sensitive files in repository root

Testing performed:
- Documentation builds successfully with strict mode
- Sanity tests pass (30 tests in 0.14s)
- Pre-commit hooks pass (ruff format, ruff lint, interrogate)
- Site structure unchanged (only timestamps differ)

Full test suite will run in CI (6,772+ tests with 90%+ coverage).

References:
- CVE-2026-46338
- GHSA-62q4-447f-wv8h
- Dependabot alert #13
- pymdown-extensions 10.21.3 release (2026-05-13)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@scotmatson scotmatson requested a review from jaredmixpanel May 21, 2026 17:14
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