- Home
- Skills
- Code Quality & Review
- Adversarial Code Reviewer
Adversarial Code Reviewer
An evidence-based reviewer that finds exploitable bugs and security flaws using adversarial threat modeling.
Free
Works with the AI Agents you already use
Adversarial Code Reviewer
Example session with this skill installed
Perform an adversarial review of the authentication logic in src/auth/session.ts. Focus on session hijacking risks and token validation. Use the provided diff from PR #42.
- Read your context and instructions
- Compiled the adversarial code reviewer
I have completed an adversarial review of the session management logic in src/auth/session.ts. The review focused on identifying exploitable flaws in token validation and storage.
Adversarial Review Report: PR #42
| Finding | File:Line | Severity | Confidence | Impact |
|---|---|---|---|---|
| Weak Token Generation | src/auth/session.ts:14 | Critical | High | Predictable session IDs allow for account hijacking via brute force. |
| Missing Expiry Check | src/auth/session.ts:42 | High | High | Tokens remain valid indefinitely after logout, increasing the attack surface. |
| Insecure Cookie Flags | src/auth/session.ts:58 | Medium | Medium | HttpOnly and Secure flags are missing, exposing tokens to XSS scripts. |
| Redundant Type Check | src/auth/session.ts:89 | Low | High | Minor maintainability issue; duplicate validation of the userId string. |
Technical Analysis
The implementation uses Math.random() for session secret generation at line 14. This is cryptographically insecure. Furthermore, the validateSession function lacks a timestamp comparison against the expires_at column in the database, meaning revoked sessions may still grant access if the token is known.
Verification Plan
- Test Command:
npm run test:security -- src/auth/session.test.ts - Expected Result: Should fail on session reuse after
logout()call. - Execution Status: NOT RUN (Environment requires
process.env.DB_URL)
Verdict
CHANGES REQUESTED
The predictable token generation is a blocker. The session validation logic must be updated to check expiration timestamps before authorizing requests.
Next steps
- Replace
Math.random()withcrypto.randomBytes()for all secret generation. - Add a
Date.now() > session.expiresAtcheck in thevalidateSessionmiddleware. - Configure the session cookie with
httpOnly: trueandsecure: truein the production config.
Connects securely to your tools. The creator never sees your data.
About this skill
Code reviews often suffer from "LGTM" culture or subjective nitpicking that misses critical logic flaws. This skill implements an adversarial review workflow designed to find exploitable bugs, security vulnerabilities, and functional regressions before they hit production. It prioritizes evidence over opinion by requiring specific file paths, line ranges, and reproduction steps for every finding.
What it does
- Adversarial threat modeling proactively identifies risks in authentication, authorization, and data handling.
- Evidence-based reporting requires exact file/line references and impact analysis for every identified issue.
- Confidence scoring distinguishes between confirmed exploits and unverified hypotheses to prevent false alarms.
- Prioritized severity ranking ensures critical security and correctness blockers are addressed before maintainability nits.
- Verification checklists provide concrete commands and criteria to validate that fixes actually work.
How it works
- Scope definition establishes the baseline by reading diffs, callers, and requirement docs.
- Assumption falsification attempts to break the logic using static checks or focused tests.
- Structured reporting generates a review ordered by impact with minimal recommended fixes.
- Final verdict issues a
block,changes requested, orapprovestatus with a verification plan.
Frameworks & tools
This skill is language-agnostic and works with any version control system. It utilizes standard CLI tools for static analysis and testing when available in the environment.
Why this beats prompting it yourself
Generic prompts often return vague advice like "add more comments" or "refactor this function." This skill enforces a strict evidence-driven contract that prevents the agent from praising code it hasn't thoroughly stress-tested against boundary conditions.
Use cases
- Reviewing security-sensitive patches before merging into main branches.
- Auditing code written by other AI agents to catch "hallucinated" logic.
- Identifying data races and persistence failures in backend microservices.
- Performing pre-release regression checks on complex PRs.
Known limitations
Requires access to surrounding context beyond just the diff for high-confidence reviews. It cannot execute destructive operations or external service requests without explicit user authorization.
Requires surrounding file context for high-confidence logic analysis. Cannot perform destructive operations or merge code independently. Status of tests must be explicitly logged as NOT RUN if absent.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 1 month ago
- Free with an Agensi account
Permissions
No special permissions declared or detected