121 Commits

Author SHA1 Message Date
nicolargo
e68e9f4452 Add unit test to containers/docker plugin 2026-05-31 17:34:25 +02:00
nicolargo
2afc533d67 Merge branch 'Issue-3555_load_additional_plugins' of github.com:20086080/glances into 20086080-Issue-3555_load_additional_plugins 2026-05-23 15:48:42 +02:00
nicolargo
ff3eec3295 Command Injection via KVM/QEMU VM Domain Names in glances/plugins/vms/engines/virsh.py - CVE-2026-46606 2026-05-23 12:27:19 +02:00
nicolargo
cf14166fbe test(outdated): json round-trip and graceful migration from legacy pickle cache
Cover the non-RCE behaviour of the new JSON cache:
- round-trip: written file is valid JSON, re-read produces equivalent dict
- legacy pickle: a pre-fix pickle cache is treated as a cache miss, not
  a crash (upgrade path)
- expiry: caches older than 7 days are invalidated
- version skew: caches written by a different installed version are
  invalidated
- first run: a missing file is not an error
2026-05-23 11:52:53 +02:00
nicolargo
7098478c39 test(outdated): failing test — malicious pickle cache must not execute (CVE-2026-46607)
Regression test for GHSA-9837-48hr-q32j: glances/outdated.py reads its
version-check cache file via pickle.load(), a deserialization format
that executes arbitrary callables embedded via __reduce__.

The test plants a poisoned pickle at the cache path and asserts that
_load_cache() does NOT trigger the embedded callable. Against the
current (vulnerable) code this fails because the payload fires before
the TypeError is raised on the unrelated dict subscript.

The fix in the next commit replaces pickle with json, which is a passive
data format.
2026-05-23 11:50:55 +02:00
nicolargo
0de3b8f875 XML-RPC Multi-Origin CORS Configuration Silently Falls Back to Wildcard - CVE-2026-46608 2026-05-23 11:40:20 +02:00
nicolargo
cad6f985a5 test(xmlrpc): port stripping and missing-Host edge cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 09:53:06 +02:00
nicolargo
8e6c9c955c test(xmlrpc): wildcard Host patterns via fnmatch
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 09:52:30 +02:00
nicolargo
575dc7e81b test(xmlrpc): allowlisted Host returns 200
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 09:51:58 +02:00
nicolargo
b88dd7bcfd test(xmlrpc): failing test — spoofed Host should be rejected (CVE-2026-46611)
Adds a second test server bound to a config that enables xmlrpc_allowed_hosts,
plus the failing assertion that a spoofed Host header returns 400. The fix in
glances/server.py follows in the next commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 09:50:40 +02:00
nicolargo
b2965cca96 test(xmlrpc): lock in current permissive default (regression baseline)
This test passes on the unpatched server and proves the CVE-2026-46611
vulnerability exists today: a spoofed Host header is accepted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 09:49:43 +02:00
nicolargo
01437d61e2 test(xmlrpc): scaffold for Host header validation tests
Re-creates tests/test_xmlrpc.py (deleted symlink) with a pytest module
modelled on test_restful.py: subprocess-launched server and a helper
to POST XML-RPC calls with a controllable Host header. Restores the
existing 'make test-xmlrpc' Makefile target.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 09:48:47 +02:00
20086080
bcc18b4ab3 Fix : Codacy 2026-05-21 03:06:41 +00:00
20086080
389b6d45bb Fix : Codacy 2026-05-21 02:57:23 +00:00
20086080
c3a8fb2f05 Test : Unit tests 2026-05-21 02:22:17 +00:00
Nicolas Hennion
7e118d5946 Merge pull request #3557 from DeepSpace2/feat-containers-cpu-limits
feat: add cpu limit to docker, podman and lxd containers
2026-05-17 11:24:50 +02:00
Yan
b42defb1d8 Keep auto_unit within limits, so columns stay aligned
Occasionally, columns got misaligned, because auto_unit returned too
many decimals when the number was slightly below 10 or 100.
Actually, when (9.995 <= n < 10) and (99.95 < n < 100).

For example,
10*2**20-1 returned 10.00M instead of 10.0M and
100*2**20-1 returned 100.0M instead of 100M.

Tests added to verify correctness.
2026-05-16 21:45:09 +00:00
Adi
b4b2118933 feat: add cpu limit to docker, podman and lxd containers 2026-05-15 17:32:25 +03:00
20086080
7407f35661 Fix : Codacy Issues 2026-05-07 12:59:37 +00:00
20086080
31f07cd6c9 Fix : Codacy Issues 2026-05-07 12:54:47 +00:00
20086080
d529cf2d59 Fix : Codacy Issues 2026-05-07 12:49:09 +00:00
20086080
e6139651e8 Fix : Codacy Issues 2026-05-07 12:44:11 +00:00
20086080
399586d61b Fix : Codacy Issues 2026-05-07 12:32:05 +00:00
20086080
afad68e9a2 Doc : Comments & Doc Strings to test file 2026-05-07 12:05:44 +00:00
20086080
7f962dde45 Test : Tests for new helper functions in __display_top() 2026-05-07 11:49:08 +00:00
Nicolas Hennion
646b301764 Merge pull request #3532 from lawrence3699/fix/fs-alias-case
Fix filesystem aliases for mixed-case mount points
2026-04-22 09:47:45 +02:00
nicolargo
9db2b8cbc3 GPU Monitoring (ARM / RaspberryPi) #1048 2026-04-21 11:38:05 +02:00
lawrence3699
c5e999f56a fix: match filesystem aliases case-insensitively
Fixes #3370
2026-04-19 19:10:58 +10:00
Christian Rishøj
34943bae5c #3524 suppress Codacy asserts/D203 warnings in new tests 2026-04-16 18:12:18 +02:00
Christian Rishøj
c68f1fc52e #3524 fix LXD container filter excluding standalone instances
connect() unconditionally stored server_name as local_node, and
update() filtered instances whose location did not match. On a
standalone LXD host, instance.location is empty, so every container
was dropped and the user saw no LXD stats at all.

