New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@percy/config

Package Overview
Dependencies
Maintainers
0
Versions
269
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@percy/config - npm Package Compare versions

Comparing version 1.30.8-beta.1 to 1.30.8

8

dist/defaults.js

@@ -1,2 +0,2 @@

import { merge } from './utils/index.js';
import { merge, sanitizeObject } from './utils/index.js';
import { getSchema } from './validate.js';

@@ -33,3 +33,7 @@ const {

export function getDefaults(overrides = {}) {
return merge([getDefaultsFromSchema(), overrides], (path, prev, next) => {
// We are sanitizing the overrides object to prevent prototype pollution.
// This ensures protection against attacks where a payload having Object.prototype setters
// to add or modify properties on the global prototype chain, which could lead to issues like denial of service (DoS) at a minimum.
const sanitizedOverrides = sanitizeObject(overrides);
return merge([getDefaultsFromSchema(), sanitizedOverrides], (path, prev, next) => {
// override default array instead of merging

@@ -36,0 +40,0 @@ return isArray(next) && [path, next];

import merge from './merge.js';
import { getSchema } from '../validate.js';
const {
isArray
} = Array;

@@ -10,2 +13,5 @@ // Edge case camelizations

// Unsafe keys list
const UNSAFE_KEYS = ['__proto__', 'constructor', 'prototype', 'toString', 'valueOf', '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__'];
// Converts kebab-cased and snake_cased strings to camelCase.

@@ -57,2 +63,22 @@ export function camelcase(str) {

}
// Utility function to prevent prototype pollution
export function isSafeKey(key) {
return !UNSAFE_KEYS.includes(key);
}
export function sanitizeObject(obj) {
if (!obj || typeof obj !== 'object' || isArray(obj)) {
return obj;
}
if (obj instanceof RegExp) {
return obj;
}
const sanitized = {};
for (const key in obj) {
if (isSafeKey(key)) {
sanitized[key] = sanitizeObject(obj[key]);
}
}
return sanitized;
}
export default normalize;
{
"name": "@percy/config",
"version": "1.30.8-beta.1",
"version": "1.30.8",
"license": "MIT",

@@ -12,3 +12,3 @@ "repository": {

"access": "public",
"tag": "beta"
"tag": "latest"
},

@@ -42,3 +42,3 @@ "engines": {

"dependencies": {
"@percy/logger": "1.30.8-beta.1",
"@percy/logger": "1.30.8",
"ajv": "^8.6.2",

@@ -51,3 +51,3 @@ "cosmiconfig": "^8.0.0",

},
"gitHead": "db04f87e6074b48cc3940ccffbefe59407016cf6"
"gitHead": "daa3c96d70488a49671e48427c9b363c68876935"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc