VCST-4691: Add InputValidationOptions to prevent HTML/XSS injections#130
VCST-4691: Add InputValidationOptions to prevent HTML/XSS injections#130
Conversation
…ctions feat: Adds InputValidationOptions to prevent from HTML/XSS injections by adding NameValidationPattern, toggle HTML tag rejection for non-name fields (username, phone, address fields), toggle broader script injection check for free-text fields (about, description, message).
src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/OrganizationValidator.cs
Show resolved
Hide resolved
vc-ci
left a comment
There was a problem hiding this comment.
Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.783
Timestamp: 13-03-2026T10:29:13
src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/FluentValidationExtensions.cs
Show resolved
Hide resolved
...oCommerce.ProfileExperienceApiModule.Tests/Handlers/UpdateOrganizationCommandHandlerTests.cs
Show resolved
Hide resolved
vc-ci
left a comment
There was a problem hiding this comment.
Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.825
Timestamp: 13-03-2026T10:41:09
src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/PersonalDataValidator.cs
Show resolved
Hide resolved
src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/NewContactValidator.cs
Show resolved
Hide resolved
vc-ci
left a comment
There was a problem hiding this comment.
Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.785
Timestamp: 17-03-2026T07:14:30
src/VirtoCommerce.ProfileExperienceApiModule.Data/Commands/UpdatePersonalDataCommandHandler.cs
Show resolved
Hide resolved
src/VirtoCommerce.ProfileExperienceApiModule.Data/Commands/UpdateContactCommandHandler.cs
Outdated
Show resolved
Hide resolved
vc-ci
left a comment
There was a problem hiding this comment.
Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 8.157
Timestamp: 17-03-2026T11:19:39
vc-ci
left a comment
There was a problem hiding this comment.
Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.91
Timestamp: 17-03-2026T11:36:51
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
src/VirtoCommerce.ProfileExperienceApiModule.Data/Validators/NewContactValidator.cs
Show resolved
Hide resolved
vc-ci
left a comment
There was a problem hiding this comment.
Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 8.363
Timestamp: 17-03-2026T12:44:41




Description
feat: Adds InputValidationOptions to prevent HTML/XSS injections by adding NameValidationPattern, toggles HTML tag rejection for non-name fields (username, phone, address fields), toggles broader script injection check for free-text fields (about, description, message).
The module includes server-side input validation to prevent stored XSS attacks. Validation is configurable via
appsettings.jsonunderFrontendSecurity:InputValidation:{ "FrontendSecurity": { "InputValidation": { "NameValidationPattern": "^[\\p{L}\\p{M}\\s'\\-\\.]+$", "OrganizationNameValidationPattern": "^[\\p{L}\\p{M}\\p{N}\\s'\\-\\.&#/,()]+$", "EnableNoHtmlTagsValidation": true, "EnableScriptInjectionValidation": true } } }NameValidationPattern^[\p{L}\p{M}\s'\-\.]+$OrganizationNameValidationPattern^[\p{L}\p{M}\p{N}\s'\-\.&#/,()]+$&,#,/,,,(,)for names like "3M", "AT&T", "H&M". Set to empty string to disable.EnableNoHtmlTagsValidationtrue<...>) in non-name fields (username, phone, address lines, city). Set tofalseto disable.EnableScriptInjectionValidationtrue<script>,javascript:,vbscript:,data:text/html) in free-text fields (description). Set tofalseto disable.References
QA-test:
Jira-link:
https://virtocommerce.atlassian.net/browse/VCST-4713
https://virtocommerce.atlassian.net/browse/VCST-4691
Artifact URL:
https://vc3prerelease.blob.core.windows.net/packages/VirtoCommerce.ProfileExperienceApiModule_3.1002.0-pr-130-9776.zip
Note
Medium Risk
Adds new validation rules that can cause previously accepted contact/org/account/address/registration inputs to be rejected, impacting user-facing flows if clients rely on permissive input. Behavior is configurable but now enforced by default on multiple command handlers.
Overview
Introduces configurable
InputValidationOptions(bound fromFrontendSecurity:InputValidation) to enforce allow-list name/org-name regexes, max lengths, and optional rejection of HTML tags and common script-injection patterns.Wires these FluentValidation checks into write paths (
CreateOrganization,UpdateOrganization,UpdateContact,UpdateMemberAddresses,UpdatePersonalData, andRegisterByInvitation) and adds dedicated validators + extension rules, with new unit tests and README documentation for configuration. Also suppresses a specific NuGet audit advisory (GHSA-rvv3-g6hj-g44x).Written by Cursor Bugbot for commit 9776e82. This will update automatically on new commits. Configure here.