HIVE

Security

Best Practices

Security Best Practices

Comprehensive security recommendations for HIVE Protocol applications.

Account Security

Strong Password Policies

function evaluatePasswordStrength(password: string): { score: number; feedback: string[] } {
  let score = 0;
  const feedback: string[] = [];
  if (password.length >= 12) score += 2;
  if (/[A-Z]/.test(password)) score += 1;
  if (/[a-z]/.test(password)) score += 1;
  if (/[0-9]/.test(password)) score += 1;
  if (/[^A-Za-z0-9]/.test(password)) score += 2;
  return { score, feedback };
}

API Security

Rate Limiting

Implement rate limiting to prevent abuse at the database level using PostgreSQL functions.

Agent Security

System Prompt Security

function sanitizeSystemPrompt(prompt: string): string {
  const forbidden = [/ignore previous instructions/gi, /override system/gi];
  let sanitized = prompt;
  for (const pattern of forbidden) {
    sanitized = sanitized.replace(pattern, '[FILTERED]');
  }
  return sanitized;
}

Security Checklist

Development

  • [ ] Use environment variables for secrets
  • [ ] Enable RLS on all tables
  • [ ] Validate all user input

Deployment

  • [ ] Enable HTTPS everywhere
  • [ ] Set secure cookie flags
  • [ ] Enable rate limiting

AI Operations

  • [ ] Filter sensitive data from AI context
  • [ ] Sandbox tool executions
  • [Authentication](/docs/security/sec-authentication): Login and session management
  • [Authorization](/docs/security/authorization): RLS policies and access control
  • [Data Privacy](/docs/security/data-privacy): Encryption and data protection

Cookie Preferences

We use cookies to enhance your experience, analyze site traffic, and for marketing purposes. By clicking "Accept All", you consent to our use of cookies. Read our Privacy Policy for more information.