Gate the filter on environment.server_clustered — only apply the
cluster-member filter when the daemon reports itself as clustered.
Also promote the connect() failure log from debug to error so that
future connectivity issues are visible in the default log.
2026-04-16 18:06:45 +02:00
csvke
a8023b3e4c RV1126BP-70: Add config, docs, and unit tests for MPP plugin
- Add [mpp] section to conf/glances.conf with disable=True
- Add docs/aoa/mpp.rst documentation page and index entry
- Add unit test test_026_mpp with Rockchip MPP test fixtures
2026-04-11 01:34:44 +08:00
nicolargo
f5f1c33a3c Prepare release 4.5.3 2026-03-29 16:41:48 +02:00
Jeongwoo Kim
5cf5d22d64 test(webui): mark pytest asserts as nosec for Codacy 2026-03-27 00:04:48 +09:00
Jeongwoo Kim
fe79aa43c5 test: silence pylint in template response regression tests 2026-03-27 00:01:05 +09:00
Jeongwoo Kim
0d0057c8c9 test(webui): add helper docstrings for Codacy 2026-03-26 23:36:26 +09:00
Jeongwoo Kim
25484125ee style(webui): wrap new lines for Codacy 2026-03-26 23:23:29 +09:00
Jeongwoo Kim
8a6284a66c fix(webui): support Starlette TemplateResponse signature changes 2026-03-26 23:02:44 +09:00
Nicolas Hennion
137dc03a11 Lint the code 2026-03-24 08:18:04 +00:00
Steve Kowalik
5badf71000 Use sys.executable in the testsuite
Rather than looking for a venv python executable, use the existing
sys.executable property to execute the modules required.
2026-03-24 11:19:11 +11:00
nicolargo
b6a694f38f Add export to ClickHouse #3320 2026-03-22 10:15:17 +01:00
Christian Rishøj
139506b109 #3480 add unit tests for LXD container engine
- TestLxdStatsFetcher: CPU delta, memory fallback, network loopback exclusion, thread lifecycle
- TestLxdExtensionGenerateStats: stopped/running instances, proxy device ports, image config
- TestLxdExtensionUpdate: running filter, all_tag, cluster node filter, cleanup of removed instances

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-15 19:09:44 +01:00
nicolargo
f3e94930e3 SQL Injection in DuckDB Export via Unparameterized DDL Statements - Correct CVE-2026-32611 2026-03-14 10:33:24 +01:00
nicolargo
5680a5da4a Command Injection via Process Names in Action Command Templates - Correct CVE-2026-32608 2026-03-14 09:52:12 +01:00
nicolargo
2abe8d8733 Central Browser Autodiscovery Leaks Reusable Credentials to Zeroconf-Spoofed Servers - Correct CVE-2026-32634 2026-03-14 09:33:37 +01:00
nicolargo
45b3164464 Improve docs and also add min/max/mean for CPU and load 2026-03-07 10:09:24 +01:00
Siddharth Doshi
e306ad24b6 feat(plugin): add generic mmm (min/max/mean) support in base plugin model
Introduce a generic Min/Max/Mean (mmm) mechanism at the plugin model level.

When a field in `fields_description` defines `'mmm': True`, the plugin
automatically generates and maintains the following derived fields:

  <field>_min
  <field>_max
  <field>_mean

The computation is handled in the base plugin model to ensure the
feature is reusable across all plugins. Mean is calculated as a
running mean, and min/max are updated on each refresh cycle.

This implementation:
- Keeps the feature opt-in per field
- Avoids hardcoding logic in individual plugins
- Maintains full backward compatibility
- Preserves existing API v4 response structure
- Ensures no regression in existing behavior

Unit tests have been added to validate correct field generation
and update behavior.
2026-03-01 17:34:33 +05:30
Siddharth Doshi
5248bec5ee Enhance the existing memory plugin to track runtime minimum and maximum memory usage percentage since Glances startup and expose these values through the existing /api/4/mem endpoint. 2026-02-28 14:30:31 +05:30
nicolargo
18fa740db7 Format and lint 2026-02-26 21:55:37 +01:00
Nicolas Hennion
c24d3de651 Merge pull request #3454 from Julietmgbole/json-improvement-b
Improve JSON serializer with comprehensive normalization and tests
2026-02-25 09:35:23 +01:00
SudeepMalipeddi
c188365b42 fix: guard args access in msg_curse across 9 plugins
Several plugins call msg_curse(args=None) with args defaulting to None,
but then access args attributes directly (e.g. args.diskio_iops) without
checking if args is None first, causing AttributeError in tests and any
caller that omits args.

Add `args and` guard before every args attribute access in msg_curse for:
- diskio (4 places)
- fs (2 places)
- network (6 places)
- processlist (7 places)
- processcount (1 place)
- system (1 place)
- load (1 place)
- containers (1 place)
- gpu (2 places)

Also fix TestDiskioPluginMsgCurse tests to call update_views() before
msg_curse() so views are populated before rendering.

Fixes #3429
2026-02-24 23:17:24 +05:30