Skip to content

fix(money-machine): harden desktop security#61

Merged
Moeabdelaziz007 merged 3 commits into
mainfrom
devin/1778734310-stabilize-money-machine
May 14, 2026
Merged

fix(money-machine): harden desktop security#61
Moeabdelaziz007 merged 3 commits into
mainfrom
devin/1778734310-stabilize-money-machine

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 14, 2026

Summary

  • Hardened Money Machine security around the four reported issues: config secrets are stripped from config.json, IPC requests now enforce size limits and read timeouts, TradingSignal now has one canonical dataclass, and runtime config updates are whitelist/range validated.
  • Improved desktop smoothness/buildability: fixed Next/Tauri build blockers, added the Tauri CLI/Cargo lock, enabled tray support, fixed keepawake integration, restored tsconfig, and removed fake demo trades from the UI.
  • Refreshed app branding/UI and deployment hardening: new logo/icons, clearer Shadow Mode UI, Vercel config, Cloudflare Pages _headers, CSP/security headers, and dashboard domain updates to aitrading.axiomid.app.
  • Cleared production npm audit findings by overriding postcss to a patched version.

Review & Testing Checklist for Human

  • Security review the Python changes under money-machine/src-python/, especially the secret redaction, IPC limits/timeouts, and config whitelist/ranges before any live trading use.
  • Run the desktop app locally with sandbox keys only and confirm Shadow Mode remains clearly labeled before enabling any real adapter.
  • Verify Vercel/Cloudflare deployment settings apply the new security headers and that aitrading.axiomid.app remains the intended dashboard domain.
  • Confirm the refreshed logo/icons and UI are acceptable on the target desktop platforms.

Recommended end-to-end test plan: start the Python sidecar, launch npm run tauri dev, confirm the dashboard connects, test Start/Pause Shadow Trading, Ghost/Floating/Pinned controls, then send invalid/oversized IPC/config payloads and confirm they are rejected.

Notes

Local verification completed:

  • npm --prefix money-machine run lint
  • cd money-machine && npx tsc --noEmit --pretty false
  • npm --prefix money-machine run build
  • cargo +stable test --manifest-path money-machine/src-tauri/Cargo.toml
  • python -m pytest money-machine/src-python/tests/test_config_security.py money-machine/src-python/tests/test_ipc_auth.py money-machine/src-python/tests/test_strategies.py money-machine/src-python/tests/test_risk_shield.py -q → 108 passed
  • npm --prefix money-machine audit --omit=dev --json → 0 vulnerabilities

Cloudflare/Vercel check: aitrading.axiomid.app returns 200 on Vercel; oracle.axiomid.app currently returns Vercel DEPLOYMENT_NOT_FOUND 404, so the Oracle/Worker deployment still needs project-side configuration outside this PR.

Link to Devin session: https://app.devin.ai/sessions/e7508e5e3b974b8793307bda88eed3e8
Requested by: @Moeabdelaziz007


Open in Devin Review

Summary by CodeRabbit

Release Notes

  • New Features

    • Dashboard UI refresh with logo, status indicators, and metric tiles
    • Added Oracle endpoint status display
    • Shadow trading mode labels and connection state indicators
  • Security

    • Configuration validation with numeric range enforcement
    • Secret redaction when saving configuration files
    • Request size and timeout limits for system communication
    • Content Security Policy headers for dashboard
  • Chores

    • Updated dashboard domain to aitrading.axiomid.app
    • Upgraded Tauri and ESLint dependencies
    • Enhanced TypeScript type safety across codebase
    • Added automated release workflow configuration

Review Change Stack

@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

devin-ai-integration Bot commented May 14, 2026

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontend Error Error May 14, 2026 5:28am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

📝 Walkthrough

Walkthrough

The PR consolidates a major application update combining domain migration, comprehensive security hardening, API contract consolidation, and frontend redesign. URLs shift from aqt.axiomid.app to aitrading.axiomid.app across all configuration layers. Configuration security introduces secret filtering and runtime validation. IPC protocol gains bounded reads, timeouts, and size limits. Trading signals unify under a shared type with metadata-based sizing. Dashboard UI receives redesigned layouts, new CSS components, and live data bindings. Build tooling upgrades support the changes across TypeScript, Tauri, and CI/CD.

Changes

Unified Product Update

