Skip to content

[CVE Remediation] Upgrade m2r2 to 2.1.0 to address mistune vulnerabilities - #396

Open
mjohanse-emr wants to merge 2 commits into
mainfrom
users/mjohanse/update_m2r2_cve
Open

mjohanse-emr wants to merge 2 commits into
mainfrom
users/mjohanse/update_m2r2_cve

Conversation

@mjohanse-emr

@mjohanse-emr mjohanse-emr commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

What does this Pull Request accomplish?

Upgrades the m2r2 dependency to 2.1.0 or greater. This causes the mistune requirement to increase to mistune>=3.3,<3.4, which resolves many dependabot issues in this repo. Here's one example.

After upgrading to m2r2 2.1.0, I started getting warnings in the docs build for ni.panel.v1.proto related to poorly formatted field lists:

WARNING: Field list ends without a blank line; unexpected unindent. [docutils]

This warning is being returned because some :returns: fields were being corrupted by the m2r2 convert method. I updated the process_docstring method in that package to skip m2r2 formatting in cases where a docstring has already been processed by Napoleon into RST field lists.

Why should this Pull Request be merged?

To remediate known vulnerabilities in older versions of mistune.

What testing has been done?

I did a quick scan of the resulting html files for ni.panel.v1.proto and they look the same as the current contents on ReadTheDocs.

Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
Signed-off-by: Michael Johansen <michael.johansen@emerson.com>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Test Results

  120 files  ±0    120 suites  ±0   3m 23s ⏱️ -7s
  444 tests ±0    432 ✅ ±0   12 💤 ±0  0 ❌ ±0 
4 440 runs  ±0  4 286 ✅ ±0  154 💤 ±0  0 ❌ ±0 

Results for commit da22291. ± Comparison against base commit c1334a6.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The dependency updates are consistent, and the targeted documentation hook avoids the identified RST corruption.

0 open findings

What changed in this PR

Upgrades documentation tooling across the package suite to remediate Mistune vulnerabilities while preserving panel API documentation rendering.

Changes:

  • Requires m2r2>=2.1.0 and locks Mistune 3.3.4.
  • Prevents m2r2 from reprocessing Napoleon-generated RST field lists.
File Description
packages/​ni.protobuf.types/​pyproject.toml Updates m2r2 requirement.
packages/​ni.protobuf.types/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.panels.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.panels.v1.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.panels.v1.proto/​docs/​conf.py Protects Napoleon RST fields from m2r2 conversion.
packages/​ni.measurements.metadata.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurements.metadata.v1.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurements.metadata.v1.client/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurements.metadata.v1.client/​poetry.lock Refreshes documentation and local dependency locks.
packages/​ni.measurements.data.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurements.data.v1.proto/​poetry.lock Refreshes documentation and local dependency locks.
packages/​ni.measurements.data.v1.client/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurements.data.v1.client/​poetry.lock Refreshes documentation and local dependency locks.
packages/​ni.measurementlink.sessionmanagement.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.sessionmanagement.v1.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurementlink.sessionmanagement.v1.client/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.sessionmanagement.v1.client/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurementlink.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurementlink.pinmap.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.pinmap.v1.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurementlink.pinmap.v1.client/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.pinmap.v1.client/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurementlink.measurement.v2.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.measurement.v2.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurementlink.measurement.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.measurement.v1.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurementlink.discovery.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.discovery.v1.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.measurementlink.discovery.v1.client/​pyproject.toml Updates m2r2 requirement.
packages/​ni.measurementlink.discovery.v1.client/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.grpcdevice.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.grpcdevice.v1.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.datamonikers.v1.proto/​pyproject.toml Updates m2r2 requirement.
packages/​ni.datamonikers.v1.proto/​poetry.lock Locks upgraded documentation dependencies.
packages/​ni.datamonikers.v1.client/​pyproject.toml Updates m2r2 requirement.
packages/​ni.datamonikers.v1.client/​poetry.lock Refreshes documentation and local dependency locks.
packages/​ni-grpc-extensions/​pyproject.toml Updates m2r2 requirement.
packages/​ni-grpc-extensions/​poetry.lock Refreshes documentation and local dependency locks.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with urllib3, our distribution packages do not depend on m2r2 and changing pyproject.toml is not necessary. It's sufficient for Renovate to update poetry.lock:

Image

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After upgrading to m2r2 2.1.0, I started getting warnings in the docs build for ni.panel.v1.proto related to poorly formatted field lists:

WARNING: Field list ends without a blank line; unexpected unindent. [docutils]

This warning is being returned because some :returns: fields were being corrupted by the m2r2 convert method. I updated the process_docstring method in that package to skip m2r2 formatting in cases where a docstring has already been processed by Napoleon into RST field lists.

If your fix for this works with the old m2r2 as well then it can be merged separately from the version update. Alternately, you can add your commit to Renovate's PR.

This branch has not been deployed

No deployments
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.

3 participants