Skip to content

Add Markov transition builder using mchmm#4

Closed
DevOpsMadDog wants to merge 1 commit into
mainfrom
codex/add-markov-library-and-refactor-transition-matrix
Closed

Add Markov transition builder using mchmm#4
DevOpsMadDog wants to merge 1 commit into
mainfrom
codex/add-markov-library-and-refactor-transition-matrix

Conversation

@DevOpsMadDog
Copy link
Copy Markdown
Owner

Summary

  • declare the mchmm dependency so the project can build real Markov chains
  • implement a Markov transition builder that derives state sequences from vulnerability timelines, EPSS, and KEV data and exposes probabilities
  • add focused unit tests that validate the generated transition matrix for representative timelines

Testing

  • pytest tests/test_markov_builder.py

https://chatgpt.com/codex/tasks/task_e_68de768da6348329983a0b78d11b1d03

DevOpsMadDog added a commit that referenced this pull request Oct 18, 2025
- Create RateLimitMiddleware with configurable limits per IP address
- Track requests using sliding window algorithm with in-memory storage
- Add automatic cleanup of stale request trackers
- Support X-Forwarded-For header for proxied requests
- Return HTTP 429 with Retry-After header when limit exceeded
- Add rate limit headers to all responses (X-RateLimit-*)
- Configurable via environment variables:
  - FIXOPS_RATE_LIMIT_ENABLED (default: true)
  - FIXOPS_RATE_LIMIT_REQUESTS (default: 100)
  - FIXOPS_RATE_LIMIT_WINDOW_SECONDS (default: 60)
- Protects all API endpoints including authentication flows

Resolves: Medium severity issue #4 - No rate limiting on authentication
devin-ai-integration Bot added a commit that referenced this pull request Nov 1, 2025
IaC Issue #1 (HIGH): Backend state configuration
- Location: deployment-packs/aws/terraform/main.tf:19-25
- Added documentation for backend configuration with example
- Impact: Clearer state management and initialization process

IaC Issue #2 (MEDIUM): Hardcoded image tags
- Location: deployment-packs/aws/terraform/main.tf:99-103, 300
- Added backend_image_tag variable with semantic versioning
- Changed from 'latest' to parameterized tag
- Impact: Version control for deployments, predictable rollbacks

IaC Issue #3 (HIGH): Secrets management
- Location: docker-compose.enterprise.yml:25-29
- Added documentation for secure secret management
- Recommends Docker secrets or external secret management
- Impact: Better security guidance for production deployments

IaC Issue #4 (HIGH): Backup strategy
- Location: deployment-packs/aws/terraform/main.tf:275-301
- Added AWS Backup vault and plan resources
- Daily backups with configurable retention (default 30 days)
- Impact: Data protection and disaster recovery capability

IaC Issue #5 (MEDIUM): Resource limits
- Location: docker-compose.enterprise.yml:30-37
- Added CPU and memory limits/reservations
- Limits: 2 CPUs, 4GB RAM; Reservations: 0.5 CPUs, 1GB RAM
- Impact: Protection against resource exhaustion

IaC Issue #6 (MEDIUM): Network policies
- Location: deployment-packs/aws/terraform/main.tf:238-296
- Added Kubernetes NetworkPolicy for backend pods
- Restricts ingress/egress to necessary ports only
- Impact: Network segmentation and zero-trust compliance

IaC Issue #7 (MEDIUM): Lambda error handling
- Location: telemetry_bridge/aws_lambda/terraform/main.tf:58-120
- Added SQS dead-letter queue for failed events
- Added CloudWatch alarm for error monitoring
- Added IAM policy for DLQ access
- Impact: No lost telemetry data, visibility into failures

IaC Issue #8 (MEDIUM): Cost controls
- Location: deployment-packs/aws/terraform/main.tf:620-653
- Added AWS Budget resource with configurable threshold
- Alerts at 80% and 100% of budget
- Cost allocation tags for tracking
- Impact: Spending visibility and cost management

