SE

security-hardening

An automated security guide for the SimpleRest framework that enforces robust JWT, ACL, and sanitization standards.

Install

mkdir -p .claude/skills/security-hardening-boctulus && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/9843" && unzip -o skill.zip -d .claude/skills/security-hardening-boctulus && rm skill.zip

Installs to .claude/skills/security-hardening-boctulus

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Security best practices for SimpleRest including JWT configuration, ACL hardening, input sanitization, CSRF protection, and encryption.
135 charsno explicit “when” trigger
Intermediate

Key capabilities

  • JWT configuration management
  • ACL hardening
  • Input sanitization
  • CSRF protection implementation
  • Sensitive data encryption

How it works

It provides specific configuration patterns and security checklists to secure SimpleRest applications against common threats.

Inputs & outputs

You give it
Application configuration
You get back
Hardened security configuration

When to use security-hardening

  • Hardening JWT configuration
  • Configuring resource permissions
  • Sanitizing user inputs
  • Implementing CSRF protection

About this skill

Security Hardening Skill

JWT Configuration (config/config.php)

'access_token' => [
    'secret_key'      => env('JWT_SECRET'),           // MUST be set
    'expiration_time' => 3600,                        // 1 hour
    'encryption'      => 'HS256',
],
'refresh_token' => [
    'secret_key'      => env('JWT_REFRESH_SECRET'),   // DIFFERENT from access
    'expiration_time' => 1209600,                     // 14 days
],
'remember_me_token' => [
    'secret_key'      => env('JWT_REMEMBER_SECRET'),  // DIFFERENT key
    'expiration_time' => 2592000,                     // 30 days
],

JWT Rules

  • Different secrets for each token type
  • Short access TTL (15-60 min), refresh up to 14 days
  • Store in .env, never in code
  • Generate secrets: openssl rand -hex 64

Auth Checks

$userId = auth()::getCurrentUserId();
$user   = auth()::getCurrentUser();
if (!auth()::isAuthenticated()) { /* 401 */ }
$token = Request::getInstance()->bearerToken();

ACL Hardening

// config/acl.php — order matters!
$acl->addRole('guest', 10);
$acl->addRole('registered', 20)->addInherit('guest');    // inherit FIRST
$acl->addRole('admin', 100)->addInherit('registered');
$acl->addResourcePermissions('products', ['show', 'list'], 'guest');
$acl->addResourcePermissions('products', ['create'], 'registered');
$acl->addSpecialPermissions(['read_all', 'write_all'], 'admin');
php com make acl --force            # apply changes
php com make acl --force --debug    # preview

ACL Dont's

  • addInherit() AFTER permissions -> error
  • Dont grant write_all to non-admin roles
  • Dont grant fill_all casually (bypasses fillable protection)
  • Dont grant impersonate except to super-admins

Input Sanitization

Strings::sanitize($input, true, true, 'a-z0-9-');
Strings::slug($name);
Arrays::sanitizeArrayKeys($data);

Use Validation over manual sanitization when possible.

Encryption

use Boctulus\Simplerest\Libs\SimpleCrypt;
$encrypted = SimpleCrypt::encrypt($sensitiveData);
$decrypted = SimpleCrypt::decrypt($encrypted);

Use for: API keys in DB, OAuth tokens, PII.

Cookie Security

Cookie::set('session', $token, 3600, '/', '', true, true);  // secure + httponly

Security Checklist

  • Different JWT secrets for access/refresh/remember-me
  • Access token TTL <= 1 hour
  • ACL regenerated after any config/acl.php change
  • Input validated before DB operations
  • .env excluded from version control
  • Debug mode OFF in production
  • $hidden set on models for passwords/tokens
  • QB uses prepared statements (SQL injection safe)

Common Threats

ThreatMitigation
SQL InjectionQB prepared statements. Never concatenate in DB::statement()
JWT TheftShort TTL, HTTPS only, different secrets
Privilege EscalationTest ACL with --debug, check inheritance
Mass Assignment$not_fillable or unfill() on models
XSSOutput escaping, Strings::sanitize() for user input

When not to use it

  • Non-SimpleRest frameworks
  • Production environments with debug mode enabled

Limitations

  • Specific to SimpleRest framework
  • Requires manual application of security changes

How it compares

It offers framework-specific security hardening rather than general security advice.

Compared to similar skills

security-hardening side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
security-hardening (this skill)02moReviewIntermediate
orbit-sec-supply-chain03moReviewIntermediate
springboot-security55moNo flagsIntermediate
django-security55moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry