Skip to content

Security: theme-profiles:import derives profile name from filename, allowing a file named __proto__.json to pollute Object.prototype #119

@anshul23102

Description

@anshul23102

Describe the bug

In main.js, the profile name is derived directly from the filename of the imported file:

const profileName = path.basename(filePath, '.json');
const profiles = settingsStore.loadProfiles();
profiles[profileName] = sanitizedProfile; // key is filename-derived
settingsStore.saveProfiles(profiles);

Importing a file named __proto__.json executes profiles['__proto__'] = sanitizedProfile, which pollutes Object.prototype with all current visualizer settings properties. This affects every plain object in the main process for the rest of the session.

To Reproduce

  1. Create a file named __proto__.json with valid theme profile JSON.
  2. Use Paraline's Import Profile feature and select this file.
  3. Observe that Object.prototype is polluted with settings properties.

Expected behavior
The profile name should be validated to reject reserved JavaScript property names (__proto__, constructor, prototype) before being used as an object key.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions