-
-
Notifications
You must be signed in to change notification settings - Fork 34
Protection Workflow
Master the art of protecting critical code sections throughout your development process, ensuring business logic and security implementations remain safe from unintended modifications.
A good protection strategy:
- π‘οΈ Identifies critical code early
- π Applies appropriate levels
- π Documents protection reasons
- π Reviews coverage regularly
- π Tracks modifications
Without protection strategy:
- π« Critical code modified
- π« Security vulnerabilities
- π« Business logic corrupted
- π« Compliance violations
Identify what needs protection:
## Protection Planning
### Critical Areas Identified
- Authentication logic
- Payment processing
- Encryption algorithms
- API keys and secrets
- Compliance code
- Database schemasDetermine protection levels:
| Code Type | Protection Level | Symbol |
|---|---|---|
| Security keys | PROTECTED | Ξ¨β |
| Core algorithms | CRITICAL | Ξ¨β |
| Validated logic | GUARDED | Ξ¨β |
| Config explanations | INFO | Ξ¨β |
| Temporary code | DEBUG | Ξ¨β |
| Test fixtures | TEST | Ξ¨β |
Apply protection during coding:
// !cp PROTECTED - API Configuration
const API_CONFIG = {
key: process.env.API_KEY,
secret: process.env.API_SECRET,
endpoint: process.env.API_ENDPOINT
};
// !cp END-P
// !cc CRITICAL - Payment Processing Logic
async function processPayment(order, payment) {
// Validated payment logic - DO NOT MODIFY
// Changes require compliance review
const validation = await validatePayment(payment);
if (!validation.success) {
throw new PaymentError(validation.errors);
}
const result = await paymentGateway.charge({
amount: order.total,
currency: order.currency,
source: payment.token
});
await logTransaction(result);
return result;
}
// !cc END-CUpdate protection registry:
## π‘οΈ Protection Registry Update
### New Protections Added
- `src/config/api.js:1-5` [Ξ¨β] - API configuration
- `src/payments/process.js:10-25` [Ξ¨β] - Payment logic
- Added: 2024-01-15
- Reason: Compliance requirement
- Approved by: Security teamVerify protection coverage:
Protection Coverage Report:
- Total files: 127
- Protected sections: 34
- Coverage: 27%
- Critical paths: 100% protected β
- Security items: 100% protected β
- Business logic: 85% protected β οΈ
Protect sensitive configuration:
// !cp PROTECTED - Environment Configuration
// These values are validated for production
// Modification requires security review
const CONFIG = {
// Database
DB_HOST: process.env.DB_HOST,
DB_PORT: process.env.DB_PORT,
DB_NAME: process.env.DB_NAME,
// Security
JWT_SECRET: process.env.JWT_SECRET,
ENCRYPTION_KEY: process.env.ENCRYPTION_KEY,
// API Keys
STRIPE_KEY: process.env.STRIPE_KEY,
AWS_ACCESS_KEY: process.env.AWS_ACCESS_KEY
};
// !cp END-P
// !ci INFO - Configuration Usage
// Use CONFIG object throughout application
// Never hardcode these values
// Update .env.example when adding new keys
// !ci END-IProtect validated algorithms:
// !cc CRITICAL - Proprietary Ranking Algorithm
// This algorithm is core business value
// Modifications require C-level approval
// Patent pending: US-2024-123456
function calculateRanking(items, userPreferences) {
// !cg GUARDED - Weighting factors
// These weights are ML-optimized
// Do not modify without data science review
const weights = {
relevance: 0.35,
quality: 0.25,
recency: 0.20,
userMatch: 0.20
};
// !cg END-G
return items.map(item => {
const score =
item.relevance * weights.relevance +
item.quality * weights.quality +
item.recency * weights.recency +
matchScore(item, userPreferences) * weights.userMatch;
return { ...item, rankScore: score };
}).sort((a, b) => b.rankScore - a.rankScore);
}
// !cc END-CProtect security implementations:
// !cp PROTECTED - Authentication Flow
// Security-critical: Do not modify without security audit
class AuthenticationService {
// !cc CRITICAL - Password Hashing
// OWASP recommended implementation
// Bcrypt with cost factor 12
async hashPassword(password) {
const saltRounds = 12;
return bcrypt.hash(password, saltRounds);
}
// !cc END-C
// !cc CRITICAL - Token Generation
// JWT with RS256 algorithm
// Tokens expire in 15 minutes
generateAccessToken(user) {
return jwt.sign(
{ id: user.id, role: user.role },
this.privateKey,
{
algorithm: 'RS256',
expiresIn: '15m',
issuer: 'auth-service'
}
);
}
// !cc END-C
}
// !cp END-PProtect compliance-required code:
// !cp PROTECTED - GDPR Compliance
// Required by EU regulation
// Modifications require legal review
class DataProtectionService {
// !cc CRITICAL - Data Deletion
// GDPR Article 17: Right to erasure
async deleteUserData(userId) {
// Must delete from all systems
await this.deleteFromDatabase(userId);
await this.deleteFromCache(userId);
await this.deleteFromBackups(userId);
await this.deleteFromAnalytics(userId);
// Audit log required
await this.logDeletion(userId, {
timestamp: new Date(),
reason: 'User request',
completeness: 'full'
});
}
// !cc END-C
}
// !cp END-PProtect core business rules:
// !cc CRITICAL - Pricing Engine
// Core business logic - Do not modify
// Changes require business approval
class PricingEngine {
// !cg GUARDED - Base Pricing Rules
calculatePrice(product, quantity, customer) {
let basePrice = product.basePrice * quantity;
// Bulk discounts (validated by finance)
if (quantity >= 100) basePrice *= 0.85;
else if (quantity >= 50) basePrice *= 0.90;
else if (quantity >= 20) basePrice *= 0.95;
// Customer tier discounts
const tierDiscount = this.getTierDiscount(customer.tier);
basePrice *= (1 - tierDiscount);
// Never go below cost
const minimumPrice = product.cost * quantity * 1.15;
return Math.max(basePrice, minimumPrice);
}
// !cg END-G
}
// !cc END-CIs it a security key/secret?
Yes β Ξ¨β PROTECTED
No β
Is it business-critical logic?
Yes β Ξ¨β CRITICAL
No β
Does it require approval to change?
Yes β Ξ¨β GUARDED
No β
Is it configuration/documentation?
Yes β Ξ¨β INFO
No β
Is it temporary?
Yes β Ξ¨β DEBUG (if debugging) or Ξ¨β
TEST (if testing)
No β Consider if protection needed
| Level | Use When | Review Frequency |
|---|---|---|
| PROTECTED | Never change | Quarterly |
| CRITICAL | Business impact | Monthly |
| GUARDED | Needs approval | Bi-weekly |
| INFO | Context important | As needed |
| DEBUG | Temporary only | Daily |
| TEST | Test code | Per release |
- Identify security-sensitive areas
- List business-critical logic
- Note compliance requirements
- Plan protection levels
- Document protection strategy
- Add protection as you code
- Use clear descriptions
- Include end markers
- Group related protections
- Update protection registry
- Verify all critical code protected
- Check protection levels appropriate
- Ensure descriptions clear
- Update documentation
- Run protection coverage report
- Regular protection audits
- Remove obsolete protections
- Update protection reasons
- Review approved changes
- Train team on protection
Don't wait to add protection:
// Write and protect together
function criticalFunction() {
// !cc CRITICAL - Business Logic
// Implementation
// !cc END-C
}Explain why protected:
// β Bad
// !cp PROTECTED - Don't change
// β
Good
// !cp PROTECTED - PCI Compliance Required
// Credit card processing per PCI-DSS v3.2.1Protect logical units:
// !cg GUARDED - User Validation Module
class UserValidator {
validateEmail() { /* ... */ }
validatePassword() { /* ... */ }
validateProfile() { /* ... */ }
}
// !cg END-GTrack protection evolution:
## Protection History
- v1.0: Initial protection added
- v1.1: Enhanced security section
- v1.2: Added compliance markers
- v2.0: Restructured protection zonesSchedule protection audits:
## Monthly Protection Review
- [ ] All secrets protected?
- [ ] New critical code marked?
- [ ] Obsolete protections removed?
- [ ] Documentation updated?
- [ ] Team aware of changes?Problem: Everything marked as protected Solution: Reserve for truly critical code
Problem: Critical code unprotected Solution: Protection planning in PLAN mode
Problem: "Don't change this" Solution: Specific reasons and requirements
Problem: Unclear protection boundaries Solution: Always include END markers
Problem: Protecting removed code Solution: Regular protection audits
Track protection coverage:
## Protection Coverage
- Security code: 100% β
- Business logic: 95% β
- Configuration: 90% β
- Integration: 80% β οΈ
- Overall: 91% β
Monitor protection violations:
## Violation Report (Monthly)
- Total violations: 3
- CRITICAL violations: 0 β
- PROTECTED violations: 1
- GUARDED violations: 2
- All resolved: Yes β
Track approved changes:
## Approved Modifications
- Total requests: 12
- Approved: 8
- Denied: 4
- Average review time: 2 days!cp - Add PROTECTED
!cg - Add GUARDED
!ci - Add INFO
!cd - Add DEBUG
!ct - Add TEST
!cc - Add CRITICAL
"Show protection coverage"
"List unprotected critical files"
"Check protection violations"
"Generate protection audit"
"Add protection to payment.js"
"Update protection registry"
"Review protection history"
"Export protection map"
- ποΈ Framework Overview
- π RIPER Modes
- πΎ Memory System
- π£ Symbolic Notation
- π Phase Management
- π‘οΈ Code Protection
- π Context References
- π Permission System
- π Cross-References
- πΎ Backup System
- π Mode Transitions
- πΎ Memory Management
- π‘οΈ Protection Workflow
- π Context Management
- π₯ Team Collaboration
- π£ Symbol Reference
- β¨οΈ Command Reference
- π Mode Reference
- π Permission Matrix
- π API Reference
- π Overview
- π GitHub Integration
- π Web Search
- π Browser Automation
- π³ Docker Integration
-
Installation Issues
- Node.js Version Compatibility
- Package Installation Failures
- Framework Dependencies Missing
- Database Connection Issues
- Port Conflicts
- Environment Setup Issues
- Build and Development Issues
- Framework CLI Issues
-
Configuration & Runtime Issues
- Framework Configuration Problems
- Runtime Performance Issues
- Module Loading and Plugin Issues
- Database and Storage Issues
- Memory Leaks and High Memory Usage
- High CPU Usage
-
BMAD Module Issues
- BMAD Module Initialization Problems
- Business Model Canvas Issues
- Stakeholder Management Issues
- Analytics and Reporting Issues
- Performance Optimization
-
Database & API Issues
- Database Connection Problems
- Database Migration Issues
- API Performance and Reliability Issues
- Data Consistency Issues
- Transaction Problems
-
Performance & Memory Issues
- Memory Management
- CPU Optimization
- Database Query Performance
- Caching Issues
- Resource Monitoring
-
Security & Authentication Issues
- Authentication Failures
- Authorization Problems
- JWT Token Issues
- Session Management
- CORS and Security Headers
- SSL/TLS Configuration
-
Deployment & Production Issues
- Production Deployment Failures
- Environment Configuration
- Load Balancing Issues
- Monitoring and Logging
- Backup and Recovery
When reporting issues, please include:
- Framework version (
npm list @cursoriper/core) - Node.js version (
node --version) - Operating system and version
- Error messages and stack traces
- Steps to reproduce the issue
- Configuration files (sanitized)
- Recent changes or deployments
- Technical Support: support@cursoriper.com
- Documentation: https://docs.cursoriper.com
- Community Forum: https://community.cursoriper.com