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

jayli-server

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jayli-server - npm Package Compare versions

Comparing version 0.0.25 to 0.1.0

20

lib/chunk.js
// 'use strict';
var util = require('util');
var fs = require('fs');
var url = require('url');
var path = require('path');

@@ -10,2 +11,4 @@ var pwd = process.cwd();

var joinbuffers = require('joinbuffers');
var Entities = require('html-entities').AllHtmlEntities;
entities = new Entities();

@@ -43,4 +46,8 @@ var reg = '--#(chunk)(\\s([a-z]+)=[\'"](.+?)[\'"])*--';

var includefile = hasIncludes(content);
http.get(('http://'+includefile).replace(/^http:\/\/http:\/\//i,'http://'), function(res) {
var reqUrlObj = url.parse(('http://' + includefile).replace(/^http:\/\/http:\/\//i,'http://'), true);
http.get(Object.assign(reqUrlObj, {
headers: {
referer: 'http://m.taobao.com'
}
}), function(res) {
var buffs = [];

@@ -50,3 +57,10 @@ res.on('data',function(chunk){

}).on('end',function(){
var buff = joinbuffers(buffs);
var buff = joinbuffers(buffs);
if (/api\.alitrip\.com\/ems\/common/.test(includefile)) {
buff = buff.toString('utf-8');
buff = entities.decode(buff);
var fn = 'var ' + reqUrlObj.query.callback + '=function(v){return v;};' + buff;
var emsContent = eval(fn);
buff = emsContent.toString().replace(/^function\s*\(\)\{\/\*|\*\/\}$/mg, '');
}
var newchunk = content.replace(new RegExp(reg,'i'),parseChunk2String(buff));

@@ -53,0 +67,0 @@ callback(newchunk);

14

lib/xssi.js

@@ -11,2 +11,3 @@ /**

var fs = require('fs');
var url = require('url');
var pwd = process.cwd();

@@ -224,3 +225,3 @@ var path = require('path');

var i, len, ret, fileCont, incVars, absPath;
var incFile = ctx.incFile;
var incFile = decodeURIComponent(ctx.incFile);
var incProps = ctx.incProps;

@@ -314,3 +315,2 @@ var filePath = ctx.filePath;

var repReg = new RegExp((val_insert + '|' + include), 'g');
return cont.replace(repReg, function(m, expr, incProps){

@@ -348,3 +348,11 @@ var ctx = get_context({

cont = cont.replace(new RegExp(tms_include, 'ig'),function(matchPath, tmsPath, encoding, tmsdir){
return "<!--#include " + 'virtual="http://' + path.join(tmsPrefix, tmsPath) + '" -->';
// tmsPath: rgn/ems/alitrip-common/flight-onsale/entry
tmsPath = tmsPath.replace(/^\//, ''); // remove start `/`
if (/ems\/alitrip\-(common|flight|hotel|train|destination|member|ticket|travel)/.test(tmsPath)) {
// use miday interface
var tmsParts = /ems\/alitrip-([a-zA-Z0-9_]+)\/([^,]*)/g.exec(tmsPath);
var emsReqProxy = 'http://api.alitrip.com/ems/' + tmsParts[1] + '?charset=utf-8&callback=handle_tms_fragment_jayliserver&path=' + tmsParts[2];
return "<!--#include " + 'virtual="' + encodeURIComponent(emsReqProxy) + '" -->';
}
return "<!--#include " + 'virtual="http://' + url.resolve(tmsPrefix, tmsPath) + '" -->';
});

@@ -351,0 +359,0 @@

@@ -7,3 +7,3 @@ {

},
"version": "0.0.25",
"version": "0.1.0",
"description": "A node.js module for delivering static files,width ssi,mock and php",

@@ -19,2 +19,3 @@ "keywords": [

"dependencies": {
"html-entities": "^1.2.0",
"iconv-lite": "",

@@ -21,0 +22,0 @@ "joinbuffers": "~0.1.1",

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