// this is an example, that required local file to only comes from temporay folder
if (!isWithin(os.tmpdir(), filePath)) {
thrownew Error(`Application only expect to send file from ${os.tmpdir()}, but file ${filePath} was asked`);
}
return fs.createReadStream(smallFileName);
}
});
Diego Dupin
added a comment - - edited example of use:
function isWithin(outer, inner) {
const rel = path.relative(outer, inner);
return !rel.startsWith( '../' ) && rel !== '..' ;
}
const conn = await mariadb.createConnection({
host: 'localhost' ,
user: 'root' ,
permitLocalInfile: true ,
infileStreamFactory: (filePath) => {
// this is an example, that required local file to only comes from temporay folder
if (!isWithin(os.tmpdir(), filePath)) {
throw new Error(`Application only expect to send file from ${os.tmpdir()}, but file ${filePath} was asked`);
}
return fs.createReadStream(smallFileName);
}
});
People
Diego Dupin
Diego Dupin
Votes:
0Vote for this issue
Watchers:
1Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":801.8999998569489,"ttfb":260.7000000476837,"pageVisibility":"visible","entityId":124874,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"5d3d3832-4283-4f2c-88f6-88643918e644","navigationType":0,"readyForUser":907.0999999046326,"redirectCount":0,"resourceLoadedEnd":795,"resourceLoadedStart":266.5,"resourceTiming":[{"duration":19.399999856948853,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":266.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":266.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":285.89999985694885,"responseStart":0,"secureConnectionStart":0},{"duration":19.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":266.7000000476837,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":266.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":286.2000000476837,"responseStart":0,"secureConnectionStart":0},{"duration":72.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":267,"connectEnd":267,"connectStart":267,"domainLookupEnd":267,"domainLookupStart":267,"fetchStart":267,"redirectEnd":0,"redirectStart":0,"requestStart":267,"responseEnd":339.59999990463257,"responseStart":339.59999990463257,"secureConnectionStart":267},{"duration":122.79999995231628,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":267.2000000476837,"connectEnd":267.2000000476837,"connectStart":267.2000000476837,"domainLookupEnd":267.2000000476837,"domainLookupStart":267.2000000476837,"fetchStart":267.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":267.2000000476837,"responseEnd":390,"responseStart":390,"secureConnectionStart":267.2000000476837},{"duration":126.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":267.2999999523163,"connectEnd":267.2999999523163,"connectStart":267.2999999523163,"domainLookupEnd":267.2999999523163,"domainLookupStart":267.2999999523163,"fetchStart":267.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":267.2999999523163,"responseEnd":393.7999999523163,"responseStart":393.7999999523163,"secureConnectionStart":267.2999999523163},{"duration":126.70000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":267.59999990463257,"connectEnd":267.59999990463257,"connectStart":267.59999990463257,"domainLookupEnd":267.59999990463257,"domainLookupStart":267.59999990463257,"fetchStart":267.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":267.59999990463257,"responseEnd":394.2999999523163,"responseStart":394.2999999523163,"secureConnectionStart":267.59999990463257},{"duration":127,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":267.7999999523163,"connectEnd":267.7999999523163,"connectStart":267.7999999523163,"domainLookupEnd":267.7999999523163,"domainLookupStart":267.7999999523163,"fetchStart":267.7999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":267.7999999523163,"responseEnd":394.7999999523163,"responseStart":394.7999999523163,"secureConnectionStart":267.7999999523163},{"duration":214,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":267.89999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":267.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":481.89999985694885,"responseStart":0,"secureConnectionStart":0},{"duration":127.20000004768372,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":268.09999990463257,"connectEnd":268.09999990463257,"connectStart":268.09999990463257,"domainLookupEnd":268.09999990463257,"domainLookupStart":268.09999990463257,"fetchStart":268.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":268.09999990463257,"responseEnd":395.2999999523163,"responseStart":395.2999999523163,"secureConnectionStart":268.09999990463257},{"duration":213.70000004768372,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":268.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":268.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":482,"responseStart":0,"secureConnectionStart":0},{"duration":127.39999985694885,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":268.5,"connectEnd":268.5,"connectStart":268.5,"domainLookupEnd":268.5,"domainLookupStart":268.5,"fetchStart":268.5,"redirectEnd":0,"redirectStart":0,"requestStart":268.5,"responseEnd":395.89999985694885,"responseStart":395.89999985694885,"secureConnectionStart":268.5},{"duration":417,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":269.2999999523163,"connectEnd":269.2999999523163,"connectStart":269.2999999523163,"domainLookupEnd":269.2999999523163,"domainLookupStart":269.2999999523163,"fetchStart":269.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":269.2999999523163,"responseEnd":686.2999999523163,"responseStart":686.2999999523163,"secureConnectionStart":269.2999999523163},{"duration":506.2000000476837,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":269.2999999523163,"connectEnd":269.2999999523163,"connectStart":269.2999999523163,"domainLookupEnd":269.2999999523163,"domainLookupStart":269.2999999523163,"fetchStart":269.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":269.2999999523163,"responseEnd":775.5,"responseStart":775.5,"secureConnectionStart":269.2999999523163},{"duration":176.70000004768372,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":510.09999990463257,"connectEnd":510.09999990463257,"connectStart":510.09999990463257,"domainLookupEnd":510.09999990463257,"domainLookupStart":510.09999990463257,"fetchStart":510.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":510.09999990463257,"responseEnd":686.7999999523163,"responseStart":686.7999999523163,"secureConnectionStart":510.09999990463257},{"duration":40.90000009536743,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":754.0999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":754.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":795,"responseStart":0,"secureConnectionStart":0},{"duration":28.399999856948853,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":755,"connectEnd":755,"connectStart":755,"domainLookupEnd":755,"domainLookupStart":755,"fetchStart":755,"redirectEnd":0,"redirectStart":0,"requestStart":755,"responseEnd":783.3999998569489,"responseStart":783.3999998569489,"secureConnectionStart":755},{"duration":35,"initiatorType":"script","name":"https://jira.mariadb.org/s/097ae97cb8fbec7d6ea4bbb1f26955b9-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/js/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":755.3999998569489,"connectEnd":755.3999998569489,"connectStart":755.3999998569489,"domainLookupEnd":755.3999998569489,"domainLookupStart":755.3999998569489,"fetchStart":755.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":755.3999998569489,"responseEnd":790.3999998569489,"responseStart":790.3999998569489,"secureConnectionStart":755.3999998569489},{"duration":225,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":794.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":794.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1019.5,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":103,"responseStart":261,"responseEnd":265,"domLoading":264,"domInteractive":976,"domContentLoadedEventStart":976,"domContentLoadedEventEnd":1016,"domComplete":1228,"loadEventStart":1228,"loadEventEnd":1228,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":938.0999999046326},{"name":"bigPipe.sidebar-id.end","time":938.7999999523163},{"name":"bigPipe.activity-panel-pipe-id.start","time":938.8999998569489},{"name":"bigPipe.activity-panel-pipe-id.end","time":940.5},{"name":"activityTabFullyLoaded","time":1031}],"measures":[],"correlationId":"9dfd8dcd347fcb","effectiveType":"4g","downlink":9.9,"rtt":0,"serverDuration":101,"dbReadsTimeInMs":13,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
example of use:
function isWithin(outer, inner) {
}
infileStreamFactory: (filePath) => {
}
}
});