Skip to content

About

xAPI for customer and organization data

Topics

Resources

Stars

3 stars

Watchers

8 watching

Forks

Repository files navigation

Virto Commerce Profile Experience API (xProfile) Module

The xProfile module provides high performance search queries for customer and organization data.

Key features

Through xProfile, you can perform Create, Read, Update, and Delete (CRUD) operations with users, organizations, and contacts.

How It Works

Just like other xAPI modules, xProfile module resides on a website's or application's back end and is managed with queries. It enables efficiently creating, updating, and deleting various entity profiles.

Documentation

Configuration

Input Validation

The module includes server-side input validation to prevent stored XSS attacks. Validation is configurable via appsettings.json under FrontendSecurity:InputValidation:

{
  "FrontendSecurity": {
    "InputValidation": {
      "NameValidationPattern": "^[\\p{L}\\p{M}\\s'\\-\\.]+$",
      "OrganizationNameValidationPattern": "^[\\p{L}\\p{M}\\p{N}\\s'\\-\\.&#/,()]+$",
      "EnableNoHtmlTagsValidation": true,
      "EnableScriptInjectionValidation": true
    }
  }
}
Setting Default Description
NameValidationPattern ^[\p{L}\p{M}\s'\-\.]+$ Allow-list regex for person name fields (firstName, lastName, fullName). Permits Unicode letters, diacritics, spaces, apostrophes, hyphens, and dots. Set to empty string to disable.
OrganizationNameValidationPattern ^[\p{L}\p{M}\p{N}\s'\-\.&#/,()]+$ Allow-list regex for organization name fields. Additionally permits numbers, &, #, /, ,, (, ) for names like "3M", "AT&T", "H&M". Set to empty string to disable.
EnableNoHtmlTagsValidation true Rejects HTML tags (<...>) in non-name fields (username, phone, address lines, city). Set to false to disable.
EnableScriptInjectionValidation true Rejects script injection patterns (<script>, javascript:, vbscript:, data:text/html) in free-text fields (description). Set to false to disable.

MaxLength constraints are always enforced regardless of configuration.

Validation errors

createContact, updateContact, updateMemberAddresses, createOrganization, updateOrganization and updatePersonalData report rejected input as GraphQL errors, one per failed rule. The mutation returns null, and each error keeps the VALIDATION code and names the input field and the rule:

{
  "errors": [
    {
      "message": "'Last Name' contains invalid characters.",
      "locations": [{ "line": 2, "column": 3 }],
      "path": ["updateContact"],
      "extensions": {
        "code": "VALIDATION",
        "codes": ["VALIDATION"],
        "field": "lastName",
        "errorCode": "InvalidCharacters"
      }
    }
  ],
  "data": { "updateContact": null }
}
  • field is the path of the input field inside command, for example lastName, phones[0], addresses[1].firstName or personalData.firstName. updateContact and updateOrganization validate the saved member with the changes applied, so their errors can also name a saved field the request didn't send, such as a phone.
  • errorCode is the rule: InvalidCharacters (name patterns), HtmlTagsNotAllowed, UnsafeContent, InvalidEmail (email format), or a FluentValidation code such as NotEmptyValidator or MaximumLengthValidator.
  • message is in English. A client that shows the error to users should translate it by errorCode.

User accounts

updatePersonalData (the current user) and updateUser (the user's own account, or any account for an administrator) change the email with UserManager.SetEmailAsync: the new email is not confirmed, and the security stamp changes. A change of letter case only is saved as is and keeps the confirmation and the stamp. The Backoffice also resets the confirmation and ignores the letter case, but it keeps the old security stamp.

A new security stamp:

  • ends the Backoffice sessions of the user at their next validation (Authorization:SecurityStampValidationInterval) and the sign-ins waiting for a second factor;
  • invalidates the password reset and email confirmation links sent before the change;
  • doesn't end storefront sessions: access tokens don't carry the stamp, and the refresh token grant doesn't check it, so a refresh token keeps the session going.

References

License

Copyright (c) Virto Solutions LTD. All rights reserved.

This software is licensed under the Virto Commerce Open Software License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://virtocommerce.com/opensourcelicense.

Unless required by the applicable law or agreed to in written form, the software distributed under the License is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

About

xAPI for customer and organization data

Topics

Resources

Stars

3 stars

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors

Languages