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

@architect/functions

Package Overview
Dependencies
Maintainers
6
Versions
284
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@architect/functions - npm Package Compare versions

Comparing version 1.0.5 to 1.1.1

3

package.json
{
"name": "@architect/functions",
"version": "1.0.5",
"version": "1.1.1",
"description": "architect run commands",

@@ -24,2 +24,3 @@ "main": "index",

"cookie": "^0.3.1",
"cookie-signature": "^1.0.6",
"run-parallel": "^1.1.6",

@@ -26,0 +27,0 @@ "run-waterfall": "^1.1.3",

var cookie = require('cookie')
var _response = require('./_response')
var session = require('../session').client(process.env.SESSION_TABLE_NAME || 'arc-sessions')
var unsign = require('cookie-signature').unsign
var secret = process.env.ARC_APP_SECRET || process.env.ARC_APP_NAME || 'fallback'

@@ -25,5 +27,7 @@ module.exports = function arc(...fns) {

var sesh = jar.hasOwnProperty('_idx')
var exec = sesh? session.find : session.create
var params = sesh? jar._idx : {}
var valid = unsign(jar._idx || '', secret)
var exec = sesh && valid? session.find : session.create
var params = sesh && valid? valid : {}
exec(params, function _find(err, payload) {

@@ -30,0 +34,0 @@ if (err) {

var session = require('../session').client(process.env.SESSION_TABLE_NAME || 'arc-sessions')
var cookie = require('cookie')
var sign = require('cookie-signature').sign
var secret = process.env.ARC_APP_SECRET || process.env.ARC_APP_NAME || 'fallback'

@@ -34,3 +36,3 @@ module.exports = function response(request, callback, cmds) {

var maxAge = Date.now() + 7.884e+11
cmds.cookie = cookie.serialize('_idx', request._idx, {
cmds.cookie = cookie.serialize('_idx', sign(request._idx, secret), {
maxAge,

@@ -37,0 +39,0 @@ expires: new Date(maxAge),

var cookie = require('cookie')
var _response = require('./_response')
var session = require('../session').client(process.env.SESSION_TABLE_NAME || 'arc-sessions')
var unsign = require('cookie-signature').unsign
var secret = process.env.ARC_APP_SECRET || process.env.ARC_APP_NAME || 'fallback'

@@ -25,5 +27,7 @@ module.exports = function arc(...fns) {

var sesh = jar.hasOwnProperty('_idx')
var exec = sesh? session.find : session.create
var params = sesh? jar._idx : {}
var valid = unsign(jar._idx || '', secret)
var exec = sesh && valid? session.find : session.create
var params = sesh && valid? valid : {}
exec(params, function _find(err, payload) {

@@ -30,0 +34,0 @@ if (err) {

var session = require('../session').client(process.env.SESSION_TABLE_NAME || 'arc-sessions')
var cookie = require('cookie')
var sign = require('cookie-signature').sign
var secret = process.env.ARC_APP_SECRET || process.env.ARC_APP_NAME || 'fallback'

@@ -34,3 +36,3 @@ module.exports = function response(request, callback, cmds) {

var maxAge = Date.now() + 7.884e+11
cmds.cookie = cookie.serialize('_idx', request._idx, {
cmds.cookie = cookie.serialize('_idx', sign(request._idx, secret), {
maxAge,

@@ -37,0 +39,0 @@ expires: new Date(maxAge),

@@ -5,2 +5,3 @@ var test = require('tape')

var arc = require('../')
var cookie = require('cookie')

@@ -148,3 +149,4 @@ test('env', t=> {

console.log('response', response)
_idx = response.session._idx
_idx = cookie.parse(response.cookie)._idx
console.log(_idx)
}

@@ -151,0 +153,0 @@ })

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