Skip to content

Commit 6806a1b

Browse files
committed
Fix HIGH CVEs: certifi, click, pyasn1, starlette
Patches the following vulnerabilities flagged in the KRR-Production-Legacy scan: - CVE-2024-39689 (certifi 2024.2.2): pin certifi >=2024.7.4 in pyproject, locked to 2026.7.22 (removes GLOBALTRUST root certificates). - CVE-2026-7246 (click 8.1.7): pin click ^8.3.3 in pyproject, locked to 8.5.0 (command injection in click.edit()). - CVE-2026-30922 / CVE-2026-59884 / CVE-2026-59885 / CVE-2026-59886 (pyasn1): main app already locked to 0.6.4 (fixed); raise the enforcer floor from >=0.6.2 to >=0.6.4 so image builds cannot resolve a vulnerable version. - CVE-2026-48818 / CVE-2026-54283 (starlette): raise the enforcer floor from >=1.0.0 to >=1.3.1 (StaticFiles UNC SSRF fixed in 1.1.0, form limit bypass DoS fixed in 1.3.1). fastapi 0.139.0 allows starlette >=0.46.0 with no upper bound, so this resolves cleanly. Compatibility changes required by click >=8.2: - Bump typer ^0.7.0 -> ^0.19.2 (typer 0.7 crashes on import-time option validation with click >=8.2; rich stays at 12.6.0). - Normalize unspecified list CLI options from None to [] in load_commands() - newer typer passes None instead of an empty tuple, which crashed the "*" membership checks and config validators. - Accept None in the prometheus_other_headers validator. - Drop the removed mix_stderr argument from CliRunner in tests (stderr is captured separately by default in click >=8.2). All 55 tests pass; krr --help / simple --help verified working. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017tvW9dxfAQAMKE8EJHQT7E
1 parent 8d9d2f3 commit 6806a1b

8 files changed

Lines changed: 144 additions & 57 deletions

File tree

‎enforcer/requirements.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
fastapi==0.139.0
22
uvicorn==0.27.1
33
pydantic==2.13.4
4-
starlette>=1.0.0
4+
starlette>=1.3.1
55
supabase==2.5
66
PyYAML==6.0.1
77
cachetools==5.3.3
88
prometheus-client==0.20.0
99
python-json-logger==3.3.0
1010
kubernetes==26.1.0
11-
pyasn1>=0.6.2
11+
pyasn1>=0.6.4
1212
urllib3==2.7.0

‎poetry.lock‎

Lines changed: 121 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ krr = "robusta_krr.main:run"
2424

2525
[tool.poetry.dependencies]
2626
python = ">=3.10,<=3.12.9"
27-
typer = { extras = ["all"], version = "^0.7.0" }
27+
# typer >=0.16 is needed for compatibility with click >=8.2 (click pinned below for CVE-2026-7246)
28+
typer = "^0.19.2"
2829
pydantic = "^1.10.7"
2930
kubernetes = "^26.1.0"
3031
prometheus-api-client = "0.5.3"
@@ -43,6 +44,8 @@ setuptools = "^83.0.0"
4344
# transitive deps pinned for CVE fixes
4445
pillow = "^12.3.0"
4546
pyasn1 = "^0.6.4"
47+
certifi = ">=2024.7.4"
48+
click = "^8.3.3"
4649
zipp = "^3.19.1"
4750
tenacity = "^9.0.0"
4851
python-json-logger = "^3.0.0"

‎requirements.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ alive-progress==3.1.5 ; python_version >= "3.10" and python_full_version < "3.13
33
boto3==1.42.19 ; python_version >= "3.10" and python_full_version < "3.13"
44
botocore==1.42.19 ; python_version >= "3.10" and python_full_version < "3.13"
55
cachetools==5.3.3 ; python_version >= "3.10" and python_full_version < "3.13"
6-
certifi==2024.2.2 ; python_version >= "3.10" and python_full_version < "3.13"
6+
certifi==2026.7.22 ; python_version >= "3.10" and python_full_version < "3.13"
77
charset-normalizer==3.3.2 ; python_version >= "3.10" and python_full_version < "3.13"
8-
click==8.1.7 ; python_version >= "3.10" and python_full_version < "3.13"
8+
click==8.5.0 ; python_version >= "3.10" and python_full_version < "3.13"
99
colorama==0.4.6 ; python_version >= "3.10" and python_full_version < "3.13"
1010
commonmark==0.9.1 ; python_version >= "3.10" and python_full_version < "3.13"
1111
contourpy==1.2.0 ; python_version >= "3.10" and python_full_version < "3.13"
@@ -47,7 +47,7 @@ shellingham==1.5.4 ; python_version >= "3.10" and python_full_version < "3.13"
4747
six==1.16.0 ; python_version >= "3.10" and python_full_version < "3.13"
4848
slack-sdk==3.27.1 ; python_version >= "3.10" and python_full_version < "3.13"
4949
tenacity==9.0.0 ; python_version >= "3.10" and python_full_version < "3.13"
50-
typer==0.7.0 ; python_version >= "3.10" and python_full_version < "3.13"
50+
typer==0.19.2 ; python_version >= "3.10" and python_full_version < "3.13"
5151
typing-extensions==4.16.0 ; python_version >= "3.10" and python_full_version < "3.13"
5252
tzdata==2024.1 ; python_version >= "3.10" and python_full_version < "3.13"
5353
tzlocal==5.2 ; python_version >= "3.10" and python_full_version < "3.13"

‎robusta_krr/core/models/config.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ def validate_prometheus_url(cls, v: Optional[str]):
119119
return v
120120

121121
@pd.validator("prometheus_other_headers", pre=True)
122-
def validate_prometheus_other_headers(cls, headers: Union[list[str], dict[str, str]]) -> dict[str, str]:
122+
def validate_prometheus_other_headers(cls, headers: Union[list[str], dict[str, str], None]) -> dict[str, str]:
123+
if headers is None:
124+
return {}
125+
123126
if isinstance(headers, dict):
124127
return headers
125128

‎robusta_krr/main.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,12 @@ def run_strategy(
353353
**strategy_args,
354354
) -> None:
355355
f"""Run KRR using the `{_strategy_name}` strategy"""
356+
# typer >= 0.12 passes None (instead of an empty tuple) for unspecified list options
357+
clusters = clusters or []
358+
namespaces = namespaces or []
359+
resources = resources or []
360+
prometheus_other_headers = prometheus_other_headers or []
361+
named_sinks = named_sinks or []
356362
if not show_severity and format != "csv":
357363
raise click.BadOptionUsage("--exclude-severity", "--exclude-severity works only with format=csv")
358364

‎tests/test_krr.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from robusta_krr.core.integrations.kubernetes import ClusterLoader
88
from robusta_krr.core.models.config import settings
99

10-
runner = CliRunner(mix_stderr=False)
10+
# click >= 8.2 removed mix_stderr; stderr is now always captured separately
11+
runner = CliRunner()
1112
load_commands()
1213

1314
STRATEGY_NAME = "simple"

‎tests/test_runner.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
from robusta_krr.main import app, load_commands
66

7-
runner = CliRunner(mix_stderr=False)
7+
# click >= 8.2 removed mix_stderr; stderr is now always captured separately
8+
runner = CliRunner()
89
load_commands()
910

1011

0 commit comments

Comments
 (0)