Saas security audit

From Basinfy/Basinfy-SaaS-Studio · View interactive version

Saas security audit is an AI agent skill from the GitHub repository Basinfy/Basinfy-SaaS-Studio. Adversarial AppSec audit — RLS tenant isolation, auth/RBAC, OWASP, webhooks, and AI sinks.

How to use this skill

Skill file

!bash "${CLAUDE_SKILL_DIR}/../../hooks/yaml-helper.sh" resolve_config --keys locale,automation,workflow

Automation mode: Resolve modes.automation (project.local.yaml →

project.yaml → default collaborative). Every AskUserQuestion call and

every file write follows .claude/docs/automation-modes.md

(collaborative asks always · guided major-only · autonomous logs and proceeds;

automation_always_ask categories always prompt).

workflow (resolved above) decides only what Phase 7 tells you about the

release gate: at standard and full it requires this report; at minimal it

does not. The audit itself runs the same at every tier.

Application Security (AppSec) Audit & Vulnerability Harness

Locale & User Profile: Match locale (pt-BR → natural Brazilian Portuguese questions/options, overriding English examples; en → English) and user_profile (founder → plain business language with (Recomendado) first, zero tech jargon; developer → technical). Keep code/tests in English.

Security is mandatory for production SaaS platforms. Multi-tenant SaaS architectures face tenant data cross-contamination risks, broken object-level authorization (BOLA/IDOR), session fixation, webhook forgery, AI/LLM context injection, and resource exhaustion.

This skill implements an adversarial, evidence-grounded security audit workflow (derived from the Cloudflare Vulnerability Harness standard). It systematically maps attack surfaces, performs coverage-led hunting, executes independent verification to eliminate false positives, and generates structured, schema-validated remediation reports.

Core Defensive Principles (Cloudflare Standard):

  1. Concrete Boundary Violations Only: A candidate without a concrete affected principal, resource, or security outcome is not a confirmed finding.
  2. Adversarial Validation: The agent that checks a candidate finding is never the agent that identified it. Verifiers actively seek upstream defenses or framework protections.
  3. Severity Requires Real Impact: Severity = Likelihood × Impact. Defense-in-depth gaps are hardening notes, not vulnerabilities, when an upstream layer reliably prevents exploitation.
  4. Three Strict Verdicts:

Phase 1: Parse Arguments and Scope

Modes:


Phase 2: Reconnaissance & Surface Mapping

Inspect the stack configuration and codebase entry points:


Phase 3: Coverage-Led Hunting (Hunter Agent)

Spawn the primary auditor subagent:

subagent_type: appsec-engineer
role: Adversarial Security Hunter
focus: Source-to-sink vulnerability discovery and tenant boundary verification

The Hunter examines the target against the 6 core SaaS attack domains:

1. Multi-Tenancy & Tenant Isolation (IDOR / BOLA)

2. Authentication & Session Integrity

3. Authorization, RBAC & Webhooks

4. Input Validation & Injection Sinks

5. AI, LLM & Agent Delegation (When Applicable)

6. Resource Exhaustion & Availability


Phase 4: Adversarial Candidate Validation (Verifier Agent)

In full audit mode, every candidate vulnerability identified by the Hunter is assigned to an independent Verifier:

subagent_type: auth-security-specialist
role: Independent Security Verifier
focus: Adversarial disproval and verification of candidate vulnerabilities

The Verifier actively seeks:

  1. Upstream sanitization or framework middleware that neutralizes the vector.
  2. Type constraints or ORM guarantees that prevent the invalid state.
  3. Defense-in-depth layers that prevent real-world exploitation.

Each candidate is resolved into:


Phase 5: Structured Output & Schema Validation

Validate the structured findings using the zero-dependency validator:

node .claude/skills/saas-security-audit/scripts/validate-findings.cjs <findings-file.json>

Ensure all records adhere to scripts/report-schema.json.


Phase 6: Author Audit Report

Save the report to production/security/saas-security-audit-[date]-[scope].md:

# Application Security Audit Report

> **Target**: [Project Name]
> **Date**: [YYYY-MM-DD]
> **Scope**: [full | tenant | auth | api | quick]
> **Auditors**: appsec-engineer (Hunter) / auth-security-specialist (Verifier)
> **Standard**: Cloudflare Vulnerability Harness Defensive Standard
> **Status**: [PASSED | REMEDIATION REQUIRED]

## Executive Summary
[High-level overview of security posture, verified findings count, and release recommendation]

| Verdict | Count | Blockers for Release |
|---|---|---|
| Confirmed (Critical / High) | [N] | Yes |
| Confirmed (Medium / Low) | [N] | No |
| Needs Validation | [N] | Manual review |
| Rejected (Disproved) | [N] | None (Hardened) |

## Confirmed Vulnerabilities

### SEC-001: [Title]
- **Severity**: CRITICAL | HIGH | MEDIUM | LOW
- **Domain**: [Data Isolation | Web Protocol & Auth | AI/LLM | Resource Exhaustion | Injection]
- **Affected Principal & Resource**: [Attacker role, Victim role, Affected entity]
- **Source Trace**: `src/path/to/file.ts:L45` -> `src/path/to/sink.ts:L112`
- **Observed Result**: [Concrete security failure]
- **Smallest Effective Fix**: [Code diff or targeted remediation]

## Items Needing External Validation
[List of leads requiring staging environment, WAF, or IdP configuration verification]

## Hardening Notes & Disproved Candidates
[Defense-in-depth observations that are not exploitable vulnerabilities]

## Remediation Priority Order
1. SEC-001: [Immediate fix]

Phase 7: Gate Integration

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.