Hub rules-matplotlib

rules-matplotlib

v3 public Verified

Matplotlib

Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. These rules ensure proper plot generation, resource management, and secure handling of data during visualization tasks.

@sigmashakeinc 2 pulls 5 rules published Apr 8, 2026 synced Nov 22, 2026 sigmashakeinc/rules/rulesets/rules-matplotlib →
Severity
3 error 2 warn 0 info
demo.cast
Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. These rules ensure proper plot generation, resource management, and secure handling of data during visualization tasks.

Rules index

5 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

matplotlib

matplotlib-no-html-backend-with-user-data warning log

The WebAgg/tornado backend serves an interactive matplotlib canvas over HTTP. Without authentication and proper network binding it exposes the figure server to any local network client. Bind to 127.0.0.1 only and add authentication before exposing over a network.

Rule source requires an active Pro or Enterprise subscription.
matplotlib-no-pickle-load-figure error block

Matplotlib figure files (.fig) are serialised with pickle. pickle.load() on an untrusted .fig file executes arbitrary Python during deserialization (CWE-502). This is the documented attack vector for matplotlib figure poisoning. Load figures only from trusted sources; prefer open formats (PNG, SVG, PDF) for data exchange.

Rule source requires an active Pro or Enterprise subscription.
matplotlib-no-pylab-star-import warning log

from pylab import * imports ~400 names into the global namespace, shadowing built-ins (e.g. sum, max, abs) with numpy equivalents — a common source of hard-to-debug behaviour in larger code. Use 'import matplotlib.pyplot as plt; import numpy as np' instead.

Rule source requires an active Pro or Enterprise subscription.
matplotlib-no-rcparams-from-user-input error block

Matplotlib rcParams controls backend selection (e.g. 'backend', 'pgf.texsystem'). Setting rcParams from user-supplied values can force the LaTeX backend with attacker-controlled preamble, enabling shell injection via LaTeX (CVE-class: backend-induced command execution). Never pass user input directly to rcParams; validate against a whitelist of known-safe values.

Rule source requires an active Pro or Enterprise subscription.
matplotlib-no-savefig-user-path error ask

Path traversal risk (CWE-22): savefig() path is constructed from user-controlled input. An attacker can write files to arbitrary locations on the server by injecting '../' sequences. Resolve the output path against a fixed safe directory with os.path.abspath and verify it stays within bounds before calling savefig().

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v3
Published
Apr 8, 2026
Source commits
0
Synced
Nov 22, 2026
Hash
ca13e2c30e49c238d535f4b73e5c69c49a1bca4dad51aecc3a13f019cfc0ca25
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-matplotlib/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-matplotlib. The published version only bumps when a maintainer resyncs.

No commit history available.