Layer / File(s) Summary
Domain and URL Migration
README.md, money-machine/package.json, money-machine/public/_headers, money-machine/src-tauri/tauri.conf.json, vercel.json
Dashboard domain switched from aqt.axiomid.app to aitrading.axiomid.app in five README sections, package homepage, public security headers, Tauri CSP, and Vercel global headers.
Configuration Security and Validation
money-machine/src-python/utils/config.py, money-machine/src-python/engine/trading_core.py, money-machine/src-python/tests/test_config_security.py
Configuration loading and saving filter secret keys recursively via _without_secrets(), deep-merge updated config via _deep_merge(), and validate runtime parameters via centralized CONFIG_LIMITS with min/max bounds. Tests verify secret redaction on persistence and load, and enforce validation constraints on config updates.
IPC Protocol Hardening
money-machine/src-python/utils/ipc_server.py, money-machine/src-python/tests/test_ipc_auth.py
IPCServer enforces max byte limits (256 for auth header, 64 KB for body) and per-read timeouts via new _read_limited_line() helper, returning protocol error codes (408 timeout, 413 oversized, 400 read failure). Tests validate oversized rejection and timeout behavior with configurable server timeout.
Signal Type Consolidation and Pipeline Contract
money-machine/src-python/engine/signal_generator.py, money-machine/src-python/engine/adapters/mt5.py, money-machine/src-python/main.py
TradingSignal imported from engine.strategies.base instead of local definition; Gemini response parsing stores amount_pct under metadata dict instead of top-level amount field. Shadow decision recording updated to read from signal["metadata"]["amount_pct"]. MT5 adapter removes validation check to preserve response venue_order_id structure.
Frontend CSS Design System and Components
money-machine/src/app/globals.css
New design token --accent-gold added. Base glass-card styles refined. New component classes: .hero-panel, .metric-tile (with typography variants), .status-pill (online/offline states), .skill-orb with gradient background.
Dashboard Page and Component Redesign
money-machine/src/app/layout.tsx, money-machine/src/app/page.tsx, money-machine/src/components/ControlPanel.tsx, money-machine/src/components/PnLWidget.tsx, money-machine/src/components/StatusWidget.tsx, money-machine/src/components/TradesTable.tsx
Dashboard header redesigned with logo image, status pills, latency card, and hero panel with metrics. ControlPanel shows "Mission Control" with connection status and shadow trading labels. PnLWidget displays "Mode: Shadow". StatusWidget adds Oracle endpoint. TradesTable uses live store data instead of demo trades with shadow-mode waiting message.
TypeScript and JSX Runtime Configuration
money-machine/tsconfig.json, money-machine/next-env.d.ts
JSX option switched to react-jsx for automatic runtime. TypeScript deprecations ignored via ignoreDeprecations: "6.0". Next.js environment types defined.
Build Tooling and Package Dependencies
money-machine/.gitignore, money-machine/eslint.config.mjs, money-machine/package.json
Tauri generated paths ignored in Git and ESLint. ESLint bumped to v9, @tauri-apps/cli to ^2.11.1. Postcss override added. Tauri npm script added.
Tauri Application Configuration and API Updates
money-machine/src-tauri/Cargo.toml, money-machine/src-tauri/tauri.conf.json, money-machine/src-tauri/src/lib.rs
Package metadata updated (version 0.1.1-alpha, description, authors, license, repository). App identifier fields promoted from nested package to top-level. Tauri dependency enables tray-icon feature. Keep-alive implementation migrated to KeepAwakeBuilder API with formatted error messages.
Deployment and Release Configuration
vercel.json, .github/release.yml, CHANGELOG.md
Vercel build configured for money-machine subdirectory with global security headers (CSP, Referrer-Policy, X-Frame-Options, Permissions-Policy) and root rewrite. GitHub release excludes dependabot releases and categorizes changelog by Security, Features, Fixes, Dependencies. CHANGELOG.md documents version 0.1.1-alpha with security updates, fixes (TradingSignal consolidation), and UI refresh.
CI/CD Workflow Updates
money-machine/.github/workflows/build.yml
Node.js upgraded to v22 with npm caching, Python to v3.12. Frontend and Tauri builds use money-machine subdirectory paths. Release creation switched to draft mode with softprops/action-gh-release@v2. Artifact paths updated with money-machine/ prefix.
TypeScript Type Safety Improvements
money-machine/src/lib/tauri.ts, money-machine/src/store/useAppStore.ts
PortfolioData.positions, executeSkill params/return, and Portfolio.positions changed from any to unknown for stricter typing.

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly Related PRs

  • Moeabdelaziz007/AlphaAxiom#38: Updates money-machine/package.json homepage field to establish the initial domain; this PR migrates that URL to aitrading.axiomid.app.
  • Moeabdelaziz007/AlphaAxiom#40: Implements shadow-mode telemetry and reporting for the trading system; this PR's signal contract changes (amount_pct moved to metadata) directly affect the shadow decision recording that PR #40 consumes.

🐰 A rabbit once built a castle tall,
With golden tokens and shadows that fall,
Security guards on the IPC gate,
Signals consolidated—no longer in wait,
The UI now glimmers, domain's been set straight! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.30% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(money-machine): harden desktop security' directly describes the main objective of the changeset: security hardening for the money-machine desktop application. It is concise, specific, and clearly summarizes the primary change.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • 🔄 Generating stacked PR...
  • Commit on current branch
🧪 Generate unit tests (beta)

✅ Unit Test PR creation complete.

  • Create PR with unit tests
  • Commit unit tests in branch devin/1778734310-stabilize-money-machine

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Note

Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 7 additional findings in Devin Review.

Open in Devin Review

entry_price: Optional[float] = None
stop_loss: Optional[float] = None
take_profit: Optional[float] = None
amount: Optional[float] = None
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Adding amount field to TradingSignal breaks SignalContract.from_trading_signal, silently disabling all pipeline trades

