Verify rsn fix

From juice-shop/juice-shop · View interactive version

Verify rsn fix is an AI agent skill from the GitHub repository juice-shop/juice-shop. Instructions for identifying and fixing broken RSN (Refactoring Safety Net) caused by code changes in vulnerability snippets.

How to use this skill

Skill file

Skill: Verifying and fixing RSN breaks

This skill provides instructions for identifying and fixing RSN (Refactoring Safety Net) breaks that occur when code is modified inside a // vuln-code-snippet block.

Repository Targets & Scope

Source-of-Truth & Data Handling Rules

Change Boundaries

Ambiguity & Unmappable Source Handling

What is RSN?

The RSN ensures that the code snippets shown in the application's coding challenges remain consistent with the actual source code. When a source file containing a // vuln-code-snippet block is modified, the Refactoring Safety Net between that snippet and its associated "codefix" files (used in the "Fix It" part of the challenge) might break.

Detection

To check if your changes have broken the RSN, run:

npm run rsn

IMPORTANT: If you modify any code inside a // vuln-code-snippet block (like chatbotGreedyInjectionChallenge or chatbotPromptInjectionChallenge), you MUST run this command to ensure consistency across the project.

If it reports "Refactoring Safety Net check failed", you have broken the RSN for one or more challenges. The output will list the affected codefix files with diffs.

How to Fix

DO NOT simply run npm run rsn:update unless you are absolutely sure the code change is intended to only affect the source file and not the coding challenge variations. Usually, a break means the codefix files are now out of sync and need manual adjustment.

1. Identify Affected Snippets

The npm run rsn output will list filenames like challengeName_1_correct.ts or challengeName_2.ts. These correspond to the snippet for challengeName.

2. Locate Source and Fix Files

3. Apply Clean Fixes

Update all data/static/codefixes/challengeName_*.ts files to reflect the changes you made in the source file's snippet block.

4. Verify

Run the RSN check again:

npm run rsn

If it passes with "All codefix files match the locked state", your fix is correct.

Verification Expectations

Note

For more details about code snippets, codefix files, and the RSN, see the OWASP Juice Shop Companion Guide.

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.