security-test

$npx mdskill add HoangNguyen0403/agent-skills-standard/security-test

> [!IMPORTANT] > Fast, continuous DevSecOps pipeline for Pull Requests and active branches. Runs SAST, SCA, and secrets detection to catch vulnerabilities before they merge.

SKILL.md

.github/skills/security-testView on GitHub ↗
---
name: security-test
description: "Fast, continuous DevSecOps pipeline for Pull Requests and active branches. Runs SAST, SCA, and secrets detection to catch vulnerabilities before they merge."
metadata:
  triggers:
    keywords:
    - security test
    - workflow
---
# Security Test Skill

> [!IMPORTANT]
> Fast, continuous DevSecOps pipeline for Pull Requests and active branches. Runs SAST, SCA, and secrets detection to catch vulnerabilities before they merge.

## Instructions

When the user asks to perform this workflow, execute the following steps:


# 🛡️ Continuous Security Test (Shift-Left)

> **Goal**: Execute a high-speed, lightweight security audit on a specific code branch or Pull Request. Prevent hardcoded secrets, vulnerable dependencies, and basic OWASP violations from merging into the main branch.
> 
> **Policy**: Fast execution (< 2 mins). Focuses on Static Analysis (SAST) and Software Composition Analysis (SCA). No dynamic exploitation or staging environments required.

---

## Phase 1 — Context & Diff Isolation

Define the exact scope of the code changes.

1. **Target Identification**: Identify the target branch / diff base branch (e.g., via `GITHUB_BASE_REF`, `CI_MERGE_REQUEST_TARGET_BRANCH_NAME`, git remote HEAD default branch, or local tracking/parent branch).
2. **Context Gathering**: Run `git diff <base>...HEAD` (substituting the detected base branch, such as `main`, `master`, or `develop`) to isolate only the code modified by the developer.
3. **Guardrail**: We do NOT scan the entire repository (unless explicitly requested). We only evaluate the delta to ensure high speed and low noise.

---

## Phase 2 — Automated Security Scans (SAST & SCA)

Delegate the raw scanning and triage to the **ASPM Correlator** (`specialist-aspm-correlator`).

1. **Secrets Detection**:
   - Scan the diff for newly introduced credentials, API keys, and PII (`grep -rE "(password|apiKey|secret)"`).
2. **Dependency Audit (SCA)**:
   - If `package.json`, `go.mod`, `pom.xml`, or `pubspec.yaml` was modified, run the native audit tool (e.g., `npm audit`, `cargo audit`, `dart pub outdated --json`).
3. **Static Analysis (SAST)**:
   - Identify dangerous sinks in the diff (e.g., `dangerouslySetInnerHTML`, raw SQL concatenation, `exec()`).
4. **Triage & Deduplication**:
   - `specialist-aspm-correlator` filters out false positives and maps valid findings directly to the offending line of code.

---

## Phase 3 — High-Density Code Review

Delegate the architectural and logic review of the diff to the **Security Reviewer** (`specialist-security-reviewer`).

1. **Auth Verification**: Ensure newly added routes have the correct authentication guards (`@UseGuards`, middleware).
2. **Input Validation**: Check if new user-facing inputs are properly sanitized before hitting the database.
3. **Business Logic Sanity**: Quickly review for obvious missing role checks (BOLA) in the changed files.

*Note: The Reviewer operates under strict token budgets (≤ 8 tool calls, ≤ 3 full file reads).*

---

## Phase 4 — Developer-Centric Remediation

Convert findings into immediate, actionable developer feedback.

1. **Blocker Assessment**:
   - Did we find a P0 (Hardcoded Secret, SQLi, Auth Bypass)? If yes, immediately reject the PR / fail the check.
2. **Targeted Patches**:
   - For every finding, provide the **exact code diff** required to fix it. Do not give generic advice (e.g., instead of "sanitize input", provide the exact parameterized query implementation).
3. **Final Output**:
   - Print a concise markdown summary suitable for a GitHub/GitLab PR comment.

### Output Template
```markdown
### 🛡️ Security Check: [PASS / FAIL]

**Scan Scope**: [Branch/Diff size]
**Execution Time**: Fast SAST/SCA

#### 🔴 Blockers (Must Fix)
- [File:Line] - [Vulnerability]
  ```diff
  - vulnerable_code()
  + secure_code()
  ```

#### 🟡 Warnings (Technical Debt)
- [Dependency/Config issue] - Run `[specific update command]`

#### ✅ Verified
- No exposed secrets in diff.
- Auth guards present on all new routes.
```

More from HoangNguyen0403/agent-skills-standard

SkillDescription
android-agp-upgradeUpgrade an Android project to Android Gradle Plugin (AGP) 9. Use when migrating to AGP 9, updating Gradle build files, migrating to built-in Kotlin, or adopting the new AGP DSL.
android-architectureApply Clean Architecture layering, modularization, and Unidirectional Data Flow in Android projects. Use when setting up project structure, placing code in layers, configuring feature/core modules, or implementing UDF patterns.
android-background-workImplement WorkManager and background processing correctly on Android. Use when creating Worker classes, scheduling tasks, choosing between WorkManager and Foreground Services, or setting up Hilt in workers.
android-composeBuild high-performance declarative UI with Jetpack Compose. Use when writing Composable functions, optimizing recomposition, hoisting state, or working with LazyColumn and side effects.
android-compose-migrationMigrate an Android XML View to Jetpack Compose following a structured 10-step workflow. Use when converting XML layouts to Compose, setting up Compose in an existing View-based project, or incrementally adopting Compose.
android-concurrencyWrite correct coroutine scopes, Flow collection, and dispatcher injection in Android. Use when writing suspend functions, choosing between StateFlow and SharedFlow, or injecting Dispatchers for testability.
android-deploymentConfigure release signing, R8 obfuscation, and App Bundle publishing for Android. Use when setting up signing configs, enabling minification, adding ProGuard keep rules, or preparing for Play Store submission.
android-design-systemEnforce Material Design 3 theming and design token usage in Jetpack Compose. Use when implementing M3 components, color schemes, typography, or design tokens.
android-diConfigure Hilt dependency injection with proper scoping, modules, and constructor injection in Android. Use when setting up Hilt DI, defining modules, or configuring component scoping.
android-edge-to-edgeMigrate a Jetpack Compose app to edge-to-edge display and fix system bar inset issues. Use when UI components are obscured by navigation/status bars, fixing IME insets, or enabling edge-to-edge for SDK 35+.