Skip to content

Commit e23d7a9

Browse files
author
Neo
committed
feat: Glasswing security audit layer and Mythos model integration
1 parent 07aeb9b commit e23d7a9

18 files changed

Lines changed: 529 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ All notable changes to 0pnMatrx are documented here.
44

55
---
66

7+
## [0.2.0] — 2026-04-08
8+
9+
### Glasswing Integration
10+
11+
- Security audit layer: 12 vulnerability checks run on every contract before deployment
12+
- Reentrancy, unchecked calls, tx.origin, selfdestruct, delegatecall, unbounded loops, integer overflow, floating pragma, locked ether, access control, front-running, timestamp dependence
13+
- Audit gate on deploy: critical vulnerabilities block deployment
14+
- Audit report included in every contract conversion response
15+
- Morpheus enforces audit findings — no unsafe contracts reach the chain
16+
- Claude Mythos Preview added as model provider (Glasswing frontier model)
17+
- Security configuration in openmatrix.config.json
18+
- HiveMind security instance type for collective vulnerability reasoning
19+
- Ultron deploy planning now includes mandatory security audit step
20+
- Friday monitors security vulnerability events
21+
- Vision tracks security patterns across user activity
22+
- Omniversal protocol tracks security as an expansion domain
23+
24+
---
25+
726
## [0.1.0] — 2026-04-01
827

928
### Initial Release

ROADMAP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
## Now in progress
88

9+
- Glasswing security audit layer — static vulnerability scanning on all generated contracts
910
- Unified Rexhepi Framework — full deployment
1011
- Consumer Layer — public-facing protocol
1112
- Local LLM support expansion

agents/morpheus/identity.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ Morpheus interventions are triggered automatically by the protocol stack during
3333

3434
The system tracks which capability categories the user has already been introduced to, ensuring first-use explanations happen exactly once per category and never repeat.
3535

36+
## Security Audit Role
37+
38+
Morpheus enforces the Glasswing security audit layer. Every smart contract generated or deployed through 0pnMatrx is scanned for vulnerabilities before it touches the chain.
39+
40+
The audit runs automatically at two points:
41+
1. **After conversion** — when the contract conversion pipeline generates Solidity, the auditor scans it and includes findings in the response.
42+
2. **Before deployment** — when any contract is submitted for deployment, the auditor gates the transaction. Critical vulnerabilities block deployment entirely.
43+
44+
Morpheus surfaces audit findings to the user in plain language: what the vulnerability is, why it matters, and what needs to change.
45+
46+
Morpheus does not deploy unsafe contracts. If the audit fails, Morpheus explains what was found and waits for the user to fix the code. This is non-negotiable.
47+
48+
The audit layer covers: reentrancy (SWC-107), unchecked calls (SWC-104), tx.origin authorization (SWC-115), unprotected selfdestruct (SWC-106), delegatecall risks (SWC-112), unbounded loops, integer overflow (SWC-101), floating pragma (SWC-103), locked ether (SWC-105), missing access control, front-running, and timestamp dependence (SWC-116).
49+
3650
## Security Role
3751

3852
Morpheus is the platform's first and final line of response when the access protection protocol is triggered. The implementation is part of the closed-source security layer.

openmatrix.config.json.example

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
"api_key": "YOUR_ANTHROPIC_API_KEY",
2323
"model": "claude-sonnet-4-6"
2424
},
25+
"mythos": {
26+
"api_key": "YOUR_ANTHROPIC_API_KEY",
27+
"model": "claude-mythos-preview"
28+
},
2529
"nvidia": {
2630
"api_key": "YOUR_NVIDIA_API_KEY",
2731
"model": "meta/llama-3.3-70b-instruct"
@@ -59,7 +63,9 @@
5963
"eas_schema": "YOUR_EAS_SCHEMA_UID",
6064
"paymaster_address": "YOUR_PAYMASTER_ADDRESS",
6165
"paymaster_private_key": "YOUR_PAYMASTER_PRIVATE_KEY",
62-
"platform_wallet": "YOUR_PLATFORM_WALLET_ADDRESS"
66+
"platform_wallet": "YOUR_PLATFORM_WALLET_ADDRESS",
67+
"demo_wallet_private_key": "YOUR_DEMO_WALLET_PRIVATE_KEY",
68+
"demo_wallet_address": "YOUR_DEMO_WALLET_ADDRESS"
6369
},
6470
"notifications": {
6571
"telegram": {
@@ -252,5 +258,11 @@
252258
"contract_address": "YOUR_X402_PAYMENTS_CONTRACT_ADDRESS",
253259
"supported_tokens": ["USDC", "ETH"]
254260
}
261+
},
262+
"security": {
263+
"audit_on_conversion": true,
264+
"audit_on_deploy": true,
265+
"block_on_critical": true,
266+
"block_on_high": false
255267
}
256268
}

runtime/blockchain/services/contract_conversion/service.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from runtime.blockchain.services.contract_conversion.revenue_enforcer import RevenueEnforcer
1919
from runtime.blockchain.services.contract_conversion.templates import get_template, list_templates
2020
from runtime.blockchain.services.contract_conversion.tier_manager import TierManager
21+
from runtime.security.audit import ContractAuditor
2122

2223
logger = logging.getLogger(__name__)
2324

@@ -50,6 +51,7 @@ def __init__(self, config: dict) -> None:
5051
self._tier_manager = TierManager(config)
5152
self._artist_classifier = ArtistClassifier(config)
5253
self._revenue_enforcer = RevenueEnforcer(config)
54+
self._auditor = ContractAuditor(config)
5355