The PR adds amount: Optional[float] = None to TradingSignal in strategies/base.py, but SignalContract in engine/contracts.py (unchanged by this PR) lacks a corresponding amount field. SignalContract.from_trading_signal calls cls(**signal.to_dict()) (contracts.py:32), and to_dict() uses dataclasses.asdict which now includes amount in the returned dict. Since SignalContract is a @dataclass(frozen=True) without an amount field, this raises TypeError: __init__() got an unexpected keyword argument 'amount' at runtime.

This method is called on every pipeline tick via ContractValidator.signal(signal) at signal_pipeline.py:215. The exception is caught by the try/except at signal_pipeline.py:216, converting every signal into a HOLD with confidence 0.0. The net effect is that no trade will ever execute through the SignalPipeline.

Prompt for agents
The new `amount` field added to TradingSignal in engine/strategies/base.py:54 must also be added to SignalContract in engine/contracts.py. The SignalContract dataclass (contracts.py:17-28) mirrors TradingSignal's fields and its from_trading_signal classmethod (contracts.py:31-32) does cls(**signal.to_dict()), which will now include the amount key. Add `amount: Optional[float] = None` to SignalContract between take_profit and reasoning, matching the field order in TradingSignal.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

✅ Created PR with unit tests: https://github.com/Moeabdelaziz007/AlphaAxiom/pull/62

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
money-machine/src-python/engine/strategies/base.py (1)

54-71: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Validate TradingSignal.amount in the canonical model.

amount is now part of the shared signal contract, but it is not validated in __post_init__. This allows invalid sizing values to propagate (e.g., negative or oversized fractions), which can lead to unsafe order sizing downstream.

Proposed fix
 `@dataclass`
 class TradingSignal:
@@
     amount: Optional[float] = None
@@
     def __post_init__(self) -> None:
@@
         if not 0.0 <= self.confidence <= 1.0:
             raise ValueError(
                 f"confidence must be in [0.0, 1.0], got {self.confidence!r}"
             )
+        if self.amount is not None:
+            try:
+                self.amount = float(self.amount)
+            except (TypeError, ValueError):
+                raise ValueError(f"amount must be numeric or None, got {self.amount!r}")
+            if not 0.0 <= self.amount <= 0.02:
+                raise ValueError(
+                    f"amount must be in [0.0, 0.02] as portfolio fraction, got {self.amount!r}"
+                )
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/src-python/engine/strategies/base.py` around lines 54 - 71, The
TradingSignal model's amount field is not validated in __post_init__, allowing
negative or >1.0 sizing to slip through; update the __post_init__ in base.py to
validate self.amount (if not None) is a number and within [0.0, 1.0], raising
ValueError with a clear message if it isn't; keep this check alongside the
existing action and confidence validations so INVALID_ACTIONS/VALID_ACTIONS and
confidence logic remain unchanged.
money-machine/src/lib/tauri.ts (1)

39-49: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add timeout and HTTP status handling to the IPC fetch fallback.

The development fallback in sendIPCCommand lacks an AbortController timeout and HTTP status validation. This can cause indefinite hangs and opaque parse errors on non-2xx responses. The Python backend enforces a 5-second read timeout; the fetch fallback should match this hardening. Add an AbortController timeout and validate response.ok before calling response.json().

Suggested patch
 async function sendIPCCommand<T>(command: string, payload: Record<string, unknown> = {}): Promise<T> {
     if (isTauri) {
         return await invoke(command.toLowerCase(), payload);
     }
 
     // Development fallback: direct API route
+    const controller = new AbortController();
+    const timeout = setTimeout(() => controller.abort(), 10_000);
     const response = await fetch('/api/ipc', {
         method: 'POST',
         headers: { 'Content-Type': 'application/json' },
         body: JSON.stringify({ command, payload }),
+        signal: controller.signal,
+    }).finally(() => clearTimeout(timeout));
+
+    if (!response.ok) {
+        throw new Error(`IPC request failed: ${response.status} ${response.statusText}`);
+    }
 
     const data = await response.json();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/src/lib/tauri.ts` around lines 39 - 49, The development
fallback in sendIPCCommand lacks a timeout and HTTP status checks; update the
fetch branch inside sendIPCCommand to use an AbortController with a 5_000 ms
timeout (match the Python backend), attach controller.signal to fetch, and clear
the timer after fetch completes; then check response.ok and throw a descriptive
error (including status and body/text) if not ok before calling response.json()
and returning the parsed value. Ensure the AbortController is aborted on timeout
to prevent hangs and that any thrown error surfaces the HTTP status and body to
aid debugging.
🧹 Nitpick comments (4)
money-machine/src-python/utils/ipc_server.py (1)

166-167: 💤 Low value

Consider narrowing the exception catch to network-related errors.

The broad except Exception is flagged by static analysis (BLE001). While acceptable as a defensive catch-all for untrusted I/O, narrowing to (OSError, ConnectionError) would be more explicit about intent and avoid accidentally masking unrelated exceptions.

♻️ Suggested refinement
-        except Exception as exc:
-            return b"", {"error": f"Failed to read {label}: {exc}", "code": 400}
+        except (OSError, ConnectionError) as exc:
+            return b"", {"error": f"Failed to read {label}: {exc}", "code": 400}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/src-python/utils/ipc_server.py` around lines 166 - 167, The
broad except Exception in the IPC read handler should be narrowed to
network/IO-related errors to avoid masking unrelated exceptions; change the
except block that currently returns b"", {"error": f"Failed to read {label}:
{exc}", "code": 400} to except (OSError, ConnectionError) as exc and leave the
return value and error message intact so the handler still returns b"" and the
same error dict; locate this change in the IPC server read routine where label
is used (the try/except around the read/receive logic).
money-machine/src-python/utils/config.py (1)

41-46: ⚡ Quick win

Narrow exception handling for config file operations.

Catching Exception here can hide non-I/O coding defects and make failures harder to triage. Prefer handling expected config read/write errors explicitly.

🔧 Suggested tightening
-        except Exception as e:
+        except (OSError, json.JSONDecodeError, TypeError) as e:
             print(f"Warning: Could not load config file: {e}")
...
-    except Exception as e:
+    except (OSError, TypeError) as e:
         print(f"Error saving config: {e}")
         return False

Also applies to: 77-83

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/src-python/utils/config.py` around lines 41 - 46, The current
broad except Exception around opening and json.load hides unrelated bugs; narrow
it to handle expected I/O/parsing errors only by catching FileNotFoundError,
PermissionError/OSError and json.JSONDecodeError around the with
open(config_path...) / json.load call (and similarly in the other block at
77-83), log a clear warning via print/processLogger that includes the exception,
and re-raise or let other exceptions propagate instead of swallowing them; refer
to the open(config_path, 'r') context, json.load, _without_secrets and
_deep_merge to locate where to apply the specific except clauses.
money-machine/public/_headers (1)

2-2: ⚡ Quick win

Explicitly disable object/embed sources in CSP.

default-src 'self' still permits plugin/object content from same-origin. Add object-src 'none' to tighten policy.

🔐 Proposed fix
-  Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self' https://oracle.axiomid.app https://aitrading.axiomid.app; frame-ancestors 'none'; base-uri 'self'; form-action 'self'
+  Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self' https://oracle.axiomid.app https://aitrading.axiomid.app; object-src 'none'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/public/_headers` at line 2, The CSP header currently allows
same-origin plugin/object content via default-src; update the header line that
defines Content-Security-Policy to explicitly disable plugin/embed sources by
adding object-src 'none' (i.e., include the object-src 'none' directive
alongside existing directives such as script-src, style-src, img-src,
connect-src, etc.) so that object/embed content is blocked even from the same
origin.
money-machine/src/app/page.tsx (1)

20-20: ⚡ Quick win

Specify sizes on the fill logo image.

next/image with fill should include sizes; otherwise optimization can over-fetch larger image variants than needed. This container is fixed (h-16 w-16), so a fixed hint is appropriate.

♻️ Proposed fix
-              <Image src="/images/logo.png" alt="Money Machine" fill className="object-cover" priority />
+              <Image
+                src="/images/logo.png"
+                alt="Money Machine"
+                fill
+                sizes="64px"
+                className="object-cover"
+                priority
+              />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/src/app/page.tsx` at line 20, The Image element using
next/image with fill (the Image component rendering "/images/logo.png" with fill
and className "object-cover" in the page.tsx) lacks a sizes attribute, which can
cause next/image to fetch larger variants than needed; add a sizes prop that
matches the fixed container (h-16 w-16 → 64px) such as sizes="64px" (or an
equivalent responsive media-query string) to ensure the loader requests the
correct image size.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@money-machine/next-env.d.ts`:
- Line 3: Remove the brittle explicit import of "./.next/types/routes.d.ts" from
next-env.d.ts: delete the import line so the file remains framework-managed and
relies on the tsconfig.json include globs (e.g., .next/types/**/*.ts) to pick up
generated route types instead of importing them directly.

In `@money-machine/src-python/engine/trading_core.py`:
- Around line 10-14: CONFIG_LIMITS currently marks "initial_balance"
runtime-updatable but update_config() only mutates self.config and doesn't
reconcile portfolio state, causing desync between self.config["initial_balance"]
and self.portfolio.balance; remove "initial_balance" from runtime-updatable
fields in CONFIG_LIMITS (or mark it as startup-only) and ensure update_config()
does not accept or apply changes to initial_balance, leaving portfolio
initialization logic (where portfolio.balance is set) as the single source of
truth; update references to CONFIG_LIMITS and the update_config() method to
enforce this change.

In `@money-machine/src/components/StatusWidget.tsx`:
- Around line 57-60: The StatusWidget currently hardcodes the Oracle host string
in the JSX block; update StatusWidget to read the runtime-configured value
(e.g., from props, context, or a validated config util used by the app) instead
of the literal "oracle.axiomid.app" and render a safe fallback like
"unavailable" when the config is missing or invalid; locate the span showing the
host inside StatusWidget and replace the hardcoded text with the runtime value
(validate/normalize it first) so the UI reflects actual deployment
configuration.

