lemonldap-ng-handler 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/handlerDevOps.d.ts +1 -1
- package/lib/handlerMain.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/init.d.ts +2 -2
- package/package.json +5 -5
package/lib/handlerDevOps.d.ts
CHANGED
package/lib/handlerMain.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { LLNG_Session } from '@lemonldap-ng/types';
|
|
|
3
3
|
import HandlerInit from './init';
|
|
4
4
|
import express from 'express';
|
|
5
5
|
import http from 'http';
|
|
6
|
-
export
|
|
6
|
+
export type FastCGI_Opts = {
|
|
7
7
|
mode: string | undefined;
|
|
8
8
|
port: number | undefined;
|
|
9
9
|
ip: string | undefined;
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@lemonldap-ng/conf"),e=require("@lemonldap-ng/session"),o=require("@lemonldap-ng/safelib"),s=require("@lemonldap-ng/logger"),r=require("vm"),i=require("re2"),n=require("http");function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}function c(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(o){if("default"!==o){var s=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:function(){return t[o]}})}})),e.default=t,Object.freeze(e)}var h=a(t),l=a(e),d=a(o),u=a(s),p=a(r),f=a(i),v=a(n);const g=new f.default("^logout(?:_sso|_app|_app_sso|)(?:s+(.*))?$","i");let m=0;const w=["cda","cookieExpiration","cipher","cookieName","customFunctions","httpOnly","securedCookie","timeout","timeoutActivity","useRedirectOnError","useRedirectOnForbidden","whatToTrace","loopBackUrl"];const y=(t,e)=>e.some((e=>e instanceof RegExp?e.test(t):e===t));function b(t,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},t=t.trim(),/^data:/i.test(t))return((t,{stripHash:e})=>{const o=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(t);if(!o)throw new Error(`Invalid URL: ${t}`);let{type:s,data:r,hash:i}=o.groups;const n=s.split(";");i=e?"":i;let a=!1;"base64"===n[n.length-1]&&(n.pop(),a=!0);const c=(n.shift()||"").toLowerCase(),h=[...n.map((t=>{let[e,o=""]=t.split("=").map((t=>t.trim()));return"charset"===e&&(o=o.toLowerCase(),"us-ascii"===o)?"":`${e}${o?`=${o}`:""}`})).filter(Boolean)];return a&&h.push("base64"),(h.length>0||c&&"text/plain"!==c)&&h.unshift(c),`data:${h.join(";")},${a?r.trim():r}${i?`#${i}`:""}`})(t,e);if(/^view-source:/i.test(t))throw new Error("`view-source:` is not supported as it is a non-standard protocol");const o=t.startsWith("//");!o&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));const s=new URL(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&"https:"===s.protocol&&(s.protocol="http:"),e.forceHttps&&"http:"===s.protocol&&(s.protocol="https:"),e.stripAuthentication&&(s.username="",s.password=""),e.stripHash?s.hash="":e.stripTextFragment&&(s.hash=s.hash.replace(/#?:~:text.*?$/i,"")),s.pathname){const t=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let e=0,o="";for(;;){const r=t.exec(s.pathname);if(!r)break;const i=r[0],n=r.index;o+=s.pathname.slice(e,n).replace(/\/{2,}/g,"/"),o+=i,e=n+i.length}o+=s.pathname.slice(e,s.pathname.length).replace(/\/{2,}/g,"/"),s.pathname=o}if(s.pathname)try{s.pathname=decodeURI(s.pathname)}catch{}if(!0===e.removeDirectoryIndex&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let t=s.pathname.split("/");const o=t[t.length-1];y(o,e.removeDirectoryIndex)&&(t=t.slice(0,-1),s.pathname=t.slice(1).join("/")+"/")}if(s.hostname&&(s.hostname=s.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(s.hostname)&&(s.hostname=s.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(const t of[...s.searchParams.keys()])y(t,e.removeQueryParameters)&&s.searchParams.delete(t);if(!0===e.removeQueryParameters&&(s.search=""),e.sortQueryParameters){s.searchParams.sort();try{s.search=decodeURIComponent(s.search)}catch{}}e.removeTrailingSlash&&(s.pathname=s.pathname.replace(/\/$/,""));const r=t;return t=s.toString(),e.removeSingleSlash||"/"!==s.pathname||r.endsWith("/")||""!==s.hash||(t=t.replace(/\/$/,"")),(e.removeTrailingSlash||"/"===s.pathname)&&""===s.hash&&e.removeSingleSlash&&(t=t.replace(/\/$/,"")),o&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t}class $ extends class{constructor(t){this.safe={},this.tsv={defaultCondition:{},defaultProtection:{},forgeHeaders:{},headerList:{},https:{},locationCondition:{},locationCount:{},locationProtection:{},locationRegexp:{},maintenance:{},port:{},portal:()=>"",vhostAlias:{}},this.localConf=t,t.configStorage||(t.configStorage={}),t.configStorage.localStorage||(t.configStorage.localStorage=t.localStorage),t.configStorage.localStorageOptions||(t.configStorage.localStorageOptions=t.localStorageOptions),this.confAcc=new h.default(t.configStorage);if([this.confAcc.getLocalConf("handler",!0),this.confAcc.getLocalConf("node-handler",!1)].forEach((t=>{Object.keys(t).forEach((e=>{if(!this.localConf)throw new Error("undef");void 0===this.localConf[e]&&(this.localConf[e]=t[e])}))})),void 0===this.localConf.nodeVhosts)throw new Error("No Virtualhosts configured for Node.js");this.vhostList=this.localConf.nodeVhosts.split(/[,\s]+/)}reload(){return new Promise(((t,e)=>{this.confAcc.ready.then((()=>{this.confAcc.getConf({}).then((e=>{if(w.forEach((t=>{this.tsv[t]=e[t]})),Object.keys(this.localConf).forEach((t=>{e[t]=this.localConf[t]})),["https","port","maintenance"].forEach((t=>{if(void 0!==e[t]&&(this.tsv[t]={_:e[t]},e.vhostOptions)){const s=`vhost${o=t,o.charAt(0).toUpperCase()+o.slice(1)}`;Object.keys(e.vhostOptions).forEach((o=>{const r=e.vhostOptions[o][s];r>0&&(this.tsv[t][o]=r)}))}var o})),!e.portal)throw new Error("portal should be defined");if(this.tsv.portal=()=>e.portal,!e.globalStorage||!e.globalStorageOptions)throw new Error("Missing session storage configuration");try{this.sessionAcc=new l.default({storageModule:e.globalStorage,storageModuleOptions:e.globalStorageOptions})}catch(t){throw new Error(`Unable to load session module: ${t}`)}Object.keys(e.locationRules).forEach((t=>{if(-1==this.vhostList.indexOf(t))return;this.tsv.locationCount[t]=0,["locationRegexp","locationProtection","locationCondition"].forEach((e=>{void 0===this.tsv[e][t]&&(this.tsv[e][t]=[])})),this.safe[t]||(this.safe[t]=new d.default(e));const o=e.locationRules[t];Object.keys(o).forEach((e=>{const[s,r]=this.conditionSub(o[e],this.safe[t]);"default"===e?(this.tsv.defaultCondition[t]=s,this.tsv.defaultProtection[t]=r):(this.tsv.locationCondition[t].push(s),this.tsv.locationProtection[t].push(r),this.tsv.locationRegexp[t].push(new f.default(e.replace(/\(\?#.*?\)/,""))),this.tsv.locationCount[t]++)})),this.tsv.defaultCondition[t]||(this.tsv.defaultCondition[t]=()=>!0,this.tsv.defaultProtection[t]=0)})),void 0!==e.exportedHeaders&&Object.keys(e.exportedHeaders).forEach((t=>{const o=e.exportedHeaders[t];if(-1==this.vhostList.indexOf(t))return;this.tsv.headerList[t]||(this.tsv.headerList[t]=[]);let s="";Object.keys(o).forEach((e=>{this.tsv.headerList[t].push(e),s+=`'${e}': ${this.substitute(o[e])},`})),s=s.replace(/,$/,""),p.default.runInContext(`fg = function(session) {return {${s}};}`,this.safe[t]),this.tsv.forgeHeaders[t]=this.safe[t].fg})),void 0!==e.vhostOptions&&Object.keys(e.vhostOptions).forEach((t=>{e.vhostOptions[t].aliases&&e.vhostOptions[t].aliases.forEach((e=>{this.tsv.vhostAlias[e]=t}))})),this.tsv.cookieDetect=new f.default(`\\b${this.tsv.cookieName}=([^;]+)`),this.sessionAcc.ready.then((()=>{t(!0),u.default(e,!0).then((e=>{this.userLogger=e,t(!0)})).catch((t=>{throw console.error("Logger error",t),new Error(t)}))}))})).catch((t=>{e(`Unable to get configuration: ${t}`)}))}))}))}conditionSub(t,e){const o=()=>!0;if("accept"===t)return[o,0];if("deny"===t)return[()=>!1,0];if("unprotect"===t)return[o,1];if("skip"===t)return[o,2];const s=g.exec(t);if(s&&s[1]){const t=s[1];return t?[e=>(e._logout=t,!1),0]:[t=>(t._logout=this.tsv.portal(),!1),0]}if(t=this.substitute(t),e)return m++,p.default.runInContext(`sub${m.toString()} = function(req,session) {return (${t});}`,e),[e[`sub${m.toString()}`],0];throw new Error("Disabling safeJail is not supported")}substitute(t){return t.replace(/\$date\b/g,"this.date()").replace(/\$vhost\b/g,"this.hostname(req)").replace(/\$ip\b/g,"this.remote_ip(req)").replace(/\$(_*[a-zA-Z]\w*)/g,"session.$1")}}{init(){return this.reload()}run(t,e,o){const s=t.headers.host;if(void 0===s)return this.userLogger.error("Request without Host header"),void this.setError(e,"/",400,"Bad request");const r=new URL(b(s+t.url)).pathname||"/";if(this.tsv.maintenance[s])return this.setError(e,"/",503,"Service Temporarily Unavailable");if(2===this.isUnprotected(t,r))return o();const i=this.fetchId(t);""!==i?this.retrieveSession(i).then((i=>{const n=i[this.tsv.whatToTrace];this.userLogger.debug(`User ${n} identified`),this.grant(t,r,i).then((a=>{a?(this.sendHeaders(t,i),this.hideCookie(t),o(),this.userLogger.info(`${s}: user ${n} was granted access to ${r}`)):(this.forbidden(t,e,i),this.userLogger.notice(`${s}: user ${n} was denied access to ${r}`))})).catch((t=>{console.error(t),this.setError(e,"/",503,"Service Unavailable")}))})).catch((t=>{this.goToPortal(e,this.selfUri(s,r))})):this.goToPortal(e,this.selfUri(s,r))}selfUri(t,e){return(this.tsv.https&&this.tsv.https[t]?"https":"http")+"://"+t+e}nginxServer(t){t.mode||(t.mode="fcgi"),t.port||(t.port=9090),t.ip||(t.ip="localhost");("fcgi"===t.mode?require("node-fastcgi"):v.default).createServer(((t,e)=>{this.run(t,e,(()=>{e.writeHead(200,t.headers)}))})).listen(t.port,t.ip)}setError(t,e,o,s){if(this.tsv.useRedirectOnError){const e=this.tsv.portal()+`?lmError=${o.toString()}&url=`;t.redirect?t.redirect(e):t.writeHead(401,{Location:e})}else t.redirect?t.status(o).send(s):t.writeHead(o,s)}isUnprotected(t,e){const o=this.resolveAlias(t);if(!this.tsv.defaultCondition[o])return!1;for(let t=0;t<this.tsv.locationRegexp[o].length;t++)if(this.tsv.locationRegexp[o][t].test(e))return this.tsv.locationProtection[o][t];return this.tsv.defaultProtection[o]}resolveAlias(t){const e=t.headers.host.replace(/:.*$/,"");return this.tsv.vhostAlias[e]||e}fetchId(t){if(t.headers.cookie){const e=this.tsv.cookieDetect.exec(t.headers.cookie);if(e&&"0"!=e[1])return e[1]}return""}retrieveSession(t){return new Promise(((e,o)=>{if(void 0===this.sessionAcc)return o("Server not ready, please wait");this.sessionAcc.get(t).then((s=>{const r=Date.now()/1e3|0;r-s._utime>this.tsv.timeout||this.tsv.timeoutActivity&&s._lastSeen&&r-s._lastSeen>this.tsv.timeoutActivity?o(`Session ${t} expired`):(this.tsv.timeoutActivity&&r-s._lastSeen>60&&(s._lastSeen=r,this.sessionAcc.update(s)),e(s))})).catch((e=>{o(`Session ${t} can't be found in store: ${e}`)}))}))}grant(t,e,o){return new Promise(((s,r)=>{const i=this.resolveAlias(t);if(!this.tsv.defaultCondition[i])return r(`No configuration found for ${i} (or not listed in Node.js virtualHosts)`);if(this.tsv.locationRegexp[i]){let r=0;this.tsv.locationRegexp[i].forEach((n=>{if(n.test(e))return s(this.tsv.locationCondition[i][r](t,o));r++}))}this.tsv.defaultCondition[i](t,o)?s(!0):r("Unauthorized")}))}sendHeaders(t,e){const o=this.resolveAlias(t);try{let s=0;t.headers["Lm-Remote-User"]=e[this.tsv.whatToTrace];const r=this.tsv.forgeHeaders[o](e);Object.keys(r).forEach((e=>{s++,t.headers[e]=r[e],t.rawHeaders.push(e,r[e]),t.redirect||(t.headers[`Headername${s}`]=e,t.headers[`Headervalue${s}`]=r[e])}))}catch(t){return void console.error(`Headers maybe not sent: ${t}`)}}hideCookie(t){t.headers.cookie&&(t.headers.cookie=t.headers.cookie.replace(this.tsv.cookieDetect,""))}forbidden(t,e,o){o._logout?this.goToPortal(e,o._logout,"logout=1"):this.setError(e,"/",403,"Forbidden")}goToPortal(t,e,o=""){if("function"!=typeof this.tsv.portal)return void this.setError(t,e,503,"Waiting for configuration");const s=this.tsv.portal()+(e?"?url="+new Buffer.from(encodeURI(e)).toString("base64"):"")+(o?(e?"&":"?")+o:"");t.redirect?t.redirect(s):t.writeHead(401,{Location:s})}}class x extends ${constructor(t){super(t),this.tsv.lastVhostUpdate={}}grant(t,e,o){const s=this.resolveAlias(t);if(this.tsv.defaultCondition[s]&&Date.now()/1e3-this.tsv.lastVhostUpdate[s]<600)return super.grant(t,e,o);const r=t.cgiParams&&t.cgiParams.RULES_URL?t.cgiParams.RULES_URL:(this.tsv.loopBackUrl||"http://127.0.0.1")+"/rules.json";if(!/^(https?):\/\/([^/:]+)(?::(\d+))?(.*)$/.test(r))return new Promise(((t,e)=>e(`Bad loopBackUrl ${r}`)));const i={prot:RegExp.$1,host:RegExp.$2,path:RegExp.$4,port:RegExp.$3||("https"==RegExp.$1?"443":"80"),lb:!(t.cgiParams&&t.cgiParams.RULES_URL)};return new Promise(((r,n)=>{this.loadVhostConfig(t,s,i).then((()=>{this.grant(t,e,o).then((t=>{r(t)})).catch((t=>n(t)))})).catch((s=>{console.error(s),this.grant(t,e,o).then((t=>{r(t)})).catch((t=>n(t)))}))}))}loadVhostConfig(t,e,o){return new Promise(((t,s)=>{o.lb||(e=o.host),delete o.lb,o.headers={Host:e};const r=require(o.prot);delete o.prot;const i=r.request(o,(o=>{let r="";o.on("data",(t=>{r+=t})),o.on("end",(()=>{if(this.tsv.locationCondition[e]=[],this.tsv.locationProtection[e]=[],this.tsv.locationRegexp[e]=[],this.tsv.locationCount[e]=0,this.tsv.headerList[e]=[],""===r)return this.tsv.defaultCondition[e]=()=>!0,this.tsv.defaultProtection[e]=0,this.tsv.lastVhostUpdate[e]=Date.now()/1e3,t(!0);try{const o=JSON.parse(r);if(this.safe[e]=new d.default({cipher:this.tsv.cipher}),o.rules&&"object"==typeof o.rules&&(Object.keys(o.rules).forEach((t=>{const s=new String(o.rules[t]).valueOf();let r,i;[r,i]=this.conditionSub(s,this.safe[e]),"default"===t?(this.tsv.defaultCondition[e]=r,this.tsv.defaultProtection[e]=i):(this.tsv.locationCondition[e].push(r),this.tsv.locationProtection[e].push(i),this.tsv.locationRegexp[e].push(new f.default(t.replace(/\(\?#.*?\)/,""))),this.tsv.locationCount[e]++)})),this.tsv.defaultCondition[e]||(this.tsv.defaultCondition[e]=()=>!0,this.tsv.defaultProtection[e]=0)),o.headers&&"object"==typeof o.headers){const t=Object.keys(o.headers).map((t=>(this.tsv.headerList[e].push(t),`'${t}': ${this.substitute(o.headers[t])}`))).join(",");p.default.runInContext(`fg = function(session) {return {${t}}}`,this.safe[e]),this.tsv.forgeHeaders[e]=this.safe[e].fg}this.tsv.lastVhostUpdate[e]=Date.now()/1e3,t(!0)}catch(t){s("Unable to getremote config: "+t)}})),i.on("error",(t=>{s(t)})),i.end()}))}))}}class S extends ${fetchId(t){const e=t.cgiParams?t.cgiParams.HTTP_X_LLNG_TOKEN:t.headers["x-llng-token"];if(e){let o;try{o=this.tsv.cipher.decrypt(e).split(":")}catch(t){return this.userLogger.error("Invalid token"),""}if(!o[2])return this.userLogger.error("Bad service token"),"";const s=Date.now()/1e3,r=parseInt(o[0]);if(r<s-30||r>s)return this.userLogger.warn("Expired service token"),"";const i=this.resolveAlias(t);return o.indexOf(i)<2?(console.warn(`${i} not authorizated in token`),""):o[1]}return super.fetchId(t)}}let P;exports.class=void 0;const E={Main:$,DevOps:x,ServiceToken:S,ServiceTokenST:class extends x{fetchId(t){return S.prototype.fetchId.call(this,t)}}};exports.init=t=>new Promise(((e,o)=>{var s;t.type||(t.type="Main"),E[t.type]?(exports.class=E[t.type],P=new E[t.type](t),P.init().then((()=>e(P))).catch((t=>o(t)))):(s="@lemonldap-ng/handler-"+t.type.toLowerCase(),Promise.resolve().then((function(){return c(require(s))}))).then((o=>{exports.class=o.default,P=new exports.class(t),P.init().then((()=>e(P)))})).catch((t=>o(t)))})),exports.nginxServer=t=>{P.nginxServer(t)},exports.run=(t,e,o)=>P.run(t,e,o);
|
|
1
|
+
"use strict";var t=require("@lemonldap-ng/conf"),e=require("@lemonldap-ng/session"),s=require("@lemonldap-ng/safelib"),o=require("@lemonldap-ng/logger"),r=require("vm"),i=require("re2"),n=require("http");const a=new i("^logout(?:_sso|_app|_app_sso|)(?:s+(.*))?$","i");let c=0;const h=["cda","cookieExpiration","cipher","cookieName","customFunctions","httpOnly","securedCookie","timeout","timeoutActivity","useRedirectOnError","useRedirectOnForbidden","whatToTrace","loopBackUrl"];class l{constructor(e){this.safe={},this.tsv={defaultCondition:{},defaultProtection:{},forgeHeaders:{},headerList:{},https:{},locationCondition:{},locationCount:{},locationProtection:{},locationRegexp:{},maintenance:{},port:{},portal:()=>"",vhostAlias:{}},this.localConf=e,e.configStorage||(e.configStorage={}),e.configStorage.localStorage||(e.configStorage.localStorage=e.localStorage),e.configStorage.localStorageOptions||(e.configStorage.localStorageOptions=e.localStorageOptions),this.confAcc=new t(e.configStorage);if([this.confAcc.getLocalConf("handler",!0),this.confAcc.getLocalConf("node-handler",!1)].forEach((t=>{Object.keys(t).forEach((e=>{if(!this.localConf)throw new Error("undef");void 0===this.localConf[e]&&(this.localConf[e]=t[e])}))})),void 0===this.localConf.nodeVhosts)throw new Error("No Virtualhosts configured for Node.js");this.vhostList=this.localConf.nodeVhosts.split(/[,\s]+/)}reload(){return new Promise(((t,n)=>{this.confAcc.ready.then((()=>{this.confAcc.getConf({}).then((n=>{if(h.forEach((t=>{this.tsv[t]=n[t]})),Object.keys(this.localConf).forEach((t=>{n[t]=this.localConf[t]})),["https","port","maintenance"].forEach((t=>{if(void 0!==n[t]&&(this.tsv[t]={_:n[t]},n.vhostOptions)){const s=`vhost${e=t,e.charAt(0).toUpperCase()+e.slice(1)}`;Object.keys(n.vhostOptions).forEach((e=>{const o=n.vhostOptions[e][s];o>0&&(this.tsv[t][e]=o)}))}var e})),!n.portal)throw new Error("portal should be defined");if(this.tsv.portal=()=>n.portal,!n.globalStorage||!n.globalStorageOptions)throw new Error("Missing session storage configuration");try{this.sessionAcc=new e({storageModule:n.globalStorage,storageModuleOptions:n.globalStorageOptions})}catch(t){throw new Error(`Unable to load session module: ${t}`)}Object.keys(n.locationRules).forEach((t=>{if(-1==this.vhostList.indexOf(t))return;this.tsv.locationCount[t]=0,["locationRegexp","locationProtection","locationCondition"].forEach((e=>{void 0===this.tsv[e][t]&&(this.tsv[e][t]=[])})),this.safe[t]||(this.safe[t]=new s(n));const e=n.locationRules[t];Object.keys(e).forEach((s=>{const[o,r]=this.conditionSub(e[s],this.safe[t]);"default"===s?(this.tsv.defaultCondition[t]=o,this.tsv.defaultProtection[t]=r):(this.tsv.locationCondition[t].push(o),this.tsv.locationProtection[t].push(r),this.tsv.locationRegexp[t].push(new i(s.replace(/\(\?#.*?\)/,""))),this.tsv.locationCount[t]++)})),this.tsv.defaultCondition[t]||(this.tsv.defaultCondition[t]=()=>!0,this.tsv.defaultProtection[t]=0)})),void 0!==n.exportedHeaders&&Object.keys(n.exportedHeaders).forEach((t=>{const e=n.exportedHeaders[t];if(-1==this.vhostList.indexOf(t))return;this.tsv.headerList[t]||(this.tsv.headerList[t]=[]);let s="";Object.keys(e).forEach((o=>{this.tsv.headerList[t].push(o),s+=`'${o}': ${this.substitute(e[o])},`})),s=s.replace(/,$/,""),r.runInContext(`fg = function(session) {return {${s}};}`,this.safe[t]),this.tsv.forgeHeaders[t]=this.safe[t].fg})),void 0!==n.vhostOptions&&Object.keys(n.vhostOptions).forEach((t=>{n.vhostOptions[t].aliases&&n.vhostOptions[t].aliases.forEach((e=>{this.tsv.vhostAlias[e]=t}))})),this.tsv.cookieDetect=new i(`\\b${this.tsv.cookieName}=([^;]+)`),this.sessionAcc.ready.then((()=>{t(!0),o(n,!0).then((e=>{this.userLogger=e,t(!0)})).catch((t=>{throw console.error("Logger error",t),new Error(t)}))}))})).catch((t=>{n(`Unable to get configuration: ${t}`)}))}))}))}conditionSub(t,e){const s=()=>!0;if("accept"===t)return[s,0];if("deny"===t)return[()=>!1,0];if("unprotect"===t)return[s,1];if("skip"===t)return[s,2];const o=a.exec(t);if(o&&o[1]){const t=o[1];return t?[e=>(e._logout=t,!1),0]:[t=>(t._logout=this.tsv.portal(),!1),0]}if(t=this.substitute(t),e)return c++,r.runInContext(`sub${c.toString()} = function(req,session) {return (${t});}`,e),[e[`sub${c.toString()}`],0];throw new Error("Disabling safeJail is not supported")}substitute(t){return t.replace(/\$date\b/g,"this.date()").replace(/\$vhost\b/g,"this.hostname(req)").replace(/\$ip\b/g,"this.remote_ip(req)").replace(/\$(_*[a-zA-Z]\w*)/g,"session.$1")}}const d=(t,e)=>e.some((e=>e instanceof RegExp?e.test(t):e===t));function p(t,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,removeExplicitPort:!1,sortQueryParameters:!0,...e},t=t.trim(),/^data:/i.test(t))return((t,{stripHash:e})=>{const s=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(t);if(!s)throw new Error(`Invalid URL: ${t}`);let{type:o,data:r,hash:i}=s.groups;const n=o.split(";");i=e?"":i;let a=!1;"base64"===n[n.length-1]&&(n.pop(),a=!0);const c=(n.shift()||"").toLowerCase(),h=[...n.map((t=>{let[e,s=""]=t.split("=").map((t=>t.trim()));return"charset"===e&&(s=s.toLowerCase(),"us-ascii"===s)?"":`${e}${s?`=${s}`:""}`})).filter(Boolean)];return a&&h.push("base64"),(h.length>0||c&&"text/plain"!==c)&&h.unshift(c),`data:${h.join(";")},${a?r.trim():r}${i?`#${i}`:""}`})(t,e);if(/^view-source:/i.test(t))throw new Error("`view-source:` is not supported as it is a non-standard protocol");const s=t.startsWith("//");!s&&/^\.*\//.test(t)||(t=t.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));const o=new URL(t);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&"https:"===o.protocol&&(o.protocol="http:"),e.forceHttps&&"http:"===o.protocol&&(o.protocol="https:"),e.stripAuthentication&&(o.username="",o.password=""),e.stripHash?o.hash="":e.stripTextFragment&&(o.hash=o.hash.replace(/#?:~:text.*?$/i,"")),o.pathname){const t=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g;let e=0,s="";for(;;){const r=t.exec(o.pathname);if(!r)break;const i=r[0],n=r.index;s+=o.pathname.slice(e,n).replace(/\/{2,}/g,"/"),s+=i,e=n+i.length}s+=o.pathname.slice(e,o.pathname.length).replace(/\/{2,}/g,"/"),o.pathname=s}if(o.pathname)try{o.pathname=decodeURI(o.pathname)}catch{}if(!0===e.removeDirectoryIndex&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let t=o.pathname.split("/");const s=t[t.length-1];d(s,e.removeDirectoryIndex)&&(t=t.slice(0,-1),o.pathname=t.slice(1).join("/")+"/")}if(o.hostname&&(o.hostname=o.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(o.hostname)&&(o.hostname=o.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(const t of[...o.searchParams.keys()])d(t,e.removeQueryParameters)&&o.searchParams.delete(t);if(Array.isArray(e.keepQueryParameters)||!0!==e.removeQueryParameters||(o.search=""),Array.isArray(e.keepQueryParameters)&&e.keepQueryParameters.length>0)for(const t of[...o.searchParams.keys()])d(t,e.keepQueryParameters)||o.searchParams.delete(t);if(e.sortQueryParameters){o.searchParams.sort();try{o.search=decodeURIComponent(o.search)}catch{}}e.removeTrailingSlash&&(o.pathname=o.pathname.replace(/\/$/,"")),e.removeExplicitPort&&o.port&&(o.port="");const r=t;return t=o.toString(),e.removeSingleSlash||"/"!==o.pathname||r.endsWith("/")||""!==o.hash||(t=t.replace(/\/$/,"")),(e.removeTrailingSlash||"/"===o.pathname)&&""===o.hash&&e.removeSingleSlash&&(t=t.replace(/\/$/,"")),s&&!e.normalizeProtocol&&(t=t.replace(/^http:\/\//,"//")),e.stripProtocol&&(t=t.replace(/^(?:https?:)?\/\//,"")),t}class u extends l{init(){return this.reload()}run(t,e,s){const o=t.headers.host;if(void 0===o)return this.userLogger.error("Request without Host header"),void this.setError(e,"/",400,"Bad request");const r=new URL(p(o+t.url)).pathname||"/";if(this.tsv.maintenance[o])return this.setError(e,"/",503,"Service Temporarily Unavailable");if(2===this.isUnprotected(t,r))return s();const i=this.fetchId(t);""!==i?this.retrieveSession(i).then((i=>{const n=i[this.tsv.whatToTrace];this.userLogger.debug(`User ${n} identified`),this.grant(t,r,i).then((a=>{a?(this.sendHeaders(t,i),this.hideCookie(t),s(),this.userLogger.info(`${o}: user ${n} was granted access to ${r}`)):(this.forbidden(t,e,i),this.userLogger.notice(`${o}: user ${n} was denied access to ${r}`))})).catch((t=>{console.error(t),this.setError(e,"/",503,"Service Unavailable")}))})).catch((t=>{this.goToPortal(e,this.selfUri(o,r))})):this.goToPortal(e,this.selfUri(o,r))}selfUri(t,e){return(this.tsv.https&&this.tsv.https[t]?"https":"http")+"://"+t+e}nginxServer(t){t.mode||(t.mode="fcgi"),t.port||(t.port=9090),t.ip||(t.ip="localhost");("fcgi"===t.mode?require("node-fastcgi"):n).createServer(((t,e)=>{this.run(t,e,(()=>{e.writeHead(200,t.headers)}))})).listen(t.port,t.ip)}setError(t,e,s,o){if(this.tsv.useRedirectOnError){const e=this.tsv.portal()+`?lmError=${s.toString()}&url=`;t.redirect?t.redirect(e):t.writeHead(401,{Location:e})}else t.redirect?t.status(s).send(o):t.writeHead(s,o)}isUnprotected(t,e){const s=this.resolveAlias(t);if(!this.tsv.defaultCondition[s])return!1;for(let t=0;t<this.tsv.locationRegexp[s].length;t++)if(this.tsv.locationRegexp[s][t].test(e))return this.tsv.locationProtection[s][t];return this.tsv.defaultProtection[s]}resolveAlias(t){const e=t.headers.host.replace(/:.*$/,"");return this.tsv.vhostAlias[e]||e}fetchId(t){if(t.headers.cookie){const e=this.tsv.cookieDetect.exec(t.headers.cookie);if(e&&"0"!=e[1])return e[1]}return""}retrieveSession(t){return new Promise(((e,s)=>{if(void 0===this.sessionAcc)return s("Server not ready, please wait");this.sessionAcc.get(t).then((o=>{const r=Date.now()/1e3|0;r-o._utime>this.tsv.timeout||this.tsv.timeoutActivity&&o._lastSeen&&r-o._lastSeen>this.tsv.timeoutActivity?s(`Session ${t} expired`):(this.tsv.timeoutActivity&&r-o._lastSeen>60&&(o._lastSeen=r,this.sessionAcc.update(o)),e(o))})).catch((e=>{s(`Session ${t} can't be found in store: ${e}`)}))}))}grant(t,e,s){return new Promise(((o,r)=>{const i=this.resolveAlias(t);if(!this.tsv.defaultCondition[i])return r(`No configuration found for ${i} (or not listed in Node.js virtualHosts)`);if(this.tsv.locationRegexp[i]){let r=0;this.tsv.locationRegexp[i].forEach((n=>{if(n.test(e))return o(this.tsv.locationCondition[i][r](t,s));r++}))}this.tsv.defaultCondition[i](t,s)?o(!0):r("Unauthorized")}))}sendHeaders(t,e){const s=this.resolveAlias(t);try{let o=0;t.headers["Lm-Remote-User"]=e[this.tsv.whatToTrace];const r=this.tsv.forgeHeaders[s](e);Object.keys(r).forEach((e=>{o++,t.headers[e]=r[e],t.rawHeaders.push(e,r[e]),t.redirect||(t.headers[`Headername${o}`]=e,t.headers[`Headervalue${o}`]=r[e])}))}catch(t){return void console.error(`Headers maybe not sent: ${t}`)}}hideCookie(t){t.headers.cookie&&(t.headers.cookie=t.headers.cookie.replace(this.tsv.cookieDetect,""))}forbidden(t,e,s){s._logout?this.goToPortal(e,s._logout,"logout=1"):this.setError(e,"/",403,"Forbidden")}goToPortal(t,e,s=""){if("function"!=typeof this.tsv.portal)return void this.setError(t,e,503,"Waiting for configuration");const o=this.tsv.portal()+(e?"?url="+new Buffer.from(encodeURI(e)).toString("base64"):"")+(s?(e?"&":"?")+s:"");t.redirect?t.redirect(o):t.writeHead(401,{Location:o})}}class f extends u{constructor(t){super(t),this.tsv.lastVhostUpdate={}}grant(t,e,s){const o=this.resolveAlias(t);if(this.tsv.defaultCondition[o]&&Date.now()/1e3-this.tsv.lastVhostUpdate[o]<600)return super.grant(t,e,s);const r=t.cgiParams&&t.cgiParams.RULES_URL?t.cgiParams.RULES_URL:(this.tsv.loopBackUrl||"http://127.0.0.1")+"/rules.json";if(!/^(https?):\/\/([^/:]+)(?::(\d+))?(.*)$/.test(r))return new Promise(((t,e)=>e(`Bad loopBackUrl ${r}`)));const i={prot:RegExp.$1,host:RegExp.$2,path:RegExp.$4,port:RegExp.$3||("https"==RegExp.$1?"443":"80"),lb:!(t.cgiParams&&t.cgiParams.RULES_URL)};return new Promise(((r,n)=>{this.loadVhostConfig(t,o,i).then((()=>{this.grant(t,e,s).then((t=>{r(t)})).catch((t=>n(t)))})).catch((o=>{console.error(o),this.grant(t,e,s).then((t=>{r(t)})).catch((t=>n(t)))}))}))}loadVhostConfig(t,e,o){return new Promise(((t,n)=>{o.lb||(e=o.host),delete o.lb,o.headers={Host:e};const a=require(o.prot);delete o.prot;const c=a.request(o,(o=>{let a="";o.on("data",(t=>{a+=t})),o.on("end",(()=>{if(this.tsv.locationCondition[e]=[],this.tsv.locationProtection[e]=[],this.tsv.locationRegexp[e]=[],this.tsv.locationCount[e]=0,this.tsv.headerList[e]=[],""===a)return this.tsv.defaultCondition[e]=()=>!0,this.tsv.defaultProtection[e]=0,this.tsv.lastVhostUpdate[e]=Date.now()/1e3,t(!0);try{const o=JSON.parse(a);if(this.safe[e]=new s({cipher:this.tsv.cipher}),o.rules&&"object"==typeof o.rules&&(Object.keys(o.rules).forEach((t=>{const s=new String(o.rules[t]).valueOf();let r,n;[r,n]=this.conditionSub(s,this.safe[e]),"default"===t?(this.tsv.defaultCondition[e]=r,this.tsv.defaultProtection[e]=n):(this.tsv.locationCondition[e].push(r),this.tsv.locationProtection[e].push(n),this.tsv.locationRegexp[e].push(new i(t.replace(/\(\?#.*?\)/,""))),this.tsv.locationCount[e]++)})),this.tsv.defaultCondition[e]||(this.tsv.defaultCondition[e]=()=>!0,this.tsv.defaultProtection[e]=0)),o.headers&&"object"==typeof o.headers){const t=Object.keys(o.headers).map((t=>(this.tsv.headerList[e].push(t),`'${t}': ${this.substitute(o.headers[t])}`))).join(",");r.runInContext(`fg = function(session) {return {${t}}}`,this.safe[e]),this.tsv.forgeHeaders[e]=this.safe[e].fg}this.tsv.lastVhostUpdate[e]=Date.now()/1e3,t(!0)}catch(t){n("Unable to getremote config: "+t)}})),c.on("error",(t=>{n(t)})),c.end()}))}))}}class g extends u{fetchId(t){const e=t.cgiParams?t.cgiParams.HTTP_X_LLNG_TOKEN:t.headers["x-llng-token"];if(e){let s;try{s=this.tsv.cipher.decrypt(e).split(":")}catch(t){return this.userLogger.error("Invalid token"),""}if(!s[2])return this.userLogger.error("Bad service token"),"";const o=Date.now()/1e3,r=parseInt(s[0]);if(r<o-30||r>o)return this.userLogger.warn("Expired service token"),"";const i=this.resolveAlias(t);return s.indexOf(i)<2?(console.warn(`${i} not authorizated in token`),""):s[1]}return super.fetchId(t)}}let v;exports.class=void 0;const m={Main:u,DevOps:f,ServiceToken:g,ServiceTokenST:class extends f{fetchId(t){return g.prototype.fetchId.call(this,t)}}};exports.init=t=>new Promise(((e,s)=>{t.type||(t.type="Main"),m[t.type]?(exports.class=m[t.type],v=new m[t.type](t),v.init().then((()=>e(v))).catch((t=>s(t)))):import("@lemonldap-ng/handler-"+t.type.toLowerCase()).then((s=>{exports.class=s.default,v=new exports.class(t),v.init().then((()=>e(v)))})).catch((t=>s(t)))})),exports.nginxServer=t=>{v.nginxServer(t)},exports.run=(t,e,s)=>v.run(t,e,s);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/init.ts","../../../node_modules/normalize-url/index.js","../src/handlerMain.ts","../src/handlerDevOps.ts","../src/handlerServiceToken.ts","../src/index.ts","../src/handlerDevOpsST.ts"],"sourcesContent":[null,"// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\nconst DATA_URL_DEFAULT_MIME_TYPE = 'text/plain';\nconst DATA_URL_DEFAULT_CHARSET = 'us-ascii';\n\nconst testParameter = (name, filters) => filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name);\n\nconst normalizeDataURL = (urlString, {stripHash}) => {\n\tconst match = /^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(urlString);\n\n\tif (!match) {\n\t\tthrow new Error(`Invalid URL: ${urlString}`);\n\t}\n\n\tlet {type, data, hash} = match.groups;\n\tconst mediaType = type.split(';');\n\thash = stripHash ? '' : hash;\n\n\tlet isBase64 = false;\n\tif (mediaType[mediaType.length - 1] === 'base64') {\n\t\tmediaType.pop();\n\t\tisBase64 = true;\n\t}\n\n\t// Lowercase MIME type\n\tconst mimeType = (mediaType.shift() || '').toLowerCase();\n\tconst attributes = mediaType\n\t\t.map(attribute => {\n\t\t\tlet [key, value = ''] = attribute.split('=').map(string => string.trim());\n\n\t\t\t// Lowercase `charset`\n\t\t\tif (key === 'charset') {\n\t\t\t\tvalue = value.toLowerCase();\n\n\t\t\t\tif (value === DATA_URL_DEFAULT_CHARSET) {\n\t\t\t\t\treturn '';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn `${key}${value ? `=${value}` : ''}`;\n\t\t})\n\t\t.filter(Boolean);\n\n\tconst normalizedMediaType = [\n\t\t...attributes,\n\t];\n\n\tif (isBase64) {\n\t\tnormalizedMediaType.push('base64');\n\t}\n\n\tif (normalizedMediaType.length > 0 || (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE)) {\n\t\tnormalizedMediaType.unshift(mimeType);\n\t}\n\n\treturn `data:${normalizedMediaType.join(';')},${isBase64 ? data.trim() : data}${hash ? `#${hash}` : ''}`;\n};\n\nexport default function normalizeUrl(urlString, options) {\n\toptions = {\n\t\tdefaultProtocol: 'http:',\n\t\tnormalizeProtocol: true,\n\t\tforceHttp: false,\n\t\tforceHttps: false,\n\t\tstripAuthentication: true,\n\t\tstripHash: false,\n\t\tstripTextFragment: true,\n\t\tstripWWW: true,\n\t\tremoveQueryParameters: [/^utm_\\w+/i],\n\t\tremoveTrailingSlash: true,\n\t\tremoveSingleSlash: true,\n\t\tremoveDirectoryIndex: false,\n\t\tsortQueryParameters: true,\n\t\t...options,\n\t};\n\n\turlString = urlString.trim();\n\n\t// Data URL\n\tif (/^data:/i.test(urlString)) {\n\t\treturn normalizeDataURL(urlString, options);\n\t}\n\n\tif (/^view-source:/i.test(urlString)) {\n\t\tthrow new Error('`view-source:` is not supported as it is a non-standard protocol');\n\t}\n\n\tconst hasRelativeProtocol = urlString.startsWith('//');\n\tconst isRelativeUrl = !hasRelativeProtocol && /^\\.*\\//.test(urlString);\n\n\t// Prepend protocol\n\tif (!isRelativeUrl) {\n\t\turlString = urlString.replace(/^(?!(?:\\w+:)?\\/\\/)|^\\/\\//, options.defaultProtocol);\n\t}\n\n\tconst urlObject = new URL(urlString);\n\n\tif (options.forceHttp && options.forceHttps) {\n\t\tthrow new Error('The `forceHttp` and `forceHttps` options cannot be used together');\n\t}\n\n\tif (options.forceHttp && urlObject.protocol === 'https:') {\n\t\turlObject.protocol = 'http:';\n\t}\n\n\tif (options.forceHttps && urlObject.protocol === 'http:') {\n\t\turlObject.protocol = 'https:';\n\t}\n\n\t// Remove auth\n\tif (options.stripAuthentication) {\n\t\turlObject.username = '';\n\t\turlObject.password = '';\n\t}\n\n\t// Remove hash\n\tif (options.stripHash) {\n\t\turlObject.hash = '';\n\t} else if (options.stripTextFragment) {\n\t\turlObject.hash = urlObject.hash.replace(/#?:~:text.*?$/i, '');\n\t}\n\n\t// Remove duplicate slashes if not preceded by a protocol\n\t// NOTE: This could be implemented using a single negative lookbehind\n\t// regex, but we avoid that to maintain compatibility with older js engines\n\t// which do not have support for that feature.\n\tif (urlObject.pathname) {\n\t\t// TODO: Replace everything below with `urlObject.pathname = urlObject.pathname.replace(/(?<!\\b[a-z][a-z\\d+\\-.]{1,50}:)\\/{2,}/g, '/');` when Safari supports negative lookbehind.\n\n\t\t// Split the string by occurrences of this protocol regex, and perform\n\t\t// duplicate-slash replacement on the strings between those occurrences\n\t\t// (if any).\n\t\tconst protocolRegex = /\\b[a-z][a-z\\d+\\-.]{1,50}:\\/\\//g;\n\n\t\tlet lastIndex = 0;\n\t\tlet result = '';\n\t\tfor (;;) {\n\t\t\tconst match = protocolRegex.exec(urlObject.pathname);\n\t\t\tif (!match) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst protocol = match[0];\n\t\t\tconst protocolAtIndex = match.index;\n\t\t\tconst intermediate = urlObject.pathname.slice(lastIndex, protocolAtIndex);\n\n\t\t\tresult += intermediate.replace(/\\/{2,}/g, '/');\n\t\t\tresult += protocol;\n\t\t\tlastIndex = protocolAtIndex + protocol.length;\n\t\t}\n\n\t\tconst remnant = urlObject.pathname.slice(lastIndex, urlObject.pathname.length);\n\t\tresult += remnant.replace(/\\/{2,}/g, '/');\n\n\t\turlObject.pathname = result;\n\t}\n\n\t// Decode URI octets\n\tif (urlObject.pathname) {\n\t\ttry {\n\t\t\turlObject.pathname = decodeURI(urlObject.pathname);\n\t\t} catch {}\n\t}\n\n\t// Remove directory index\n\tif (options.removeDirectoryIndex === true) {\n\t\toptions.removeDirectoryIndex = [/^index\\.[a-z]+$/];\n\t}\n\n\tif (Array.isArray(options.removeDirectoryIndex) && options.removeDirectoryIndex.length > 0) {\n\t\tlet pathComponents = urlObject.pathname.split('/');\n\t\tconst lastComponent = pathComponents[pathComponents.length - 1];\n\n\t\tif (testParameter(lastComponent, options.removeDirectoryIndex)) {\n\t\t\tpathComponents = pathComponents.slice(0, -1);\n\t\t\turlObject.pathname = pathComponents.slice(1).join('/') + '/';\n\t\t}\n\t}\n\n\tif (urlObject.hostname) {\n\t\t// Remove trailing dot\n\t\turlObject.hostname = urlObject.hostname.replace(/\\.$/, '');\n\n\t\t// Remove `www.`\n\t\tif (options.stripWWW && /^www\\.(?!www\\.)[a-z\\-\\d]{1,63}\\.[a-z.\\-\\d]{2,63}$/.test(urlObject.hostname)) {\n\t\t\t// Each label should be max 63 at length (min: 1).\n\t\t\t// Source: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names\n\t\t\t// Each TLD should be up to 63 characters long (min: 2).\n\t\t\t// It is technically possible to have a single character TLD, but none currently exist.\n\t\t\turlObject.hostname = urlObject.hostname.replace(/^www\\./, '');\n\t\t}\n\t}\n\n\t// Remove query unwanted parameters\n\tif (Array.isArray(options.removeQueryParameters)) {\n\t\t// eslint-disable-next-line unicorn/no-useless-spread -- We are intentionally spreading to get a copy.\n\t\tfor (const key of [...urlObject.searchParams.keys()]) {\n\t\t\tif (testParameter(key, options.removeQueryParameters)) {\n\t\t\t\turlObject.searchParams.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (options.removeQueryParameters === true) {\n\t\turlObject.search = '';\n\t}\n\n\t// Sort query parameters\n\tif (options.sortQueryParameters) {\n\t\turlObject.searchParams.sort();\n\n\t\t// Calling `.sort()` encodes the search parameters, so we need to decode them again.\n\t\ttry {\n\t\t\turlObject.search = decodeURIComponent(urlObject.search);\n\t\t} catch {}\n\t}\n\n\tif (options.removeTrailingSlash) {\n\t\turlObject.pathname = urlObject.pathname.replace(/\\/$/, '');\n\t}\n\n\tconst oldUrlString = urlString;\n\n\t// Take advantage of many of the Node `url` normalizations\n\turlString = urlObject.toString();\n\n\tif (!options.removeSingleSlash && urlObject.pathname === '/' && !oldUrlString.endsWith('/') && urlObject.hash === '') {\n\t\turlString = urlString.replace(/\\/$/, '');\n\t}\n\n\t// Remove ending `/` unless removeSingleSlash is false\n\tif ((options.removeTrailingSlash || urlObject.pathname === '/') && urlObject.hash === '' && options.removeSingleSlash) {\n\t\turlString = urlString.replace(/\\/$/, '');\n\t}\n\n\t// Restore relative protocol, if applicable\n\tif (hasRelativeProtocol && !options.normalizeProtocol) {\n\t\turlString = urlString.replace(/^http:\\/\\//, '//');\n\t}\n\n\t// Remove http/https\n\tif (options.stripProtocol) {\n\t\turlString = urlString.replace(/^(?:https?:)?\\/\\//, '');\n\t}\n\n\treturn urlString;\n}\n",null,null,null,null,null],"names":["condMatch","RE2","sid","requiredFields","testParameter","name","filters","some","filter","RegExp","test","normalizeUrl","urlString","options","defaultProtocol","normalizeProtocol","forceHttp","forceHttps","stripAuthentication","stripHash","stripTextFragment","stripWWW","removeQueryParameters","removeTrailingSlash","removeSingleSlash","removeDirectoryIndex","sortQueryParameters","trim","match","exec","Error","type","data","hash","groups","mediaType","split","isBase64","length","pop","mimeType","shift","toLowerCase","normalizedMediaType","map","attribute","key","value","string","Boolean","push","unshift","join","normalizeDataURL","hasRelativeProtocol","startsWith","replace","urlObject","URL","protocol","username","password","pathname","protocolRegex","lastIndex","result","protocolAtIndex","index","slice","decodeURI","Array","isArray","pathComponents","lastComponent","hostname","searchParams","keys","delete","search","sort","decodeURIComponent","oldUrlString","toString","endsWith","stripProtocol","LemonldapNGHandler","constructor","args","this","safe","tsv","defaultCondition","defaultProtection","forgeHeaders","headerList","https","locationCondition","locationCount","locationProtection","locationRegexp","maintenance","port","portal","vhostAlias","localConf","configStorage","localStorage","localStorageOptions","confAcc","Conf","getLocalConf","forEach","iniSection","Object","k","undefined","nodeVhosts","vhostList","reload","Promise","resolve","reject","ready","then","getConf","conf","_","vhostOptions","s","charAt","toUpperCase","vhost","val","sessionAcc","Session","storageModule","storageModuleOptions","e","locationRules","indexOf","SafeLib","rules","url","cond","prot","conditionSub","exportedHeaders","headers","sub","substitute","vm","runInContext","fg","aliases","alias","cookieDetect","cookieName","Logger","logger","userLogger","catch","console","error","ctx","OK","res","session","_logout","expr","init","run","req","next","host","setError","uri","isUnprotected","id","fetchId","retrieveSession","user","whatToTrace","debug","grant","grantResult","sendHeaders","hideCookie","info","forbidden","notice","goToPortal","selfUri","nginxServer","fcgiOpt","mode","ip","require","http","createServer","writeHead","listen","code","txt","useRedirectOnError","redirect","Location","status","send","resolveAlias","i","cookie","get","now","Date","_utime","timeout","timeoutActivity","_lastSeen","update","regex","rawHeaders","urlc","Buffer","from","encodeURI","LemonldapNGHandlerDevOps","super","lastVhostUpdate","base","cgiParams","RULES_URL","loopBackUrl","lvOpts","$1","$2","path","$4","$3","lb","loadVhostConfig","err","Host","request","resp","str","on","chunk","vhostConfig","JSON","parse","cipher","rule","String","valueOf","end","LemonldapNGHandlerServiceToken","token","HTTP_X_LLNG_TOKEN","tokenElement","decrypt","tokenTime","parseInt","warn","currentHandler","currentClass","knownHandlers","Main","DevOps","ServiceToken","ServiceTokenST","prototype","call","t","_interopNamespace","mod","default"],"mappings":"+pBAeA,MAAMA,EAAY,IAA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KxD,MAAMwD,GACtDgL,EACG9F,OACA9C,MAAK,IAAMH,EAAQ+I,KACnBvG,OAAMvB,GAAKhB,EAAOgB,OAErBuI,EAAO,yBAA2BzL,EAAKxD,KAAKW,cAA5C6E,QAAAC,UAAAG,MAAA,WAAA,OAAAsJ,EAAA7E,QAAA4E,QACGrJ,MAAKuJ,IACJV,QAAY,MAAGU,EAAIC,QACnBZ,EAAiB,IAAIC,cAAajL,GAClCgL,EAAe9F,OAAO9C,MAAK,IAAMH,EAAQ+I,QAE1CvG,OAAMvB,GAAKhB,EAAOgB,4BAaClD,IAC1BgL,EAAevE,YAAYzG,gBATV,CACjBoF,EACAN,EACAO,IAEO2F,EAAe7F,IAAIC,EAAKN,EAAKO"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/init.ts","../../../node_modules/normalize-url/index.js","../src/handlerMain.ts","../src/handlerDevOps.ts","../src/handlerServiceToken.ts","../src/index.ts","../src/handlerDevOpsST.ts"],"sourcesContent":[null,"// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\nconst DATA_URL_DEFAULT_MIME_TYPE = 'text/plain';\nconst DATA_URL_DEFAULT_CHARSET = 'us-ascii';\n\nconst testParameter = (name, filters) => filters.some(filter => filter instanceof RegExp ? filter.test(name) : filter === name);\n\nconst normalizeDataURL = (urlString, {stripHash}) => {\n\tconst match = /^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(urlString);\n\n\tif (!match) {\n\t\tthrow new Error(`Invalid URL: ${urlString}`);\n\t}\n\n\tlet {type, data, hash} = match.groups;\n\tconst mediaType = type.split(';');\n\thash = stripHash ? '' : hash;\n\n\tlet isBase64 = false;\n\tif (mediaType[mediaType.length - 1] === 'base64') {\n\t\tmediaType.pop();\n\t\tisBase64 = true;\n\t}\n\n\t// Lowercase MIME type\n\tconst mimeType = (mediaType.shift() || '').toLowerCase();\n\tconst attributes = mediaType\n\t\t.map(attribute => {\n\t\t\tlet [key, value = ''] = attribute.split('=').map(string => string.trim());\n\n\t\t\t// Lowercase `charset`\n\t\t\tif (key === 'charset') {\n\t\t\t\tvalue = value.toLowerCase();\n\n\t\t\t\tif (value === DATA_URL_DEFAULT_CHARSET) {\n\t\t\t\t\treturn '';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn `${key}${value ? `=${value}` : ''}`;\n\t\t})\n\t\t.filter(Boolean);\n\n\tconst normalizedMediaType = [\n\t\t...attributes,\n\t];\n\n\tif (isBase64) {\n\t\tnormalizedMediaType.push('base64');\n\t}\n\n\tif (normalizedMediaType.length > 0 || (mimeType && mimeType !== DATA_URL_DEFAULT_MIME_TYPE)) {\n\t\tnormalizedMediaType.unshift(mimeType);\n\t}\n\n\treturn `data:${normalizedMediaType.join(';')},${isBase64 ? data.trim() : data}${hash ? `#${hash}` : ''}`;\n};\n\nexport default function normalizeUrl(urlString, options) {\n\toptions = {\n\t\tdefaultProtocol: 'http:',\n\t\tnormalizeProtocol: true,\n\t\tforceHttp: false,\n\t\tforceHttps: false,\n\t\tstripAuthentication: true,\n\t\tstripHash: false,\n\t\tstripTextFragment: true,\n\t\tstripWWW: true,\n\t\tremoveQueryParameters: [/^utm_\\w+/i],\n\t\tremoveTrailingSlash: true,\n\t\tremoveSingleSlash: true,\n\t\tremoveDirectoryIndex: false,\n\t\tremoveExplicitPort: false,\n\t\tsortQueryParameters: true,\n\t\t...options,\n\t};\n\n\turlString = urlString.trim();\n\n\t// Data URL\n\tif (/^data:/i.test(urlString)) {\n\t\treturn normalizeDataURL(urlString, options);\n\t}\n\n\tif (/^view-source:/i.test(urlString)) {\n\t\tthrow new Error('`view-source:` is not supported as it is a non-standard protocol');\n\t}\n\n\tconst hasRelativeProtocol = urlString.startsWith('//');\n\tconst isRelativeUrl = !hasRelativeProtocol && /^\\.*\\//.test(urlString);\n\n\t// Prepend protocol\n\tif (!isRelativeUrl) {\n\t\turlString = urlString.replace(/^(?!(?:\\w+:)?\\/\\/)|^\\/\\//, options.defaultProtocol);\n\t}\n\n\tconst urlObject = new URL(urlString);\n\n\tif (options.forceHttp && options.forceHttps) {\n\t\tthrow new Error('The `forceHttp` and `forceHttps` options cannot be used together');\n\t}\n\n\tif (options.forceHttp && urlObject.protocol === 'https:') {\n\t\turlObject.protocol = 'http:';\n\t}\n\n\tif (options.forceHttps && urlObject.protocol === 'http:') {\n\t\turlObject.protocol = 'https:';\n\t}\n\n\t// Remove auth\n\tif (options.stripAuthentication) {\n\t\turlObject.username = '';\n\t\turlObject.password = '';\n\t}\n\n\t// Remove hash\n\tif (options.stripHash) {\n\t\turlObject.hash = '';\n\t} else if (options.stripTextFragment) {\n\t\turlObject.hash = urlObject.hash.replace(/#?:~:text.*?$/i, '');\n\t}\n\n\t// Remove duplicate slashes if not preceded by a protocol\n\t// NOTE: This could be implemented using a single negative lookbehind\n\t// regex, but we avoid that to maintain compatibility with older js engines\n\t// which do not have support for that feature.\n\tif (urlObject.pathname) {\n\t\t// TODO: Replace everything below with `urlObject.pathname = urlObject.pathname.replace(/(?<!\\b[a-z][a-z\\d+\\-.]{1,50}:)\\/{2,}/g, '/');` when Safari supports negative lookbehind.\n\n\t\t// Split the string by occurrences of this protocol regex, and perform\n\t\t// duplicate-slash replacement on the strings between those occurrences\n\t\t// (if any).\n\t\tconst protocolRegex = /\\b[a-z][a-z\\d+\\-.]{1,50}:\\/\\//g;\n\n\t\tlet lastIndex = 0;\n\t\tlet result = '';\n\t\tfor (;;) {\n\t\t\tconst match = protocolRegex.exec(urlObject.pathname);\n\t\t\tif (!match) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst protocol = match[0];\n\t\t\tconst protocolAtIndex = match.index;\n\t\t\tconst intermediate = urlObject.pathname.slice(lastIndex, protocolAtIndex);\n\n\t\t\tresult += intermediate.replace(/\\/{2,}/g, '/');\n\t\t\tresult += protocol;\n\t\t\tlastIndex = protocolAtIndex + protocol.length;\n\t\t}\n\n\t\tconst remnant = urlObject.pathname.slice(lastIndex, urlObject.pathname.length);\n\t\tresult += remnant.replace(/\\/{2,}/g, '/');\n\n\t\turlObject.pathname = result;\n\t}\n\n\t// Decode URI octets\n\tif (urlObject.pathname) {\n\t\ttry {\n\t\t\turlObject.pathname = decodeURI(urlObject.pathname);\n\t\t} catch {}\n\t}\n\n\t// Remove directory index\n\tif (options.removeDirectoryIndex === true) {\n\t\toptions.removeDirectoryIndex = [/^index\\.[a-z]+$/];\n\t}\n\n\tif (Array.isArray(options.removeDirectoryIndex) && options.removeDirectoryIndex.length > 0) {\n\t\tlet pathComponents = urlObject.pathname.split('/');\n\t\tconst lastComponent = pathComponents[pathComponents.length - 1];\n\n\t\tif (testParameter(lastComponent, options.removeDirectoryIndex)) {\n\t\t\tpathComponents = pathComponents.slice(0, -1);\n\t\t\turlObject.pathname = pathComponents.slice(1).join('/') + '/';\n\t\t}\n\t}\n\n\tif (urlObject.hostname) {\n\t\t// Remove trailing dot\n\t\turlObject.hostname = urlObject.hostname.replace(/\\.$/, '');\n\n\t\t// Remove `www.`\n\t\tif (options.stripWWW && /^www\\.(?!www\\.)[a-z\\-\\d]{1,63}\\.[a-z.\\-\\d]{2,63}$/.test(urlObject.hostname)) {\n\t\t\t// Each label should be max 63 at length (min: 1).\n\t\t\t// Source: https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_host_names\n\t\t\t// Each TLD should be up to 63 characters long (min: 2).\n\t\t\t// It is technically possible to have a single character TLD, but none currently exist.\n\t\t\turlObject.hostname = urlObject.hostname.replace(/^www\\./, '');\n\t\t}\n\t}\n\n\t// Remove query unwanted parameters\n\tif (Array.isArray(options.removeQueryParameters)) {\n\t\t// eslint-disable-next-line unicorn/no-useless-spread -- We are intentionally spreading to get a copy.\n\t\tfor (const key of [...urlObject.searchParams.keys()]) {\n\t\t\tif (testParameter(key, options.removeQueryParameters)) {\n\t\t\t\turlObject.searchParams.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!Array.isArray(options.keepQueryParameters) && options.removeQueryParameters === true) {\n\t\turlObject.search = '';\n\t}\n\n\t// Keep wanted query parameters\n\tif (Array.isArray(options.keepQueryParameters) && options.keepQueryParameters.length > 0) {\n\t\t// eslint-disable-next-line unicorn/no-useless-spread -- We are intentionally spreading to get a copy.\n\t\tfor (const key of [...urlObject.searchParams.keys()]) {\n\t\t\tif (!testParameter(key, options.keepQueryParameters)) {\n\t\t\t\turlObject.searchParams.delete(key);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Sort query parameters\n\tif (options.sortQueryParameters) {\n\t\turlObject.searchParams.sort();\n\n\t\t// Calling `.sort()` encodes the search parameters, so we need to decode them again.\n\t\ttry {\n\t\t\turlObject.search = decodeURIComponent(urlObject.search);\n\t\t} catch {}\n\t}\n\n\tif (options.removeTrailingSlash) {\n\t\turlObject.pathname = urlObject.pathname.replace(/\\/$/, '');\n\t}\n\n\t// Remove an explicit port number, excluding a default port number, if applicable\n\tif (options.removeExplicitPort && urlObject.port) {\n\t\turlObject.port = '';\n\t}\n\n\tconst oldUrlString = urlString;\n\n\t// Take advantage of many of the Node `url` normalizations\n\turlString = urlObject.toString();\n\n\tif (!options.removeSingleSlash && urlObject.pathname === '/' && !oldUrlString.endsWith('/') && urlObject.hash === '') {\n\t\turlString = urlString.replace(/\\/$/, '');\n\t}\n\n\t// Remove ending `/` unless removeSingleSlash is false\n\tif ((options.removeTrailingSlash || urlObject.pathname === '/') && urlObject.hash === '' && options.removeSingleSlash) {\n\t\turlString = urlString.replace(/\\/$/, '');\n\t}\n\n\t// Restore relative protocol, if applicable\n\tif (hasRelativeProtocol && !options.normalizeProtocol) {\n\t\turlString = urlString.replace(/^http:\\/\\//, '//');\n\t}\n\n\t// Remove http/https\n\tif (options.stripProtocol) {\n\t\turlString = urlString.replace(/^(?:https?:)?\\/\\//, '');\n\t}\n\n\treturn urlString;\n}\n",null,null,null,null,null],"names":["condMatch","RE2","sid","requiredFields","HandlerInit","constructor","args","this","safe","tsv","defaultCondition","defaultProtection","forgeHeaders","headerList","https","locationCondition","locationCount","locationProtection","locationRegexp","maintenance","port","portal","vhostAlias","localConf","configStorage","localStorage","localStorageOptions","confAcc","Conf","getLocalConf","forEach","iniSection","Object","keys","k","Error","undefined","nodeVhosts","vhostList","split","reload","Promise","resolve","reject","ready","then","getConf","conf","_","vhostOptions","name","s","charAt","toUpperCase","slice","vhost","val","sessionAcc","Session","storageModule","storageModuleOptions","e","locationRules","indexOf","SafeLib","rules","url","cond","prot","conditionSub","push","replace","exportedHeaders","headers","sub","substitute","vm","runInContext","fg","aliases","alias","cookieDetect","cookieName","Logger","logger","userLogger","catch","console","error","ctx","OK","res","exec","session","_logout","toString","expr","testParameter","filters","some","filter","RegExp","test","normalizeUrl","urlString","options","defaultProtocol","normalizeProtocol","forceHttp","forceHttps","stripAuthentication","stripHash","stripTextFragment","stripWWW","removeQueryParameters","removeTrailingSlash","removeSingleSlash","removeDirectoryIndex","removeExplicitPort","sortQueryParameters","trim","match","type","data","hash","groups","mediaType","isBase64","length","pop","mimeType","shift","toLowerCase","normalizedMediaType","map","attribute","key","value","string","Boolean","unshift","join","normalizeDataURL","hasRelativeProtocol","startsWith","urlObject","URL","protocol","username","password","pathname","protocolRegex","lastIndex","result","protocolAtIndex","index","decodeURI","Array","isArray","pathComponents","lastComponent","hostname","searchParams","delete","keepQueryParameters","search","sort","decodeURIComponent","oldUrlString","endsWith","stripProtocol","LemonldapNGHandler","init","run","req","next","host","setError","uri","isUnprotected","id","fetchId","retrieveSession","user","whatToTrace","debug","grant","grantResult","sendHeaders","hideCookie","info","forbidden","notice","goToPortal","selfUri","nginxServer","fcgiOpt","mode","ip","require","http","createServer","writeHead","listen","code","txt","useRedirectOnError","redirect","Location","status","send","resolveAlias","i","cookie","get","now","Date","_utime","timeout","timeoutActivity","_lastSeen","update","regex","rawHeaders","urlc","Buffer","from","encodeURI","LemonldapNGHandlerDevOps","super","lastVhostUpdate","base","cgiParams","RULES_URL","loopBackUrl","lvOpts","$1","$2","path","$4","$3","lb","loadVhostConfig","err","Host","request","resp","str","on","chunk","vhostConfig","JSON","parse","cipher","rule","String","valueOf","end","LemonldapNGHandlerServiceToken","token","HTTP_X_LLNG_TOKEN","tokenElement","decrypt","tokenTime","parseInt","warn","currentHandler","currentClass","class","knownHandlers","Main","DevOps","ServiceToken","ServiceTokenST","prototype","call","import","mod","default"],"mappings":"4MAeA,MAAMA,EAAY,IAAIC,EAAI,6CAA8C,KAaxE,IAAIC,EAAM,EAEV,MAAMC,EAAiB,CACrB,MACA,mBACA,SACA,aACA,kBACA,WACA,gBACA,UACA,kBACA,qBACA,yBACA,cACA,eAGF,MAAeC,EAWb,WAAAC,CAAaC,GALbC,KAAIC,KAAiC,GAOnCD,KAAKE,IAAM,CACTC,iBAAkB,CAAE,EACpBC,kBAAmB,CAAE,EACrBC,aAAc,CAAE,EAChBC,WAAY,CAAE,EACdC,MAAO,CAAE,EACTC,kBAAmB,CAAE,EACrBC,cAAe,CAAE,EACjBC,mBAAoB,CAAE,EACtBC,eAAgB,CAAE,EAClBC,YAAa,CAAE,EACfC,KAAM,CAAE,EACRC,OAAQ,IAAM,GACdC,WAAY,CAAE,GAEhBf,KAAKgB,UAAYjB,EACZA,EAAKkB,gBAAelB,EAAKkB,cAAgB,IAC9ClB,EAAKkB,cAAcC,eAChBnB,EAAKkB,cAAcC,aAAenB,EAAKmB,cAC1CnB,EAAKkB,cAAcE,sBAChBpB,EAAKkB,cAAcE,oBAAsBpB,EAAKoB,qBACjDnB,KAAKoB,QAAU,IAAIC,EAAKtB,EAAKkB,eAW7B,GANC,CAJmBjB,KAAKoB,QAAQE,aAAa,WAAW,GAEvDtB,KAAKoB,QAAQE,aAAa,gBAAgB,IAEZC,SAAQC,IACtCC,OAAOC,KAAKF,GAAYD,SAASI,IAC/B,IAAK3B,KAAKgB,UAAW,MAAM,IAAIY,MAAM,cACXC,IAAtB7B,KAAKgB,UAAUW,KAAkB3B,KAAKgB,UAAUW,GAAKH,EAAWG,GAAE,GACtE,SAE8BE,IAA9B7B,K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KoH,MAAMpH,GACtDoQ,EACG9F,OACA/H,MAAK,IAAMH,EAAQgO,KACnBpL,OAAMzB,GAAKlB,EAAOkB,MAErBuN,OAAO,yBAA2B9Q,EAAKoH,KAAKU,eACzCvF,MAAKwO,IACJV,QAAYC,MAAGS,EAAIC,QACnBZ,EAAiB,IAAIC,cAAarQ,GAClCoQ,EAAe9F,OAAO/H,MAAK,IAAMH,EAAQgO,IAAgB,IAE1DpL,OAAMzB,GAAKlB,EAAOkB,IACtB,wBAYuBvD,IAC1BoQ,EAAevE,YAAY7L,EAAK,cATf,CACjBwK,EACAnF,EACAoF,IAEO2F,EAAe7F,IAAIC,EAAKnF,EAAKoF","x_google_ignoreList":[1]}
|
package/lib/init.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import Session from '@lemonldap-ng/session';
|
|
|
3
3
|
import SafeLib from '@lemonldap-ng/safelib';
|
|
4
4
|
import { LocalConf, LLNG_Logger } from '@lemonldap-ng/types';
|
|
5
5
|
import { TSV } from './tsv';
|
|
6
|
-
|
|
6
|
+
type handlerConf = LocalConf & {
|
|
7
7
|
nodeVhosts?: string;
|
|
8
8
|
[k: string]: any;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type Handler_Args = {
|
|
11
11
|
configStorage: LocalConf | undefined;
|
|
12
12
|
type: string | undefined;
|
|
13
13
|
[key: string]: string | number | boolean | object | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lemonldap-ng-handler",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "LemonLDAP::NG handler for Node.js",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib/index.mjs",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"*.md"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lemonldap-ng/conf": "^0.6.
|
|
27
|
-
"@lemonldap-ng/logger": "^0.6.
|
|
28
|
-
"@lemonldap-ng/session": "^0.6.
|
|
26
|
+
"@lemonldap-ng/conf": "^0.6.4",
|
|
27
|
+
"@lemonldap-ng/logger": "^0.6.4",
|
|
28
|
+
"@lemonldap-ng/session": "^0.6.4",
|
|
29
29
|
"node-fastcgi": "^1.3.3",
|
|
30
30
|
"normalize-url": "^7.0.3",
|
|
31
31
|
"re2": "^1.17.7"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"check": "tsc --noEmit",
|
|
56
56
|
"rollup": "rollup -c"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "e04792c3c38691938996391da5eb7a35f9335929"
|
|
59
59
|
}
|