Cfn environment sanitization

From masharratt/claude-flow-novice · View interactive version

Cfn environment sanitization is an AI agent skill from the GitHub repository masharratt/claude-flow-novice. Automatically sanitizes environment variables and enforces resource limits to prevent memory leaks in CFN Loop orchestration workflows. This is a critical component of the ANTI-023 memory leak protect

How to use this skill

Skill file

CFN Environment Sanitization Skill

Purpose

Automatically sanitizes environment variables and enforces resource limits to prevent memory leaks in CFN Loop orchestration workflows. This is a critical component of the ANTI-023 memory leak protection system.

Core Functions

Environment Sanitization

Resource Limit Enforcement

Sensitive Data Protection

Usage Patterns

Integration in Orchestration Scripts

#!/usr/bin/env bash

# Load sanitization at script start
source "$(dirname "$0")/../cfn-environment-sanitization/sanitize-environment.sh"

# Rest of orchestration logic...

Standalone Validation

# Check current environment state
./cfn-environment-sanitization/sanitize-environment.sh check

# Apply strict sanitization
./cfn-environment-sanitization/sanitize-environment.sh --strict

CFN Loop Integration Points

Configuration

Environment Variables

Sanitization Rules

The script uses a rule-based system for variable handling:

Safety Features

Strict Mode

When enabled (--strict flag):

Environment Validation

Automatic Protection

Integration Requirements

Prerequisites

Dependencies

Usage Examples

Orchestration Script Integration

#!/usr/bin/env bash

# Load environment sanitization
source "$(dirname "$0")/../cfn-environment-sanitization/sanitize-environment.sh"

# Now safe to proceed with orchestration
echo "Environment sanitized, starting orchestration..."

Agent Spawning with Limits

#!/usr/bin/env bash

# Ensure sanitized environment
source "./cfn-environment-sanitization/sanitize-environment.sh" --strict

# Spawn agent with enforced limits
npx claude-flow-novice agent "$AGENT_TYPE" \
    --max-memory "$CFN_MEMORY_LIMIT" \
    --timeout "$CFN_TIMEOUT"

Environment Validation

# Pre-execution validation
if ! ./cfn-environment-sanitization/sanitize-environment.sh check; then
    echo "Environment validation failed" >&2
    exit 1
fi

Testing

Unit Tests

# Test sanitization rules
./tests/test-environment-sanitization.sh

# Test sensitive data detection
./tests/test-sensitive-data-redaction.sh

# Test memory limit enforcement
./tests/test-memory-limits.sh

Integration Tests

# Test with orchestration script
./tests/test-orchestration-integration.sh

# Test with agent spawning
./tests/test-agent-spawning-integration.sh

Troubleshooting

Common Issues

  1. Missing required variables: Use strict mode to validate
  2. Memory limits not applied: Check Node.js options
  3. Sensitive data leakage: Run environment check
  4. Agent spawning failures: Verify resource limits

Debug Mode

# Enable debug output
export CFN_DEBUG=1
./sanitize-environment.sh --strict

Monitoring and Telemetry

Metrics Collected

Log Integration

Security Considerations

Data Protection

Resource Protection

Compliance

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.