---

Outside diff comments:
In `@money-machine/src-python/engine/strategies/base.py`:
- Around line 54-71: The TradingSignal model's amount field is not validated in
__post_init__, allowing negative or >1.0 sizing to slip through; update the
__post_init__ in base.py to validate self.amount (if not None) is a number and
within [0.0, 1.0], raising ValueError with a clear message if it isn't; keep
this check alongside the existing action and confidence validations so
INVALID_ACTIONS/VALID_ACTIONS and confidence logic remain unchanged.

In `@money-machine/src/lib/tauri.ts`:
- Around line 39-49: The development fallback in sendIPCCommand lacks a timeout
and HTTP status checks; update the fetch branch inside sendIPCCommand to use an
AbortController with a 5_000 ms timeout (match the Python backend), attach
controller.signal to fetch, and clear the timer after fetch completes; then
check response.ok and throw a descriptive error (including status and body/text)
if not ok before calling response.json() and returning the parsed value. Ensure
the AbortController is aborted on timeout to prevent hangs and that any thrown
error surfaces the HTTP status and body to aid debugging.

---

Nitpick comments:
In `@money-machine/public/_headers`:
- Line 2: The CSP header currently allows same-origin plugin/object content via
default-src; update the header line that defines Content-Security-Policy to
explicitly disable plugin/embed sources by adding object-src 'none' (i.e.,
include the object-src 'none' directive alongside existing directives such as
script-src, style-src, img-src, connect-src, etc.) so that object/embed content
is blocked even from the same origin.

In `@money-machine/src-python/utils/config.py`:
- Around line 41-46: The current broad except Exception around opening and
json.load hides unrelated bugs; narrow it to handle expected I/O/parsing errors
only by catching FileNotFoundError, PermissionError/OSError and
json.JSONDecodeError around the with open(config_path...) / json.load call (and
similarly in the other block at 77-83), log a clear warning via
print/processLogger that includes the exception, and re-raise or let other
exceptions propagate instead of swallowing them; refer to the open(config_path,
'r') context, json.load, _without_secrets and _deep_merge to locate where to
apply the specific except clauses.

