Skip to content

[Security] Add input sanitization to prevent XSS attacks #13

Open

Description

@niat-web

Security Issue

What:
User inputs (todo title, description) should be
sanitized before being saved to the database
and before being displayed on screen.

Why this is important:
Without sanitization, a malicious user could
type JavaScript code in a todo title like:

<script>alert('hacked')</script>

If this gets stored and displayed without
sanitization, it could execute in other
users' browsers (XSS attack).

Expected behavior:

  • Strip or escape HTML tags from user inputs
  • Sanitize on both frontend AND backend
  • Display text as plain text, never as HTML

Technical implementation:
Backend: Use bleach library to sanitize inputs
Frontend: React already escapes by default
but verify no dangerouslySetInnerHTML is used

Acceptance Criteria:

  • HTML tags stripped from todo title
  • HTML tags stripped from todo description
  • Sanitization happens before saving to database
  • Existing todos with HTML tags handled safely

Activity

  1. added
    backend
    frontend
    security
    medium-priority
    on Jul 3, 2026
  2. suryaff733 commented on Oct 14, 2026

    @suryaff733

    Can I work on this?

    My approach:

    Backend: Add bleach to strip HTML in title/description before saving to DB
    Frontend: Verify no dangerouslySetInnerHTML usage

    Will submit a PR if this looks good

  3. anandmahadevv commented on Dec 1, 2026

    @anandmahadevv

    Working on this issue.

  4. Sidd7arth commented on Dec 5, 2026

    @Sidd7arth

    Hi @niat-web, I'd like to work on this too. I know there are already PRs (#18 and #56) and I don't want to add noise, so I'll only open mine if you're fine with another one.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendfrontendmedium-prioritysecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions