Repository: 4ian/GDevelop
File: GDJS/Runtime/pixi-renderers/pixi-bitmapfont-manager.ts (TypeScript)

Code before:
        logger.warn(
          'Unable to find bitmap font for resource "' + resourceName + '".'
        );
        return;
      }
      if (this._loadedFontsData.get(resource)) {
        return;
      }

      try {
        const response = await fetch(
          this._resourceLoader.getFullUrl(resource.file),
          {
            credentials: this._resourceLoader.checkIfCredentialsRequired(
              resource.file
            )
              ? // Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
                // i.e: its gdevelop.io cookie, to be passed.
                'include'
              : // For other resources, use "same-origin" as done by default by fetch.
                'same-origin',
          }
        );
        const fontDataRaw = await response.text();

        // Sanitize : remove the lines staring with #
        const sanitizedFontData = fontDataRaw
          .split('\n')
          .filter((line) => !line.trim().startsWith('#'))
          .join('\n');

        this._loadedFontsData.set(resource, sanitizedFontData);
      } catch (error) {
        logger.error(
          "Can't fetch the bitmap font file " +
            resource.file +
            ', error: ' +
            error
        );
      }
    }

    /**
     * To be called when the game is disposed.
     * Uninstall all the fonts from memory and clear cache of loaded fonts.
     */
    dispose(): void {
      for (const bitmapFontInstallKey in this._pixiBitmapFontsInUse) {
        PIXI.BitmapFont.uninstall(bitmapFontInstallKey);
      }


Review comment (security):
```suggestion
        // Sanitize: remove lines starting with # (acting as comments)
```

Code after:
        logger.warn(
          'Unable to find bitmap font for resource "' + resourceName + '".'
        );
        return;
      }
      if (this._loadedFontsData.get(resource)) {
        return;
      }

      try {
        const response = await fetch(
          this._resourceLoader.getFullUrl(resource.file),
          {
            credentials: this._resourceLoader.checkIfCredentialsRequired(
              resource.file
            )
              ? // Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
                // i.e: its gdevelop.io cookie, to be passed.
                'include'
              : // For other resources, use "same-origin" as done by default by fetch.
                'same-origin',
          }
        );
        const fontDataRaw = await response.text();

        // Sanitize: remove lines starting with # (acting as comments)
        const sanitizedFontData = fontDataRaw
          .split('\n')
          .filter((line) => !line.trim().startsWith('#'))
          .join('\n');

        this._loadedFontsData.set(resource, sanitizedFontData);
      } catch (error) {
        logger.error(
          "Can't fetch the bitmap font file " +
            resource.file +
            ', error: ' +
            error
        );
      }
    }

    /**
     * To be called when the game is disposed.
     * Uninstall all the fonts from memory and clear cache of loaded fonts.
     */
    dispose(): void {
      for (const bitmapFontInstallKey in this._pixiBitmapFontsInUse) {
        PIXI.BitmapFont.uninstall(bitmapFontInstallKey);
      }