Skip to content

fix(web): stop rendering a URL-supplied message on the access-denied page - #33

Merged
somaraj merged 1 commit into
developfrom
fix/project-access-denied-message
Dec 1, 2026
Merged

somaraj merged 1 commit into
developfrom
fix/project-access-denied-message

Conversation

@somaraj

@somaraj somaraj commented Dec 1, 2026

Copy link
Copy Markdown
Member

What and why

The "project access denied" page took the whole error message from the message query parameter and rendered it with Html.Raw. Anyone could send a signed-in user a link like /Common/ProjectAccessDenied?message=<script>…</script> and the markup would run on a Taskist page (reflected XSS).

Now only the project name is passed (?project=…). The page builds the message from the Error.ProjectAccessDenied translation and HTML-encodes the project name before inserting it. The text users see is unchanged.

  • BaseController.ProjectAccessDenied(projectName) redirects with project instead of a pre-built message.
  • CommonController.ProjectAccessDenied(project) formats the localized template with the encoded name.
  • BacklogController.Edit passes entity.Project.Name.

How it was tested

  • dotnet build src/Taskist.sln and dotnet test src/Taskist.sln pass.
  • Opening a task from a project you're not a member of shows the usual message with the project name.
  • /Common/ProjectAccessDenied?project=<b>x</b> shows the tags as plain text instead of rendering them.

Checklist

  • dotnet build src/Taskist.sln and dotnet test src/Taskist.sln pass
  • Entity changes come with an EF migration, and the migration is additive (no dropped columns, no rewritten data) (n/a)
  • New UI text is added to sql-scripts/03_locale.sql (n/a, uses the existing Error.ProjectAccessDenied)
  • New menu entries or permissions are added to sql-scripts/02_defaults.sql (n/a)
  • No inline scripts or styles, no CDN links, no ViewBag/ViewData, no comments in .cs files
  • New dependencies are MIT, Apache or BSD licensed (n/a)
  • This touches authentication, authorization, file uploads, outbound HTTP or query building: it removes an HTML-injection path on an error page (see above)

🤖 Generated with Claude Code

@somaraj
somaraj force-pushed the fix/project-access-denied-message branch from 73391d0 to 5b287bf Compare December 1, 2026 19:52
@sonarqubecloud

sonarqubecloud Bot commented Dec 1, 2026

Copy link
Copy Markdown

@somaraj
somaraj merged commit e0551fd into develop Dec 1, 2026
4 checks passed
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