IaC Issue #9 (LOW): Health check
- Location: docker-compose.enterprise.yml:38-43
- Added healthcheck with curl to /api/v1/health endpoint
- 30s interval, 10s timeout, 3 retries, 40s start period
- Impact: Docker knows service health status

IaC Issue #10 (LOW): Variable documentation
- Location: deployment-packs/aws/terraform/main.tf:111-139
- Added comprehensive descriptions for all new variables
- Documents backup, network policies, and cost control settings
- Impact: Better developer experience and clarity

All 10 IaC issues from comprehensive audit now resolved.
Combined with Bug #2 and Bug #3 fixes, all 12 issues are now fixed.

Co-Authored-By: shiva kumaar <info@devopsai.co>
devin-ai-integration Bot added a commit that referenced this pull request Nov 3, 2025
BUG #1 (HIGH): API /pipeline/run now returns highest_severity and guardrail_status
- Extract these fields from orchestrator result's severity_overview and guardrail_evaluation
- Ensures API parity with CLI pipeline output

BUG #2 (MEDIUM): CVE feed validation now returns HTTP 422 for validation errors
- Previously returned HTTP 200 with validation_errors array (confusing UX)
- Now returns HTTP 422 with clear error message and hints
- Prevents accepting malformed CVE data silently

BUG #3 (MEDIUM): Design CSV ingestion now validates required columns
- Requires: component, subcomponent, owner, data_class, description, control_scope
- Returns HTTP 422 with missing columns list if validation fails
- Prevents downstream module failures from incomplete design data

BUG #4 (LOW): SBOM ingestion now validates bomFormat field
- Requires bomFormat field (CycloneDX or SPDX)
- Returns HTTP 422 if missing or unsupported format
- Prevents accepting invalid SBOMs that violate spec

