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

@globocom/backstage-functions-sandbox

Package Overview
Dependencies
Maintainers
7
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@globocom/backstage-functions-sandbox - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

22

lib/Request.js

@@ -0,5 +1,25 @@

function filterHeaders(headers) {
const {
'sandbox-omit-headers': omitHeaders,
} = headers;
if (!omitHeaders) {
return headers;
}
const filteredHeaders = Object.assign({}, headers);
omitHeaders
.split(',')
.map(s => s.trim())
.forEach(x => delete filteredHeaders[x]);
return filteredHeaders;
}
class Request {
constructor({ method, headers, query, body }) {
this.method = method;
this.headers = headers;
this.headers = filterHeaders(headers || {});
this.query = query;

@@ -6,0 +26,0 @@ this.body = body;

2

package.json
{
"name": "@globocom/backstage-functions-sandbox",
"version": "0.4.0",
"version": "0.4.1",
"description": "Sandbox for Backstage functions",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -28,2 +28,23 @@ const expect = require('chai').expect;

});
describe('when pass a `sandbox-omit-headers` header', () => {
before(() => {
externalRequest = {
headers: {
host: 'localhost:3000',
accept: '*/*',
authorization: 'xpto',
'sandbox-omit-headers': 'authorization,host',
},
};
});
it('should skip related headers', () => {
const req = new Request(externalRequest);
expect(Object.keys(req.headers)).to.be.eql([
'accept',
'sandbox-omit-headers',
]);
});
});
});
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