CleverCase

Security & Compliance

Rusakov Shield posture — sealed environment, response sanitization, and SOC 2 / HIPAA / ABA 1.6 compliance.

Rusakov Shield — CleverCase Tenant Operator Guide

CleverCase runs under the Rusakov Shield layer. This guide is the tenant-facing reference for the shield posture, how to verify it, and the contracts agents and developers must respect. The canonical posture is declared in packages/rak-plugin-clevercase/rak-plugin.json (shield and compliance blocks) and resolved by the platform.

Posture at a glance

AspectValueSource
Surfacesworker, gateway, mcp, sdkshield.surfaces
Sealed keysDATABASE_URL, LEGACY_DATABASE_URL, HEROKU_DATABASE_URL, REDIS_AI_URL, RAK_GATEWAY_SERVICE_KEY, RAKONTEVR_SERVICE_KEY, JWT_SECRET, AWS_SECRET_ACCESS_KEY, OPENAI_API_KEYshield.sealedKeys
Response sanitizationenabledshield.sanitizeResponses
Source map strippingenabledshield.stripSourceMaps
Compliance standardsSOC 2, HIPAA, ABA 1.6compliance.standards
Data classificationlegal-privilegedcompliance.dataClassification
Retention2555 days (7 years), incl. PHIcompliance.retentionPolicy
PII scan before cloud offloadrequiredcompliance.requireNimPiiScan, cloudOffloadRequiresMasking

The four shield guarantees

1. Sealed environment

Keys in shield.sealedKeys are encrypted in memory at worker boot via the platform sealed-env bootstrap. They are key names only in the manifest — never values. Agents and code MUST NOT:

  • log or echo sealed values (no console.log(process.env.DATABASE_URL)),
  • return them in API responses or error messages,
  • add new env keys with secret values to rak-plugin.json.

The CleverCase secrets toolchain enforces this at the source: secrets live only under rakontevr/clients/clevercase/* and the namespace guard in scripts/secrets/clevercase-secrets.manifest.sh aborts on any out-of-namespace id.

2. Response sanitization

Any customer-facing API route returning data to client users must pass through the platform sanitizeApiResponse() (rusakov-shield/response-sanitizer). Sanitized payloads must not contain:

  • executionPath, provider names, orchestration traces, internal model ids,
  • internal stack traces or sealed key names,
  • cross-firm matter content (see MSO content-blind rule below).

CleverCase API handlers are wrapped with withCleverCaseTracing (packages/rak-plugin-clevercase/src/api/trace.ts) which feeds the platform sanitizer.

3. MSO content-blind isolation (ABA 5.4)

MSO admin / rollup APIs return counts and billing aggregates only. Firm A cannot see Firm B matter content. Enforced by:

  • RLS on clevercase_* tables (migrations 043, 044, rak_rls_row_ok_uuid),
  • requireManagementRole gating in MSO handlers,
  • the RBAC matrix in src/rules/policies/generated-bundle-policies.ts,
  • tests in packages/rak-plugin-clevercase/src/__tests__/mso-rbac.bdd.test.ts.

4. Container hardening

Client-facing images are compiled bundles only — no source maps, no .cursor/rules, no platform source, no internal docs.

Verify the posture

clevercase shield status     # delegates to rak security shield (tenant env)
clevercase shield audit      # full posture audit

Note: in this standalone repo, clevercase blocks platform-operator security subcommands; shield status/audit are the allowed tenant verbs (clevercase shield status|audit → rak security shield … --tenant clevercase). Other shield operations are platform-operator only.

Known platform issue (2026-06): rak security shield status currently fails with ERR_MODULE_NOT_FOUND for rusakov-shield/agent-shield (missing module imported by gateway-shield.ts). The CleverCase wiring is correct; this is a platform-side bug tracked separately. Until fixed, verify posture via the manifest test suite (shield-compliance.bdd.test.ts).

Compliance + secrets checks:

clevercase secrets validate          # required keys present, tenant id matches
./scripts/aws/setup-aws-profile.sh --verify-only   # IAM isolation check
npm run test                         # includes shield/RBAC/secrets BDD tests

Agent rules (must / must not)

MUST

  1. Treat all matter data as legal-privileged; never log PHI or client narratives.
  2. Route customer-facing responses through sanitizeApiResponse().
  3. Keep MSO views content-blind (counts/aggregates only).
  4. Mask PII before any cloud offload (requireNimPiiScan).
  5. Keep secrets within rakontevr/clients/clevercase/*.

MUST NOT

  1. Disable sanitization, sealed-env, or PII-scan flags to pass a check.
  2. Store secret values in rak-plugin.json, rules, or source.
  3. Expose cross-firm matter content to MSO admins or parent tenants.
  4. Bypass auth for secrets pull, MSO routes, or tenant-scoped MCP tools.

On this page