lemonldap-ng-handler 0.7.0 → 0.7.3
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/CHANGELOG.md +89 -64
- package/README.md +92 -76
- package/lib/handlerDevOps.d.ts +5 -5
- package/lib/handlerDevOpsST.d.ts +5 -5
- package/lib/handlerMain.d.ts +4 -4
- package/lib/handlerServiceToken.d.ts +3 -3
- package/lib/index.d.ts +5 -5
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +122 -120
- package/lib/index.mjs.map +1 -1
- package/lib/init.d.ts +7 -7
- package/lib/tsv.d.ts +2 -2
- package/package.json +5 -4
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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);
|
|
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){var e;const s=null===(e=t.headers.host)||void 0===e?void 0:e.split(":")[0];return s?this.tsv.vhostAlias[s]||s:"undef"}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(),[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 v 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 g;exports.class=void 0;const m={Main:u,DevOps:f,ServiceToken:v,ServiceTokenST:class extends f{fetchId(t){return v.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],g=new m[t.type](t),g.init().then(()=>e(g)).catch(t=>s(t))):import("@lemonldap-ng/handler-"+t.type.toLowerCase()).then(s=>{exports.class=s.default,g=new exports.class(t),g.init().then(()=>e(g))}).catch(t=>s(t))}),exports.nginxServer=t=>{g.nginxServer(t)},exports.run=(t,e,s)=>g.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\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","knownHandlers","Main","DevOps","ServiceToken","ServiceTokenST","prototype","call","import","mod","class","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,CAAE,EAOrCD,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,CAAA,GAEdf,KAAKgB,UAAYjB,EACZA,EAAKkB,gBAAelB,EAAKkB,cAAgB,CAAE,GAChDlB,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,KAAKgB,UAAUc,WAEjB,MAAM,IAAIF,MAAM,0CAClB5B,KAAK+B,UAAY/B,KAAKgB,UAAUc,WAAWE,MAAM,UAGnD,MAAAC,GACE,OAAO,IAAIC,SAAiB,CA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AnF,EACAoF,IAEO2F,EAAe7F,IAAIC,EAAKnF,EAAKoF","x_google_ignoreList":[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\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","_a","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","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,W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