Skip to content

🛡️ Sentinel: [HIGH] Fix Stored XSS vulnerability in deck links#94

Open
google-labs-jules[bot] wants to merge 1 commit intomainfrom
sentinel-fix-deck-link-xss-10403101528358354258
Open

🛡️ Sentinel: [HIGH] Fix Stored XSS vulnerability in deck links#94
google-labs-jules[bot] wants to merge 1 commit intomainfrom
sentinel-fix-deck-link-xss-10403101528358354258

Conversation

@google-labs-jules
Copy link
Contributor

🚨 Severity: HIGH

💡 Vulnerability: Stored Cross-Site Scripting (XSS)

When creating a deck using the manual deckText and deckLink flow, the deckLink was not validated to ensure it contained a safe URI scheme. The provided string was directly stored in the database.

In the frontend, this stored link was rendered directly into an <a> tag's href attribute in frontend/src/pages/Home.tsx and frontend/src/components/DeckShowcase.tsx. An attacker could provide a malicious deckLink such as javascript:alert(document.cookie) which would execute JavaScript in the victim's browser when they clicked "View source" or the deck link icon.

🎯 Impact

If exploited, this vulnerability could allow an attacker to execute arbitrary JavaScript in the context of another user's session, potentially leading to session hijacking, unauthorized actions on behalf of the user, or data exfiltration.

🔧 Fix

Added a validation check in api/app/api/decks/route.ts using a regex test link.match(/^https?:\/\//i) right before deck creation. If a user provides a deckLink that does not start with http:// or https://, the API will now reject the request with a 400 Bad Request response, preventing the malicious payload from being stored.

✅ Verification

  • Verified by running npm test:unit in the api workspace to ensure no regressions were introduced.
  • Evaluated the API endpoints manually against malicious inputs to ensure correct behavior.
  • Successfully built the application.

PR created automatically by Jules for task 10403101528358354258 started by @TytaniumDev

Added a validation check in the `api/app/api/decks/route.ts` file to ensure that all deck links use either the `http://` or `https://` schemes before being stored.

This prevents Stored Cross-Site Scripting (XSS) where an attacker could provide a malicious `javascript:` URL during manual deck text import, which would then be rendered as a clickable link in the frontend `DeckShowcase` component.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review - Approved

No issues found. Checked for bugs, security issues, and CLAUDE.md compliance.

The added URL scheme validation (/^https?:\/\//i) correctly guards the text-based deck import path against non-HTTP(S) values being stored as the link field (e.g., javascript:, file://, data:). The check is a no-op for the URL-based path since Moxfield/Archidekt/ManaBox URLs are already pattern-validated before link is assigned. Regex and control flow are correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant