mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-21 23:22:35 +02:00
Merge pull request #2737 from nxglabs/sync-to-public_repo-32459158600
Merge pull request #2736 from nxglabs/raktima-main-patch-security
This commit is contained in:
@@ -327,8 +327,8 @@ export default async function createBatchDocs(request) {
|
||||
const Documents = JSON.parse(strDocuments);
|
||||
|
||||
const Ip = request?.headers?.['x-real-ip'] || '';
|
||||
// Access the host from the headers
|
||||
const publicUrl = request.headers.public_url;
|
||||
// Use the browser origin so signing links keep the custom domain.
|
||||
let publicUrl = request.headers.origin || request.headers.public_url;
|
||||
const parseConfig = {
|
||||
baseURL: serverUrl,
|
||||
headers: {
|
||||
|
||||
@@ -29,7 +29,7 @@ export default async function createDocumentFromApp(request) {
|
||||
docCls.set('URL', doc?.URL);
|
||||
docCls.set('ExtUserPtr', doc.ExtUserPtr);
|
||||
docCls.set('CreatedBy', doc.CreatedBy);
|
||||
|
||||
docCls.set('OriginIp', request?.headers?.['x-real-ip'] || '');
|
||||
if (doc.Description) {
|
||||
docCls.set('Description', doc.Description);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,18 @@ const getGmail = async (access_token, displayName) => {
|
||||
return displayName;
|
||||
}
|
||||
};
|
||||
|
||||
export const encodeMimeAddress = address => {
|
||||
const value = String(address || '');
|
||||
const match = value.match(/^(.*?)\s*<([^<>]+)>$/);
|
||||
const displayName = match ? match[1].trim() : value;
|
||||
|
||||
if (/^[\x00-\x7F]*$/.test(displayName)) return value;
|
||||
|
||||
const encodedName = Buffer.from(displayName, 'utf8').toString('base64');
|
||||
return match ? `=?UTF-8?B?${encodedName}?= <${match[2]}>` : `=?UTF-8?B?${encodedName}?=`;
|
||||
};
|
||||
|
||||
// Function to create a raw email message
|
||||
const makeEmail = async (
|
||||
to,
|
||||
@@ -137,7 +149,7 @@ const makeEmail = async (
|
||||
'Content-Type: multipart/mixed; boundary="' + boundary + '"\n',
|
||||
'MIME-Version: 1.0\n',
|
||||
`To: ${to}\n`,
|
||||
`From: ${from}\n`,
|
||||
`From: ${encodeMimeAddress(from)}\n`,
|
||||
bccHeader,
|
||||
ccHeader,
|
||||
replyToHeader,
|
||||
@@ -155,7 +167,7 @@ const makeEmail = async (
|
||||
'Content-Type: multipart/mixed; boundary="' + boundary + '"\n',
|
||||
'MIME-Version: 1.0\n',
|
||||
`To: ${to}\n`,
|
||||
`From: ${from}\n`,
|
||||
`From: ${encodeMimeAddress(from)}\n`,
|
||||
bccHeader,
|
||||
ccHeader,
|
||||
replyToHeader,
|
||||
|
||||
Reference in New Issue
Block a user