This document describes the P0 baseline security and compliance rules implemented in the CompliLedger Algorand SDK v1.
Rules that enforce proper authorization and access control for critical application lifecycle operations.
Rules that prevent unauthorized account manipulation (rekey, close).
Rules that detect potentially dangerous fee handling patterns.
Rules that protect asset transfers and asset management operations.
Rules that identify risky logic patterns or missing validations.
- Category: Application Control
- Severity: CRITICAL
- Control Mapping: SOC2:CC6.1, PCI-DSS:6.5.10
- Description: Detects
DeleteApplicationwithout sender/admin validation - Detection (PyTeal):
OnComplete.DeleteApplicationbranch exists- No
Txn.sender()check in same block
- Detection (TEAL):
OnCompletion==DeleteApplication(int DeleteApplication)- Missing
txn Sendervalidation beforereturn 1
- Category: Application Control
- Severity: CRITICAL
- Control Mapping: SOC2:CC6.1, PCI-DSS:6.5.10
- Description: Detects
UpdateApplicationwithout sender/admin validation - Detection (PyTeal):
OnComplete.UpdateApplicationbranch exists- No
Txn.sender()check
- Detection (TEAL):
OnCompletion==UpdateApplication- Missing
txn Sendervalidation
- Category: Application Control
- Severity: HIGH
- Control Mapping: SOC2:CC6.1
- Description: General missing admin/sender validation in critical paths
- Detection (PyTeal):
- Critical operations (globalPut, globalDel, InnerTxn) without
Txn.sender()check
- Critical operations (globalPut, globalDel, InnerTxn) without
- Detection (TEAL):
app_global_put,app_global_del, oritxn_submitwithouttxn Sendervalidation
- Category: Account Control
- Severity: CRITICAL
- Control Mapping: SOC2:CC6.6, PCI-DSS:6.5.10
- Description: Missing validation that
RekeyTois zero address - Detection (PyTeal):
- No
Txn.rekey_to() == Global.zero_address()check
- No
- Detection (TEAL):
- No
txn RekeyTowithglobal ZeroAddresscomparison
- No
- Category: Account Control
- Severity: CRITICAL
- Control Mapping: SOC2:CC6.6, PCI-DSS:6.5.10
- Description: Missing validation that
CloseRemainderTois zero address - Detection (PyTeal):
- No
Txn.close_remainder_to() == Global.zero_address()check
- No
- Detection (TEAL):
- No
txn CloseRemainderTowithglobal ZeroAddresscomparison
- No
- Category: Logic Patterns
- Severity: HIGH
- Control Mapping: SOC2:CC7.2, PCI-DSS:6.5.1
- Description: Transaction arguments used without length/format validation
- Detection (PyTeal):
Txn.application_args[N]used withoutTxn.application_args.length()check
- Detection (TEAL):
txn ApplicationArgs Nused withouttxn NumAppArgsvalidation
- Category: Logic Patterns
- Severity: HIGH
- Control Mapping: SOC2:CC6.1, PCI-DSS:6.5.8
- Description: Global/local state mutations without authorization checks
- Detection (PyTeal):
App.globalPutorApp.localPutwithout precedingTxn.sender()orAssert
- Detection (TEAL):
app_global_putorapp_local_putwithout priortxn Sendercheck
- Category: Logic Patterns
- Severity: HIGH
- Control Mapping: SOC2:CC6.1, PCI-DSS:6.5.1
- Description: Inner transactions submitted without proper validation
- Detection (PyTeal):
InnerTxnBuilder.Submit()without authorization checks
- Detection (TEAL):
itxn_submitwithout preceding validation logic
- Category: Fee Abuse
- Severity: MEDIUM
- Control Mapping: SOC2:CC7.2, PCI-DSS:6.5.1
- Description: Transaction fee not bounded or validated
- Detection (PyTeal):
Txn.fee()referenced but no upper bound check
- Detection (TEAL):
txn Feeused without<=comparison to max value
The compliance score is computed as:
score = 100 - (critical_count * 20 + high_count * 10 + medium_count * 5 + low_count * 2)
score = max(0, min(100, score))
- Critical: -20 points each
- High: -10 points each
- Medium: -5 points each
- Low: -2 points each
A contract passes if its score meets or exceeds the threshold (default: 80).
{
"framework": "SOC2",
"control_id": "CC6.1",
"status": "fail",
"contract": "examples/vulnerable_escrow.py",
"rules_triggered": ["DELETE_WITHOUT_ADMIN_CHECK", "REKEY_NOT_ZERO"],
"severity": "critical",
"timestamp": "2024-12-01T08:53:00Z",
"metadata": {
"policy": "algorand-baseline",
"threshold": 80,
"score": 60
}
}The verdict is serialized to canonical JSON, hashed with SHA-256, and anchored on Algorand as:
Note: CLG1|sha256:<hex_hash>
- Asset transfer validation: Ensure asset opt-in before transfers
- Reentrancy detection: Identify potential reentrancy patterns in stateful calls
- Time-lock validation: Verify proper use of
LatestTimestampandFirstValid/LastValid - ZK-proof integration: Zero-knowledge proofs for private compliance attestations
- Multi-sig enforcement: Rules requiring multi-signature approvals for sensitive operations