Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-sec-patterns

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-sec-patterns - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

38

lib/mintable.js

@@ -198,17 +198,31 @@ 'use strict'

void ((() => {
const getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors
? Object.getOwnPropertyDescriptors
// Minimal polyfill for node@6
: (obj) => {
const out = Object.create(null)
Object.getOwnPropertyNames(obj).forEach(
(name) => {
out[name] = Object.getOwnPropertyDescriptor(obj, name)
})
return out
}
[ Function, RegExp, String ].forEach((builtin) => {
const proto = builtin.prototype
const descriptors = Object.getOwnPropertyDescriptors(proto)
Object.entries(descriptors).forEach(
([ propertyName, descriptor ]) => {
if (descriptor.configurable) {
descriptor.configurable = false
if ('writable' in descriptor) {
descriptor.writable = false
}
} else if (descriptor.writable) {
throw new Error(
`Cannot lock down ${builtin.name}.prototype.${propertyName}`)
const descriptors = getOwnPropertyDescriptors(proto)
for (const propertyName in descriptors) {
if (!Object.hasOwnProperty.call(descriptors, propertyName)) {
continue
}
const descriptor = descriptors[propertyName]
if (descriptor.configurable) {
descriptor.configurable = false
if ('writable' in descriptor) {
descriptor.writable = false
}
})
} else if (descriptor.writable) {
throw new Error(
`Cannot lock down ${builtin.name}.prototype.${propertyName}`)
}
}
defineProperties(proto, descriptors)

@@ -215,0 +229,0 @@ })

{
"name": "node-sec-patterns",
"description": "Allow projects control over which dependencies can create objects that encapsulate security guarantees.",
"version": "1.0.1",
"version": "1.0.2",
"keywords": [

@@ -6,0 +6,0 @@ "design-patterns",

@@ -6,2 +6,6 @@ # Node security design patterns

[![Build Status](https://travis-ci.org/mikesamuel/node-sec-patterns.svg?branch=master)](https://travis-ci.org/mikesamuel/node-sec-patterns)
[![Dependencies Status](https://david-dm.org/mikesamuel/node-sec-patterns/status.svg)](https://david-dm.org/mikesamuel/node-sec-patterns)
[![npm](https://img.shields.io/npm/v/node-sec-patterns.svg)](https://www.npmjs.com/package/node-sec-patterns)
## Goal

@@ -8,0 +12,0 @@ Make it easier for project teams to produce code that preserves

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