ARES - authorized red-team engagement automation with dashboard, campaign scope, module orchestration, OPSEC controls, encrypted vault, and reporting.
Python active-directorycloud-securitydefensive-validationfastapigood-first-issuemitre-attackopsecreactred-teamreportingsecurity
fix(ci): prevent test process rlimit mutation causing MemoryError and add CI job timeouts
Mafifrizi3eb80f805d86
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 10c3c25..ae8224e 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -19,6 +19,7 @@ jobs:backend:name: Backend Unit Testsruns-on: ubuntu-latest+ timeout-minutes: 25steps:- uses: actions/checkout@v4- uses: actions/setup-python@v5@@ -33,6 +34,7 @@ jobs:postgres:name: PostgreSQL Integration Testsruns-on: ubuntu-latest+ timeout-minutes: 40services:postgres:image: postgres:16@@ -69,6 +71,7 @@ jobs:frontend:name: Frontend Buildruns-on: ubuntu-latest+ timeout-minutes: 10steps:- uses: actions/checkout@v4- uses: actions/setup-node@v4diff --git a/tests/conftest.py b/tests/conftest.pyindex 7d97fb4..3219dd0 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -58,6 +58,19 @@ def set_test_env():# ── Temporary directories ─────────────────────────────────────────────────────[email protected](autouse=True)+def protect_runner_rlimits(monkeypatch: pytest.MonkeyPatch):+ """Ensure in-process unit tests on Linux never mutate pytest runner's own OS rlimits."""+ if sys.platform != "win32":+ try:+ import ares.core.sandbox+ if getattr(ares.core.sandbox, "resource", None) is not None:+ mock_resource = MagicMock()+ monkeypatch.setattr("ares.core.sandbox.resource", mock_resource)+ except (ImportError, AttributeError):+ pass++@pytest.fixture(autouse=True)def forbid_unmocked_pdf_browser_launch(monkeypatch: pytest.MonkeyPatch):"""Unit tests must mock PDF browser execution instead of launching Chrome/Edge."""diff --git a/tests/unit/test_hardening.py b/tests/unit/test_hardening.pyindex 96316d7..0d8bea5 100644--- a/tests/unit/test_hardening.py+++ b/tests/unit/test_hardening.py@@ -2617,6 +2617,9 @@ class TestStrictModeIntegrityAndTierTruthfulness:monkeypatch.setattr("os.setuid", mock_setuid, raising=False)monkeypatch.setattr("os.geteuid", lambda: current_id[0], raising=False)monkeypatch.setattr("os.getuid", lambda: current_id[0], raising=False)+ # Mock sandbox.resource to prevent rlimit mutation in simulated child execution+ mock_resource = MagicMock()+ monkeypatch.setattr("ares.core.sandbox.resource", mock_resource)# Mock pwd account where UID 1001 != primary GID 2002fake_pw = MagicMock()