5456
logger.info("ContractConversionService initialised.")
5557

@@ -134,6 +136,9 @@ async def convert(
134136
"Fee injection skipped: %s", exc,
135137
)
136138

139+
# 6. Security audit
140+
audit_report = self._auditor.audit(generated, ir.get("contract_name", ""))
141+
137142
elapsed_ms = round((time.monotonic() - start) * 1000, 2)
138143

139144
result: dict[str, Any] = {
@@ -143,6 +148,8 @@ async def convert(
143148
"target_chain": target_chain,
144149
"tier": tier_info,
145150
"artist_info": artist_info,
151+
"audit": audit_report.to_dict(),
152+
"audit_passed": audit_report.passed,
146153
"ir": {
147154
"functions": len(ir.get("functions", [])),
148155
"state_variables": len(ir.get("state_variables", [])),
@@ -156,9 +163,9 @@ async def convert(
156163
}
157164

158165
logger.info(
159-
"Conversion complete: contract=%s tier=%s chain=%s time=%.1fms",
166+
"Conversion complete: contract=%s tier=%s chain=%s time=%.1fms audit=%s",
160167
ir.get("contract_name"), tier_info["tier"],
161-
target_chain, elapsed_ms,
168+
target_chain, elapsed_ms, "PASS" if audit_report.passed else "FAIL",
162169
)
163170
return result
164171

runtime/blockchain/smart_contracts.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from typing import Any
1212

1313
from runtime.blockchain.interface import BlockchainInterface
14+
from runtime.security.audit import ContractAuditor
1415

1516
logger = logging.getLogger(__name__)
1617

@@ -100,6 +101,17 @@ async def _deploy(self, params: dict) -> str:
100101
abi = contract_data["abi"]
101102
bytecode = contract_data["bin"]
102103

104+
# Security audit gate
105+
auditor = ContractAuditor(self.config)
106+
audit_report = auditor.audit(source, contract_id.split(":")[-1])
107+
if auditor.should_block(audit_report):
108+
return json.dumps({
109+
"status": "blocked",
110+
"reason": "Security audit failed — critical vulnerability detected",
111+
"audit": audit_report.to_dict(),
112+
"message": "Morpheus has blocked this deployment. Fix the contract before deploying.",
113+
}, indent=2)
114+
103115
bc = self.config["blockchain"]
104116
account = Account.from_key(bc["paymaster_private_key"])
105117
contract = self.web3.eth.contract(abi=abi, bytecode=bytecode)

runtime/models/mythos_client.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
"""
2+
Claude Mythos Preview — Glasswing cybersecurity-focused frontier model.
3+
4+
Uses the Anthropic API but targets Claude Mythos Preview specifically.
5+
Glasswing models are optimised for vulnerability detection, code security
6+
analysis, and exploit identification.
7+
8+
Access: Claude API, Amazon Bedrock, Google Vertex AI, Microsoft Foundry.
9+
"""
10+
11+
from __future__ import annotations
12+
13+
import logging
14+
15+
from runtime.models.anthropic_client import AnthropicClient
16+
17+
logger = logging.getLogger(__name__)
18+
19+
DEFAULT_MYTHOS_MODEL = "claude-mythos-preview"
20+
21+
22+
class MythosClient(AnthropicClient):
23+
"""Anthropic Mythos model provider — security-optimised frontier model.
24+
25+
Inherits all Anthropic API logic. Overrides the model name to target
26+
Claude Mythos Preview for security-critical operations.
27+
"""
28+
29+
def __init__(self, config: dict) -> None:
30+
config = dict(config)
31+
config.setdefault("model", DEFAULT_MYTHOS_MODEL)
32+
super().__init__(config)
33+
logger.info("Mythos client initialised: model=%s", self.model)

runtime/models/router.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
logger = logging.getLogger(__name__)
1515

16-
PROVIDER_ORDER = ["ollama", "openai", "anthropic", "nvidia", "gemini"]
16+
PROVIDER_ORDER = ["ollama", "openai", "anthropic", "mythos", "nvidia", "gemini"]
1717
MAX_RETRIES = 3
1818

1919

@@ -71,6 +71,13 @@ def _create_provider(self, name: str, config: dict) -> ModelInterface | None:
7171
return None
7272
from runtime.models.anthropic_client import AnthropicClient
7373
return AnthropicClient(config)
74+
elif name == "mythos":
75+
api_key = config.get("api_key") or __import__("os").environ.get("ANTHROPIC_API_KEY", "")
76+
if not api_key or api_key.startswith("YOUR_"):
77+
logger.debug("Mythos: no valid API key, skipping")
78+
return None
79+
from runtime.models.mythos_client import MythosClient
80+
return MythosClient(config)
7481
elif name == "nvidia":
7582
api_key = config.get("api_key") or __import__("os").environ.get("NVIDIA_API_KEY", "")
7683
if not api_key or api_key.startswith("YOUR_"):

runtime/protocols/friday.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"insurance_trigger",
1717
"loan_health",
1818
"staking_rewards",
19+
"security_vulnerability",
1920
)
2021

2122
# Notification urgency thresholds (seconds until deadline)

runtime/protocols/hivemind.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
INSTANCE_TYPES: list[str] = [
1414
"geopolitical", "financial", "technical",
1515
"governance", "creative", "synthesis",
16+
"security",
1617
]
1718

1819

0 commit comments

Comments
 (0)