In `@money-machine/src-python/utils/ipc_server.py`:
- Around line 166-167: The broad except Exception in the IPC read handler should
be narrowed to network/IO-related errors to avoid masking unrelated exceptions;
change the except block that currently returns b"", {"error": f"Failed to read
{label}: {exc}", "code": 400} to except (OSError, ConnectionError) as exc and
leave the return value and error message intact so the handler still returns b""
and the same error dict; locate this change in the IPC server read routine where
label is used (the try/except around the read/receive logic).

In `@money-machine/src/app/page.tsx`:
- Line 20: The Image element using next/image with fill (the Image component
rendering "/images/logo.png" with fill and className "object-cover" in the
page.tsx) lacks a sizes attribute, which can cause next/image to fetch larger
variants than needed; add a sizes prop that matches the fixed container (h-16
w-16 → 64px) such as sizes="64px" (or an equivalent responsive media-query
string) to ensure the loader requests the correct image size.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c9ec9ad6-f347-4926-aab8-2e0799933a63

📥 Commits

Reviewing files that changed from the base of the PR and between 3eebcaf and 6d674e6.

⛔ Files ignored due to path filters (7)
  • money-machine/package-lock.json is excluded by !**/package-lock.json
  • money-machine/public/images/logo.png is excluded by !**/*.png
  • money-machine/src-tauri/Cargo.lock is excluded by !**/*.lock
  • money-machine/src-tauri/icons/128x128.png is excluded by !**/*.png
  • money-machine/src-tauri/icons/128x128@2x.png is excluded by !**/*.png
  • money-machine/src-tauri/icons/32x32.png is excluded by !**/*.png
  • money-machine/src-tauri/icons/icon.png is excluded by !**/*.png
📒 Files selected for processing (27)
  • README.md
  • money-machine/.gitignore
  • money-machine/eslint.config.mjs
  • money-machine/next-env.d.ts
  • money-machine/package.json
  • money-machine/public/_headers
  • money-machine/src-python/engine/signal_generator.py
  • money-machine/src-python/engine/strategies/base.py
  • money-machine/src-python/engine/trading_core.py
  • money-machine/src-python/tests/test_config_security.py
  • money-machine/src-python/tests/test_ipc_auth.py
  • money-machine/src-python/utils/config.py
  • money-machine/src-python/utils/ipc_server.py
  • money-machine/src-tauri/Cargo.toml
  • money-machine/src-tauri/src/lib.rs
  • money-machine/src-tauri/tauri.conf.json
  • money-machine/src/app/globals.css
  • money-machine/src/app/layout.tsx
  • money-machine/src/app/page.tsx
  • money-machine/src/components/ControlPanel.tsx
  • money-machine/src/components/PnLWidget.tsx
  • money-machine/src/components/StatusWidget.tsx
  • money-machine/src/components/TradesTable.tsx
  • money-machine/src/lib/tauri.ts
  • money-machine/src/store/useAppStore.ts
  • money-machine/tsconfig.json
  • vercel.json

@@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether next-env.d.ts imports generated artifacts directly.
rg -n '^\s*import\s+["'\'']\./\.next/types/routes\.d\.ts["'\''];?\s*$' money-machine/next-env.d.ts

# Check if generated file exists in repo checkout (clean CI often won't have it).
test -f money-machine/.next/types/routes.d.ts; echo "routes.d.ts exists? exit=$?"

# Inspect tsconfig include entries that already cover generated types.
rg -n '"\.next/types/\*\*/\*\.ts"|"\.next/dev/types/\*\*/\*\.ts"' money-machine/tsconfig.json

Repository: Moeabdelaziz007/AlphaAxiom

Length of output: 198


Remove direct import of generated .next route types from next-env.d.ts.

The import of ./.next/types/routes.d.ts is brittle and breaks type-checking in clean environments before the .next directory is generated. This is already covered by tsconfig.json include globs (.next/types/**/*.ts), making the explicit import redundant. Remove the import and keep next-env.d.ts framework-managed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/next-env.d.ts` at line 3, Remove the brittle explicit import of
"./.next/types/routes.d.ts" from next-env.d.ts: delete the import line so the
file remains framework-managed and relies on the tsconfig.json include globs
(e.g., .next/types/**/*.ts) to pick up generated route types instead of
importing them directly.

Comment on lines +10 to +14
CONFIG_LIMITS = {
"initial_balance": (100.0, 1_000_000.0, False),
"max_risk_per_trade": (0.0, 0.1, True),
"max_daily_loss": (0.0, 0.2, True),
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Runtime initial_balance updates can desynchronize engine state.

initial_balance is whitelisted for runtime updates, but update_config() only updates self.config; it does not reconcile self.portfolio.balance / portfolio-derived state. A successful runtime update can therefore leave config and live portfolio state inconsistent.

💡 Suggested fix (disallow runtime mutation for startup-only field)
 CONFIG_LIMITS = {
-    "initial_balance": (100.0, 1_000_000.0, False),
     "max_risk_per_trade": (0.0, 0.1, True),
     "max_daily_loss": (0.0, 0.2, True),
 }

Also applies to: 188-190

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/src-python/engine/trading_core.py` around lines 10 - 14,
CONFIG_LIMITS currently marks "initial_balance" runtime-updatable but
update_config() only mutates self.config and doesn't reconcile portfolio state,
causing desync between self.config["initial_balance"] and
self.portfolio.balance; remove "initial_balance" from runtime-updatable fields
in CONFIG_LIMITS (or mark it as startup-only) and ensure update_config() does
not accept or apply changes to initial_balance, leaving portfolio initialization
logic (where portfolio.balance is set) as the single source of truth; update
references to CONFIG_LIMITS and the update_config() method to enforce this
change.

Comment on lines +57 to +60
<div className="mb-3 flex items-center justify-between rounded-xl border border-white/10 bg-white/[0.03] px-3 py-2">
<span className="text-[var(--text-muted)]">Oracle</span>
<span className="text-[var(--accent-blue)]">oracle.axiomid.app</span>
</div>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Avoid hardcoding the Oracle host in status UI.

This value can drift from runtime config/deployment state and present stale status information. Prefer sourcing it from validated runtime config (or showing “unavailable” when not configured).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/src/components/StatusWidget.tsx` around lines 57 - 60, The
StatusWidget currently hardcodes the Oracle host string in the JSX block; update
StatusWidget to read the runtime-configured value (e.g., from props, context, or
a validated config util used by the app) instead of the literal
"oracle.axiomid.app" and render a safe fallback like "unavailable" when the
config is missing or invalid; locate the span showing the host inside
StatusWidget and replace the hardcoded text with the runtime value
(validate/normalize it first) so the UI reflects actual deployment
configuration.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
money-machine/src-python/engine/signal_generator.py (1)

193-195: 💤 Low value

Consider defaulting amount_pct to 0.0 instead of potentially None.

When data.get("amount_pct") returns None, the metadata will contain {"amount_pct": None}. While main.py handles this with or 0.0, it would be more explicit to default here:

-                metadata={"amount_pct": data.get("amount_pct")},
+                metadata={"amount_pct": data.get("amount_pct", 0.0)},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/src-python/engine/signal_generator.py` around lines 193 - 195,
The metadata currently sets "amount_pct" to data.get("amount_pct") which can be
None; change it to default to 0.0 (e.g., use data.get("amount_pct", 0.0) or
coerce with float(...) if needed) so the metadata contains a numeric value
instead of None; update the metadata assignment in the Signal creation (the
block that sets reasoning=... and metadata={"amount_pct": ...}) to use the 0.0
default.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@money-machine/.github/workflows/build.yml`:
- Line 115: Replace every floating GitHub Action version tag in the workflow
with the corresponding full commit SHA and add a comment with the human-readable
version next to each use: update uses for actions/checkout@v4,
dtolnay/rust-action@stable, actions/setup-node@v4, actions/setup-python@v5,
tauri-apps/tauri-action@v0, actions/upload-artifact@v4,
actions/download-artifact@v4, and softprops/action-gh-release@v2 to their
immutable 40-character commit SHAs (and append a comment like "# v2.0.0" for
readability); ensure you change the uses strings in the workflow to the SHAs and
leave comments showing the original tag versions so Dependabot/maintainers can
track updates.

---

Nitpick comments:
In `@money-machine/src-python/engine/signal_generator.py`:
- Around line 193-195: The metadata currently sets "amount_pct" to
data.get("amount_pct") which can be None; change it to default to 0.0 (e.g., use
data.get("amount_pct", 0.0) or coerce with float(...) if needed) so the metadata
contains a numeric value instead of None; update the metadata assignment in the
Signal creation (the block that sets reasoning=... and metadata={"amount_pct":
...}) to use the 0.0 default.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e0f6bb04-0773-488f-9c7a-e6dcad1bd4ec

📥 Commits

Reviewing files that changed from the base of the PR and between 6d674e6 and 4da4bbc.

⛔ Files ignored due to path filters (2)
  • money-machine/package-lock.json is excluded by !**/package-lock.json
  • money-machine/src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • .github/release.yml
  • CHANGELOG.md
  • money-machine/.github/workflows/build.yml
  • money-machine/package.json
  • money-machine/src-python/engine/adapters/mt5.py
  • money-machine/src-python/engine/signal_generator.py
  • money-machine/src-python/main.py
  • money-machine/src-tauri/Cargo.toml
  • money-machine/src-tauri/tauri.conf.json
  • money-machine/tsconfig.json
💤 Files with no reviewable changes (1)
  • money-machine/src-python/engine/adapters/mt5.py
✅ Files skipped from review due to trivial changes (2)
  • CHANGELOG.md
  • .github/release.yml
🚧 Files skipped from review as they are similar to previous changes (4)
  • money-machine/src-tauri/Cargo.toml
  • money-machine/src-tauri/tauri.conf.json
  • money-machine/package.json
  • money-machine/tsconfig.json


- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify workflow actions that are not pinned to a full commit SHA.
# Expected: any remaining lines are candidates to pin.
rg -nP '^\s*uses:\s*[^@\s]+@[^\s]+$' -- '**/*.yml' '**/*.yaml' \
  | rg -nPv '@[0-9a-fA-F]{40}$'

Repository: Moeabdelaziz007/AlphaAxiom

Length of output: 169


🏁 Script executed:

#!/bin/bash
# Find the workflow file
find . -type f -path "*money-machine/.github/workflows/build.yml" 2>/dev/null

Repository: Moeabdelaziz007/AlphaAxiom

Length of output: 114


🏁 Script executed:

#!/bin/bash
# If file exists, show content around line 115
if [ -f "./money-machine/.github/workflows/build.yml" ]; then
  echo "=== File found. Lines 110-120 ===";
  sed -n '110,120p' "./money-machine/.github/workflows/build.yml" | cat -n;
else
  echo "File not found at expected path. Searching for build.yml files:";
  find . -type f -name "build.yml" 2>/dev/null;
fi

Repository: Moeabdelaziz007/AlphaAxiom

Length of output: 537


🏁 Script executed:

#!/bin/bash
# Search for any uses of softprops/action-gh-release in the repo
rg 'softprops/action-gh-release' -n

Repository: Moeabdelaziz007/AlphaAxiom

Length of output: 52


🏁 Script executed:

#!/bin/bash
# Show all 'uses:' lines in the build.yml file
cat -n "./money-machine/.github/workflows/build.yml" | grep 'uses:'

Repository: Moeabdelaziz007/AlphaAxiom

Length of output: 445


🌐 Web query:

GitHub Actions security best practices version pinning commit SHA

💡 Result:

GitHub Actions security best practices strongly recommend pinning actions to full-length commit SHAs to prevent supply chain attacks where malicious code could be injected via mutable tags or compromised repositories [1][2][3]. This is the only way to use actions as immutable releases, as tags can be rewritten or deleted even by trusted maintainers [1][4]. Official GitHub documentation states: "Pinning an action to a full-length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload" [1]. Example workflow change: uses: actions/checkout@v4 becomes: uses: actions/checkout@692973e # v4.1.0 [5][6] To find the SHA for a tag: - git ls-remote --tags https://github.com/owner/repo.git refs/tags/v4 [7] - Visit the repo, switch to the tag, copy the full SHA [6] - Check workflow run logs under "Setup Job" [6] Add a comment with the version for readability, e.g., # v4.1.0 [3][7]. Use Dependabot to automate updates: it creates PRs updating the SHA and version comment when new releases occur [3][8][9]. Tools like pin-github-action or ensure-sha-pinned-actions can help enforce/automate pinning [10][11][12]. Organizations can enforce SHA pinning via policies at repo/org/enterprise levels; workflows using tags will fail [2][3]. The policy checks the full dependency tree, including sub-actions [3]. Upcoming 2026 features include workflow dependencies lockfiles for transitive pinning and execution policies [13]. Additional practices: - Verify SHA is from the official repo, not a fork [1] - Prefer verified creators on Marketplace [1] - Use read-only GITHUB_TOKEN by default, escalate per-job [14] - Avoid pull_request_target for untrusted code [15] - Implement cooldowns (7-14 days) before updating [16]

Citations:


Pin all GitHub Actions to immutable commit SHAs.

All eight actions in this workflow use floating version tags (v4, v5, v0, v2, stable), which can change upstream and weaken CI/CD supply-chain guarantees. GitHub's official security guidance recommends pinning to full 40-character commit SHAs as the only way to ensure immutability. Apply this across the entire file:

  • Line 38: actions/checkout@v4
  • Line 41: dtolnay/rust-action@stable
  • Line 52: actions/setup-node@v4
  • Line 65: actions/setup-python@v5
  • Line 75: tauri-apps/tauri-action@v0
  • Line 90: actions/upload-artifact@v4
  • Line 110: actions/download-artifact@v4
  • Line 115: softprops/action-gh-release@v2

Include a comment with the version for readability (e.g., # v2.0.0). Use Dependabot to automate updates.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@money-machine/.github/workflows/build.yml` at line 115, Replace every
floating GitHub Action version tag in the workflow with the corresponding full
commit SHA and add a comment with the human-readable version next to each use:
update uses for actions/checkout@v4, dtolnay/rust-action@stable,
actions/setup-node@v4, actions/setup-python@v5, tauri-apps/tauri-action@v0,
actions/upload-artifact@v4, actions/download-artifact@v4, and
softprops/action-gh-release@v2 to their immutable 40-character commit SHAs (and
append a comment like "# v2.0.0" for readability); ensure you change the uses
strings in the workflow to the SHAs and leave comments showing the original tag
versions so Dependabot/maintainers can track updates.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Note

Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Note

Docstrings generation - SUCCESS
Generated docstrings for this pull request at https://github.com/Moeabdelaziz007/AlphaAxiom/pull/63

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Note

Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 3 file(s) based on 3 unresolved review comments.

Files modified:

  • money-machine/next-env.d.ts
  • money-machine/src-python/engine/trading_core.py
  • money-machine/src/components/StatusWidget.tsx

Commit: 76bcd3a6e037ab41942c1cb066039661365a5159

The changes have been pushed to the devin/1778734310-stabilize-money-machine branch.

Time taken: 3m 38s

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

⚠️ Branch updated during autofix.

The branch was updated while autofix was in progress. Please try again.

@Moeabdelaziz007 Moeabdelaziz007 merged commit 431edc0 into main May 14, 2026
3 of 5 checks passed
coderabbitai Bot referenced this pull request May 14, 2026
Docstrings generation was requested by @Moeabdelaziz007.

* https://github.com/Moeabdelaziz007/AlphaAxiom/pull/61#issuecomment-4447757058

The following files were modified:

* `money-machine/src-python/engine/adapters/mt5.py`
* `money-machine/src-python/engine/signal_generator.py`
* `money-machine/src-python/engine/trading_core.py`
* `money-machine/src-python/main.py`
* `money-machine/src-python/tests/test_config_security.py`
* `money-machine/src-python/tests/test_ipc_auth.py`
* `money-machine/src-python/utils/config.py`
* `money-machine/src-python/utils/ipc_server.py`
* `money-machine/src-tauri/src/lib.rs`
* `money-machine/src/app/layout.tsx`
* `money-machine/src/app/page.tsx`
* `money-machine/src/components/ControlPanel.tsx`
* `money-machine/src/components/PnLWidget.tsx`
* `money-machine/src/components/StatusWidget.tsx`
* `money-machine/src/components/TradesTable.tsx`
* `money-machine/src/lib/tauri.ts`
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

Note

Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

No files have been changed in this PR. Unable to generate unit tests.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

✅ Created PR with unit tests: https://github.com/Moeabdelaziz007/AlphaAxiom/pull/64

Moeabdelaziz007 referenced this pull request May 14, 2026
Docstrings generation was requested by @Moeabdelaziz007.

* https://github.com/Moeabdelaziz007/AlphaAxiom/pull/61#issuecomment-4447757058

The following files were modified:

* `money-machine/src-python/engine/adapters/mt5.py`
* `money-machine/src-python/engine/signal_generator.py`
* `money-machine/src-python/engine/trading_core.py`
* `money-machine/src-python/main.py`
* `money-machine/src-python/tests/test_config_security.py`
* `money-machine/src-python/tests/test_ipc_auth.py`
* `money-machine/src-python/utils/config.py`
* `money-machine/src-python/utils/ipc_server.py`
* `money-machine/src-tauri/src/lib.rs`
* `money-machine/src/app/layout.tsx`
* `money-machine/src/app/page.tsx`
* `money-machine/src/components/ControlPanel.tsx`
* `money-machine/src/components/PnLWidget.tsx`
* `money-machine/src/components/StatusWidget.tsx`
* `money-machine/src/components/TradesTable.tsx`
* `money-machine/src/lib/tauri.ts`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 14, 2026

✅ Created PR with unit tests: https://github.com/Moeabdelaziz007/AlphaAxiom/pull/65

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