feat: implement security enhancements — #453, #461, #462, #465 - #477
Merged
ExcelDsigN-tech merged 1 commit intoAug 25, 2026
Conversation
, ExcelDsigN-tech#462, ExcelDsigN-tech#465 - ExcelDsigN-tech#453: Add check_invariant() and check_invariants() view functions to agent_vault contract with InvariantChecked events for indexer verification. Add CONTRACTS.md documenting the core solvency invariant. - ExcelDsigN-tech#462: Add POST /api/simulation/transaction endpoint for pre-execution validation with dry-run, gas estimation, failure prediction, and 30-second caching. Includes Soroban simulation integration. - ExcelDsigN-tech#461: Add GDPR/CCPA compliance with DSAR endpoints (access, deletion, anonymization), selective PII deletion preserving financial records, anonymization pipeline, DPA template, and dsar_requests migration. - ExcelDsigN-tech#465: Enhance SECURITY.md with pentest program, bug bounty program, safe harbor provisions. Add OWASP ZAP DAST CI workflow, bug bounty documentation, and quarterly red team exercise schedule.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@Smartdevs17 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
| @@ -0,0 +1,278 @@ | |||
| import crypto from 'node:crypto'; | |||
| import { pool } from '../db/connection.js'; | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements four security-related issues in a single changeset.
Closes
Changes
#453: Enforce Core Float Invariant On-Chain
contracts/agent_vault/src/lib.rs — Added two new view functions:
check_invariant(agent)— Returns(holds, float, max_allowed)for a single agent. Emits anInvariantCheckedevent for indexer consumption.check_invariants(agents)— Batch invariant check across multiple agents.contracts/agent_vault/src/events.rs — Added
invariant_checkedevent publisher.contracts/agent_vault/src/test.rs — Added 4 unit tests for invariant checks (solvent vault, empty vault, boundary, batch).
CONTRACTS.md — New document describing the core solvency invariant, enforcement points, and governance.
#461: Data Privacy & Right-to-be-Forgotten (GDPR/CCPA)
backend/src/services/privacyService.ts — Privacy service with:
backend/src/controllers/privacyController.ts — DSAR endpoint handlers.
backend/src/routes/privacyRoutes.ts — RESTful privacy routes:
POST /api/v1/privacy/dsar/access— Request data copy (GDPR Art. 15)POST /api/v1/privacy/dsar/delete— Request deletion (GDPR Art. 17)POST /api/v1/privacy/anonymize— Anonymize for analyticsGET /api/v1/privacy/export/:publicKey— Export all dataGET /api/v1/privacy/dsar/:dsarId— Check DSAR statusGET /api/v1/privacy/dsar/pending— Admin: list pending DSARsbackend/src/schemas/privacySchemas.ts — Zod validation schemas.
backend/migrations/1803000000000_create-dsar-requests.js — Database migration for DSAR tracking table.
docs/DPA_TEMPLATE.md — Data Processing Agreement template for agent onboarding.
#462: Transaction Simulation & Pre-Execution Validation
backend/src/services/transactionSimulationService.ts — Soroban simulation service with:
simulateTransactionbackend/src/controllers/simulationController.ts — Added
simulateTransactionhandler.backend/src/routes/simulationRoutes.ts — New endpoint:
POST /api/v1/simulation/simulate/transaction— Pre-execution validation with dry-runbackend/src/schemas/simulationSchemas.ts — Zod schema for simulation requests.
#465: Penetration Testing Program & Security
SECURITY.md — Enhanced with:
.github/workflows/dast.yml — New CI workflow:
.zap/rules.tsv — ZAP baseline scan rule configuration.
.zap/api-rules.tsv — ZAP API scan rule configuration.
docs/BUG_BOUNTY_PROGRAM.md — Comprehensive bug bounty documentation with reward tiers, scope, and safe harbor.
docs/RED_TEAM_SCHEDULE.md — Quarterly red team exercise schedule with scope, activities, and metrics.
CI Verification
All existing CI checks should pass: