CVE-2024-29181 (TypeScript, published 2024-06-12T15:15Z)
Description: value: Strapi is an open-source content management system. Prior to version 4.19.1, a super admin can create a collection where an item in the collection has an association to another collection. When this happens, another user with Author Role can see the list of associated items they did not create. They should see nothing but their own items they created not all items ever created. Users should upgrade @strapi/plugin-content-manager to version 4.19.1 to receive a patch.
Severity: nan (CVSS v3 base score: )
Weakness: NVD-CWE-noinfo \u2014 Insufficient Information
There is insufficient information about the issue to classify it; details are unkown or unspecified.
Repository: https://github.com/strapi/strapi
Files changed:
packages/core/content-type-builder/admin/src/components/FormModal/FormModal.tsx
packages/core/content-type-builder/admin/src/components/FormModal/component/createComponentSchema.ts
packages/core/content-type-builder/admin/src/components/FormModal/forms/forms.ts
packages/core/content-type-builder/admin/src/components/FormModal/forms/utils/createCollectionName.ts
packages/core/content-type-builder/server/src/services/schema-builder/component-builder.ts
Commit message: fix: Check component names against collectionTypeNames



Vulnerable code:
        ctbFormsAPI
          ctbFormsAPI
  category: string
          return !usedComponentNames.includes(name);
      return createComponentSchema(takenNames, reservedNames.models, componentCategory);

Fixed code:
        components,
        modifiedData.displayName || '',
        actionType === 'edit',
        components,
        modifiedData.componentToCreate.displayName || ''
          actionType === 'edit',
          components,
          modifiedData.componentToCreate.displayName || ''
  category: string,
  takenCollectionNames: Array<string>,
  currentCollectionName: string
          return (
            !usedComponentNames.includes(name) &&
            !takenCollectionNames.includes(currentCollectionName)
          );
import { createComponentCollectionName } from './utils/createCollectionName';
      components: Record<string, any>,
      componentDisplayName: string,
      const collectionNames = Object.values(components).map((component: any) => {
        return component?.schema?.collectionName;
      });

      const currentCollectionName = createComponentCollectionName(
        componentDisplayName,
        componentCategory
      );
      const takenCollectionNames = isEditing
        ? collectionNames.filter((collectionName) => collectionName !== currentCollectionName)
        : collectionNames;

      return createComponentSchema(
        takenNames,
        reservedNames.models,
        componentCategory,
        takenCollectionNames,
        currentCollectionName
      );
import { snakeCase } from 'lodash/fp';
import pluralize from 'pluralize';

// TODO: create a utility for this
// Duplicate in server/src/services/schema-builder/component-builder.ts
const createComponentCollectionName = (name: string, category: string) => {
  return `components_${snakeCase(category)}_${pluralize(snakeCase(name))}`;
};

export { createComponentCollectionName };
      // TODO: create a utility for this
      // Duplicate in admin/src/components/FormModal/forms/utils/createCollectionName.ts
      this.components.forEach((compo: any) => {
        if (compo.schema.collectionName === collectionName) {
          throw new ApplicationError('component.alreadyExists');
        }
      });