Co-Authored-By: shiva kumaar <info@devopsai.co>
DevOpsMadDog added a commit that referenced this pull request Apr 12, 2026
Error handling audit (Priority #4):
- Created suite-core/core/exceptions.py with 15-class hierarchy (ALdeciError base)
- Replaced bare except Exception with specific types across 6 core files
- Covers: DatabaseError, ScannerError, ConnectorError, PipelineError,
  TrustGraphError, LLMProviderError, AuthorizationError, ValidationError,
  SSRFError, InjectionError, RateLimitError, EvidenceError

OpenAPI spec generation (Priority #5):
- Updated FastAPI metadata: title, version 2.5.0, 18 domain tags
- Enabled /docs, /redoc, /api/v1/openapi.json endpoints
- Added scripts/export_openapi.py for spec export
- Added 14 tests in test_openapi_spec.py

672 Beast Mode tests passing, zero regressions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request Apr 27, 2026
…(degree 3320)

Wire LaunchDarklyProvider._emit_event into A/B-test variant assignments
(only). bool/string/number/json flag eval paths intentionally NOT wired —
feature-flag reads happen on every request and would flood the bus;
variant assignments are the high-signal lifecycle event worth tracking.

Also emits on close() so we can correlate provider lifecycle in the
bus stream. Hub #4 by total degree in SECOND_BRAIN_REPORT.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request Apr 28, 2026
… synthesis (closes must-fix #4)

- Add suite-core/connectors/aws_ebs_snapshot_connector.py: real boto3 EBS direct API
  (list_snapshot_blocks + get_snapshot_block), cross-account STS role assumption,
  graceful needs_credentials path when no AWS creds present.
- Add suite-core/connectors/azure_disk_snapshot_connector.py: real azure-mgmt-compute
  SnapshotsOperations.list() + begin_grant_access SAS download, graceful needs_credentials
  path when no Azure creds present.
- Remove b"PK\x03\x04log4j-core-2.14.1-fake-bytes" literal from agentless_snapshot_scan_engine.py.
- Remove TODO(real-adapter) comment — real adapters now wired.
- Add _NoCredentialsAdapter: structured warning + empty list instead of synthetic data.
- Add _build_default_adapter(): auto-selects AWS -> Azure -> _NoCredentialsAdapter at runtime.
- Engine constructor now calls _build_default_adapter() instead of MockAWSAdapter().
- MockAWSAdapter retained for explicit test use; fake binary blob replaced with dpkg/status metadata.
- Add tests/test_agentless_snapshot_real.py: 8 tests (empty list no-op, 3-snapshot AWS,
  2-disk Azure, missing AWS creds, missing Azure creds, both creds, live bytes, no-fake-bytes).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request Apr 29, 2026
… synthesis (closes must-fix #4)

- Add suite-core/connectors/aws_ebs_snapshot_connector.py: real boto3 EBS direct API
  (list_snapshot_blocks + get_snapshot_block), cross-account STS role assumption,
  graceful needs_credentials path when no AWS creds present.
- Add suite-core/connectors/azure_disk_snapshot_connector.py: real azure-mgmt-compute
  SnapshotsOperations.list() + begin_grant_access SAS download, graceful needs_credentials
  path when no Azure creds present.
- Remove b"PK\x03\x04log4j-core-2.14.1-fake-bytes" literal from agentless_snapshot_scan_engine.py.
- Remove TODO(real-adapter) comment — real adapters now wired.
- Add _NoCredentialsAdapter: structured warning + empty list instead of synthetic data.
- Add _build_default_adapter(): auto-selects AWS -> Azure -> _NoCredentialsAdapter at runtime.
- Engine constructor now calls _build_default_adapter() instead of MockAWSAdapter().
- MockAWSAdapter retained for explicit test use; fake binary blob replaced with dpkg/status metadata.
- Add tests/test_agentless_snapshot_real.py: 8 tests (empty list no-op, 3-snapshot AWS,
  2-disk Azure, missing AWS creds, missing Azure creds, both creds, live bytes, no-fake-bytes).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request May 1, 2026
…s — close empty endpoint

Empty-endpoint #4 from docs/empty_endpoints_triage_2026-04-26.md fixed end-to-end.

When the org has not recorded its own vectors, list_vectors() now falls back
to the imported MITRE ATT&CK technique catalog (data/mitre_attack.db, 835
real techniques today) and projects each top-level technique as a derived
vector. No mock data anywhere — empty source returns structured empty with
import hint per Wave-1 Gap-1 contract.

Mapping (deterministic, MITRE-tactic-driven, no fakes):
- vector_type ← MITRE primary tactic
  initial-access/execution/persistence/etc -> network
  credential-access -> credential_stuffing
  collection -> insider
  reconnaissance -> social_engineering
  resource-development -> supply_chain
- severity ← MITRE tactic position in kill-chain
  impact / exfiltration -> critical
  command-and-control / credential-access / privesc / lateral / execution / initial-access -> high
  persistence / defense-evasion / collection -> medium
  discovery / reconnaissance / resource-development -> low
- impact_score / risk_score: deterministic per severity tier
- description: passed through (truncated 500 chars)
- platforms, technique_id, tactic preserved as source_* fields

Subtechniques are excluded (only top-level techniques surface as vectors).
Filters (vector_type, severity) apply against derived rows too.

Files touched:
- suite-core/core/threat_vector_analysis_engine.py (added list_vectors_with_mitre_fallback, ~140 LOC)
- suite-api/apps/api/threat_vector_analysis_router.py (wired GET /vectors to fallback)
- tests/test_threat_vectors_real_data.py (new — 4 tests)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request May 1, 2026
…r S2-finance

Phase 3 UX consolidation: folds 5 standalone executive finance/cost-tracking
pages into a single tabbed hero at /mission-control/finance per
docs/UX_CONSOLIDATION_PLAN_2026-04-26.md §2.2 (S2 Executive Brief sub-cluster).

New unified page:
  suite-ui/aldeci-ui-new/src/pages/FinanceHub.tsx  (route: /mission-control/finance)

Source pages folded (preserved with FOLDED comments for git history):
  - BUDollarRiskHeatmap          -> tab=bu-heatmap     (/bu-dollar-heatmap)
  - SecurityInvestmentDashboard  -> tab=investment     (/security-investment) [was orphan import]
  - SecurityBudgetDashboard      -> tab=budget         (/security-budget)
  - IncidentCostsDashboard       -> tab=incident-costs (/incident-costs)
  - CyberInsuranceDashboard      -> tab=cyber-insur    (/cyber-insurance)

All 5 legacy routes now <Navigate replace /> to the hub with the proper
?tab= deep-link. SecurityInvestmentDashboard had no route prior to this
commit (orphan lazy import) — now reachable via the hub tab.

Persona target: CISO (#1), CFO (#4) — small blast radius, ≤2 personas.

Verification (Playwright, headless, http://localhost:5173/mission-control/finance):
  - HTTP 200, heading "Finance & Investment" rendered
  - All 5 tabs mount their lazy-imported source page successfully
  - 15 real /api/v1/... requests fired across 5 unique endpoint families:
      * /api/v1/risk/{heatmap,brs/bu}
      * /api/v1/security-investment/{investments,budget,outcomes}
      * /api/v1/security-budget/{stats,allocations,transactions}
      * /api/v1/incident-costs/{costs,stats}
      * /api/v1/cyber-insurance/{policies,claims,assessments,stats}
  - NO MOCKS rule satisfied: every page hits its real backend; existing
    MOCK_* constants in 3 source pages are fallback-only (liveData ?? MOCK_X).
  - Screenshot: docs/ui-snapshots/ux-consolidation-finance-2026-05-02.png

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request May 2, 2026
Per silenced-imports triage docs/silenced_imports_triage_2026-05-03.md (9/9 RESOLVED):

FIX-IMPORT (#1) — pipeline_routes.py
  - `suite_core.core.X` → `core.X` (3 occurrences: L34, L38, L192)
    `suite_core` is the directory name, not a Python package; sitecustomize
    injects `suite-core/` so `core.*` is the canonical resolution.
  - Pydantic v2 hygiene: `regex=` → `pattern=` (2x), `min_items/max_items`
    → `min_length/max_length` (1x). These were silently shadowed by the
    outer `try/except ImportError`.
  - `RBACManager` aliased to canonical `RBACEngine` from `core.rbac`
    (the `RBACManager` symbol the module expected lives only at
    `core.enterprise.security:239`; canonical local class is `RBACEngine`).
  RESTORES 10 `/api/v1/pipeline/*` routes (CTEM Pipeline orchestrator).

FIX-IMPORT/SYMBOL (#2) — connectors/connector_bridge.py
  - `DependabotConnector` was being pulled from `core.connectors` (where it
    no longer exists). Canonical home is `core.security_connectors:254`.
    Moved the import. ConnectorScheduler boots cleanly again.

FIX-IMPORT/SYMBOL (#3) — apps/api/compliance_seed_router.py
  - `get_org_id` was being pulled from `apps.api.auth_deps` (no longer
    exported). Canonical home is `apps.api.org_middleware:187`. Split the
    import: `api_key_auth` stays from auth_deps, `get_org_id` now from
    org_middleware.
  RESTORES 6 `/api/v1/compliance-seed/*` routes.

DELETE (#4-#9) — apps/api/app.py
  Removed 6 dead-router try blocks (lines 7643-7682). The .py files for
  endpoint_forensics_router, security_log_analysis_router,
  incident_impact_assessment_router, vulnerability_disclosure_router,
  threat_contextualization_router, and security_operations_automation_router
  do not exist on disk — silently swallowed ModuleNotFoundError contributed
  zero behavior. Mirrors websocket_routes.py removal in 6307d7f.

Verified:
  - cold-start `apps.api.app:create_app()` succeeds; 9001 routes mounted
  - `/api/v1/pipeline/*` routes: 10 (was 0 — CTEM Pipeline silently dead)
  - `/api/v1/compliance-seed/*` routes: 6 (was 0)
  - "unavailable" warnings reduced to 2 distinct (LaunchDarkly SDK +
    feature_flag_router, both already documented as healthy-noise)
  - regression Beast Mode: 753 PASS / 0 FAIL
    - test_phase4_integration + test_phase6_streaming + test_pipeline_api
      + test_trustgraph: 157 PASS
    - test_phase{2,3,5,7,8,9,10} + test_connector_framework
      + test_persona_workflows: 596 PASS

Out-of-scope follow-up (logged in triage doc):
  - sub_apps/ctem_app.py:946-1075 contains 6 duplicate try blocks for the
    same 6 dead routers (#4-#9); same dispose-by-delete pattern would
    clean them up. Track separately to keep this commit focused on app.py
    per triage scope.

Triage doc updated: 9/9 RESOLVED with per-row dispositions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request May 4, 2026
…token + ghsa path traversal + health FS leak + nuclei auth (5 fixes)

- Fix #1 (CRITICAL): phishtank_router.py — add api_key_auth dependency to all 3 endpoints (POST /import, GET /phishes, GET /check)
- Fix #2 (HIGH): health.py /metrics — add _scrape_auth dependency requiring X-Prometheus-Token header; bypassed when FIXOPS_DISABLE_RATE_LIMIT=1
- Fix #3 (HIGH): ghsa/importer.py run_import() — validate local_path resolves under data/ or /tmp allowlisted roots; raises ValueError on traversal
- Fix #4 (HIGH): health.py — strip FS paths from unauthenticated responses: base_directory (ready), database.path (deep), disk_space.path (deep), scanners.engines dict (deep), feeds_db.tables list (comprehensive)
- Fix #5 (MEDIUM): nuclei_router.py — add api_key_auth dependency to GET / and GET /templates
- Tests: tests/test_security_review_fixes.py — 16 tests, module-scoped client, 16/16 pass; full suite 99/99 pass

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request May 4, 2026
…ens)

- hotfix #1: thread-local connection cache in _connect() — eliminates
  repeated sqlite3.connect() calls within the same OS thread
- hotfix #2: WAL mode + cache_size=-4096 + synchronous=NORMAL on init —
  reduces fsync latency for every write
- hotfix #3: complete_step/skip_step now reuse the cached conn for both
  the SELECT and the UPDATE+INSERT, cutting DB opens from 2→1 per call
- hotfix #4: get_checklist batches all step_configs in one SELECT instead
  of N separate _connect() calls (was O(N) opens, now O(1))

5 new perf assertions in tests/test_onboarding_perf.py; 28/28 pass,
zero regressions in test_phase4_integration.py.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request May 4, 2026
Suite 1 Beast Mode canonical (13 files): 753 passed in 8.45s
Suite 2 Perf benchmarks (26 files): 194 passed in 26.35s
Suite 3 QA/lockdown (10 files): 1430 passed in 30.28s
Total: 2377 passed, 0 failed, 0 errors, 0 skipped

Delta vs sweep #3: 0 regressions. +2 perf files (onboarding, misc).
Commits validated: 1938f82 84bff5c 82dc367

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
DevOpsMadDog added a commit that referenced this pull request May 4, 2026
Suite 1 (Beast Mode 13 files): 753 passed, 0 failed
Suite 2 (perf 24 files): 180 passed, 1 FAILED
Suite 3 (owasp lockdown): 47 passed, 0 failed
Total: 980 passed, 1 failed

REGRESSION: test_brain_pipeline_perf::test_full_pipeline_100_findings_under_500ms
Root cause: asyncio.run() raises in _correlate_and_emit when MiniLM model
load (~10s) causes runner.close() to fail on default executor shutdown.
brain_pipeline.py:2333. DO NOT FIX in this sweep — report only.

Note: phase11-20 lockdown files no longer on disk; perf file names
changed since sweep #4 — counts reflect current on-disk reality.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant