Skip to content

Conversation

@prafull-opensignlabs
Copy link
Collaborator

No description provided.

nxglabs and others added 24 commits July 7, 2025 18:07
fix: custom applogo not visible in header
*Total -- 487.98kb -> 238.96kb (51.03%)

/apps/OpenSign/public/logo512.png -- 10.72kb -> 2.72kb (74.62%)
/apps/OpenSignServer/logo.png -- 86.48kb -> 24.83kb (71.28%)
/apps/OpenSign/src/assets/images/logo.png -- 86.48kb -> 24.83kb (71.28%)
/apps/OpenSign/public/static/js/assets/images/logo.2a7bff0c1189183fafe71d7d5b94e0cd.png -- 86.48kb -> 24.83kb (71.28%)
/apps/OpenSign/public/logo192.png -- 2.13kb -> 0.65kb (69.69%)
/apps/OpenSign/src/assets/images/dp.png -- 12.83kb -> 4.25kb (66.9%)
/apps/OpenSign/src/assets/images/folder.png -- 4.39kb -> 1.93kb (56.05%)
/apps/OpenSign/public/static/js/assets/images/logo-dark.png -- 95.21kb -> 57.21kb (39.91%)
/apps/OpenSignServer/public/assets/images/parse-logo.png -- 5.16kb -> 3.81kb (26.21%)
/apps/OpenSign/src/assets/images/pdf3.png -- 11.66kb -> 9.77kb (16.21%)
/apps/OpenSign/src/assets/images/login_img.svg -- 40.75kb -> 39.10kb (4.04%)
/apps/OpenSign/src/assets/images/recreatedoc.png -- 40.69kb -> 40.08kb (1.48%)
/apps/OpenSign/src/assets/images/pad.svg -- 5.00kb -> 4.94kb (1.07%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
fix: remove agreement checkbox and remove agreement checkbox tour
remove checkbox from sign agreement screen
Fix: show signers list in completed documents
fix: add dynamic truncate for email in list of signers
refactor: correct grammar and normalise font size of signer email in report
feat: allow preferences menu for all user and add smtp setting in it
feat: allow preferences menu for all user
refactor: remove form-name from form title
refactor: remove form-name from form title
fix: managesign report alignment and loader issue
fix: managesign report alignment and loader issue
fix: not able update public username and save sign, initials not working
};

// Only set custom endpoint if not using AWS
if (endpoint && !endpoint.includes('amazonaws.com')) {

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization

'[amazonaws.com](1)' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix

AI 4 months ago

To fix the security issue, instead of checking if 'amazonaws.com' is present anywhere in the endpoint string, you should parse the endpoint as a URL (using the URL constructor) and check whether the hostname exactly matches or ends with 'amazonaws.com'. This ensures that only real AWS endpoints are detected, and trick endpoints (e.g., those with 'amazonaws.com' in a different part of the URL or as a subdomain of an unrelated host) are not falsely classified as AWS endpoints.

  • Update line 22 of createS3Client to parse endpoint with new URL(...) and check its hostname.
  • Use either:
    • endpointHostname === 'amazonaws.com' or
    • endpointHostname.endsWith('.amazonaws.com') or
    • endpointHostname === 'amazonaws.com' || endpointHostname.endsWith('.amazonaws.com')
  • If endpoint does not parse as a URL, fallback gracefully (ignore custom endpoint).
  • No additional imports are needed.
  • Only lines inside the function createS3Client need changes.

Suggested changeset 1
apps/OpenSignServer/cloud/customRoute/deleteFileUrl.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/OpenSignServer/cloud/customRoute/deleteFileUrl.js b/apps/OpenSignServer/cloud/customRoute/deleteFileUrl.js
--- a/apps/OpenSignServer/cloud/customRoute/deleteFileUrl.js
+++ b/apps/OpenSignServer/cloud/customRoute/deleteFileUrl.js
@@ -19,8 +19,17 @@
   };
 
   // Only set custom endpoint if not using AWS
-  if (endpoint && !endpoint.includes('amazonaws.com')) {
-    config.endpoint = `https://${endpoint}`;
+  if (endpoint) {
+    let endpointHost;
+    try {
+      endpointHost = (new URL(endpoint.includes('://') ? endpoint : `https://${endpoint}`)).hostname;
+    } catch {
+      endpointHost = '';
+    }
+    // Only set custom endpoint if NOT AWS (hostname must NOT equal or end with 'amazonaws.com')
+    if (!(endpointHost === 'amazonaws.com' || endpointHost.endsWith('.amazonaws.com'))) {
+      config.endpoint = `https://${endpoint}`;
+    }
   }
 
   return new S3Client(config);
EOF
@@ -19,8 +19,17 @@
};

// Only set custom endpoint if not using AWS
if (endpoint && !endpoint.includes('amazonaws.com')) {
config.endpoint = `https://${endpoint}`;
if (endpoint) {
let endpointHost;
try {
endpointHost = (new URL(endpoint.includes('://') ? endpoint : `https://${endpoint}`)).hostname;
} catch {
endpointHost = '';
}
// Only set custom endpoint if NOT AWS (hostname must NOT equal or end with 'amazonaws.com')
if (!(endpointHost === 'amazonaws.com' || endpointHost.endsWith('.amazonaws.com'))) {
config.endpoint = `https://${endpoint}`;
}
}

return new S3Client(config);
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
</body>
</html>
`;
res.send(htmlForm);

Check failure

Code scanning / CodeQL

Reflected cross-site scripting

Cross-site scripting vulnerability due to a [user-provided value](1).

Copilot Autofix

AI 4 months ago

To fix the vulnerability, any user-supplied value that is included in HTML output must be properly escaped for the appropriate context. Since userId ends up embedded in an HTML attribute value (the action attribute of a form), we need to use an HTML-escaping function. The best and most robust way is to use a mature and well-tested escaping library such as escape-html.

Steps to fix:

  • Import the escape-html package at the top of the file.
  • When building the htmlForm string on line 265–346, wrap userId with the escaping function when interpolating it in the string:
    action="${routePath}/delete-account/${escapeHtml(userId)}"
  • This will ensure that any HTML special characters in userId (such as ", <, >, &) are properly encoded, preventing XSS.

Only the relevant block needs to be changed, and the required import added at the top.


Suggested changeset 2
apps/OpenSignServer/cloud/customRoute/deleteUser.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/OpenSignServer/cloud/customRoute/deleteUser.js b/apps/OpenSignServer/cloud/customRoute/deleteUser.js
--- a/apps/OpenSignServer/cloud/customRoute/deleteUser.js
+++ b/apps/OpenSignServer/cloud/customRoute/deleteUser.js
@@ -1,4 +1,5 @@
 import axios from 'axios';
+import escapeHtml from 'escape-html';
 import { cloudServerUrl, generateId, serverAppId } from '../../Utils.js';
 import sendmailtoSupport from './sendMailToSupport.js';
 import { deleteContactsInBatch, deleteDataFiles, deleteInBatches } from './deleteFileUrl.js';
@@ -335,7 +336,7 @@
   <div class="container">
     <h2>Confirm Account Deletion</h2>
     <p class="warning">This action is irreversible. Please confirm by entering your password.</p>
-    <form method="POST" action="${routePath}/delete-account/${userId}">
+    <form method="POST" action="${routePath}/delete-account/${escapeHtml(userId)}">
       <label for="password">Password</label>
       <input type="password" name="password" id="password" placeholder="Please provide your password" required />
       <button type="submit">Delete My Account</button>
EOF
@@ -1,4 +1,5 @@
import axios from 'axios';
import escapeHtml from 'escape-html';
import { cloudServerUrl, generateId, serverAppId } from '../../Utils.js';
import sendmailtoSupport from './sendMailToSupport.js';
import { deleteContactsInBatch, deleteDataFiles, deleteInBatches } from './deleteFileUrl.js';
@@ -335,7 +336,7 @@
<div class="container">
<h2>Confirm Account Deletion</h2>
<p class="warning">This action is irreversible. Please confirm by entering your password.</p>
<form method="POST" action="${routePath}/delete-account/${userId}">
<form method="POST" action="${routePath}/delete-account/${escapeHtml(userId)}">
<label for="password">Password</label>
<input type="password" name="password" id="password" placeholder="Please provide your password" required />
<button type="submit">Delete My Account</button>
apps/OpenSignServer/package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/OpenSignServer/package.json b/apps/OpenSignServer/package.json
--- a/apps/OpenSignServer/package.json
+++ b/apps/OpenSignServer/package.json
@@ -54,7 +54,8 @@
     "rate-limiter-flexible": "^7.2.0",
     "sharp": "^0.34.3",
     "speakeasy": "^2.0.0",
-    "ws": "^8.18.3"
+    "ws": "^8.18.3",
+    "escape-html": "^1.0.3"
   },
   "type": "module",
   "devDependencies": {
EOF
@@ -54,7 +54,8 @@
"rate-limiter-flexible": "^7.2.0",
"sharp": "^0.34.3",
"speakeasy": "^2.0.0",
"ws": "^8.18.3"
"ws": "^8.18.3",
"escape-html": "^1.0.3"
},
"type": "module",
"devDependencies": {
This fix introduces these dependencies
Package Version Security advisories
escape-html (npm) 1.0.3 None
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
console.log('err while validating password: ', err?.response?.data || err);
const errorMessage = `Invalid password. <a href="${routePath}/delete-account/${userId}">Try again</a>`;
sendmailtoSupport(userDetails, errorMessage);
return res.status(401).send(errorMessage);

Check failure

Code scanning / CodeQL

Reflected cross-site scripting

Cross-site scripting vulnerability due to a [user-provided value](1).

Copilot Autofix

AI 4 months ago

To fix this issue, we must sanitize or escape the userId prior to including it in the HTML response. Since the context is within an HTML "href" attribute, the value must be escaped to prevent breaking the attribute or enabling script execution via malformed values. The best, simplest way is to use a well-known HTML-escaping utility such as escape-html. This library safely escapes HTML special characters, preventing injection attacks.

Implementation steps:

  • Add the escape-html import at the top of the file.
  • When building errorMessage, apply escape() to userId before interpolating it into the HTML anchor.
  • No changes to the actual business logic or user IDs.

Suggested changeset 2
apps/OpenSignServer/cloud/customRoute/deleteUser.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/OpenSignServer/cloud/customRoute/deleteUser.js b/apps/OpenSignServer/cloud/customRoute/deleteUser.js
--- a/apps/OpenSignServer/cloud/customRoute/deleteUser.js
+++ b/apps/OpenSignServer/cloud/customRoute/deleteUser.js
@@ -1,4 +1,5 @@
 import axios from 'axios';
+import escape from 'escape-html';
 import { cloudServerUrl, generateId, serverAppId } from '../../Utils.js';
 import sendmailtoSupport from './sendMailToSupport.js';
 import { deleteContactsInBatch, deleteDataFiles, deleteInBatches } from './deleteFileUrl.js';
@@ -393,7 +394,7 @@
       console.log('Res ', res?.data);
     } catch (err) {
       console.log('err while validating password: ', err?.response?.data || err);
-      const errorMessage = `Invalid password. <a href="${routePath}/delete-account/${userId}">Try again</a>`;
+      const errorMessage = `Invalid password. <a href="${routePath}/delete-account/${escape(userId)}">Try again</a>`;
       sendmailtoSupport(userDetails, errorMessage);
       return res.status(401).send(errorMessage);
     }
EOF
@@ -1,4 +1,5 @@
import axios from 'axios';
import escape from 'escape-html';
import { cloudServerUrl, generateId, serverAppId } from '../../Utils.js';
import sendmailtoSupport from './sendMailToSupport.js';
import { deleteContactsInBatch, deleteDataFiles, deleteInBatches } from './deleteFileUrl.js';
@@ -393,7 +394,7 @@
console.log('Res ', res?.data);
} catch (err) {
console.log('err while validating password: ', err?.response?.data || err);
const errorMessage = `Invalid password. <a href="${routePath}/delete-account/${userId}">Try again</a>`;
const errorMessage = `Invalid password. <a href="${routePath}/delete-account/${escape(userId)}">Try again</a>`;
sendmailtoSupport(userDetails, errorMessage);
return res.status(401).send(errorMessage);
}
apps/OpenSignServer/package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/OpenSignServer/package.json b/apps/OpenSignServer/package.json
--- a/apps/OpenSignServer/package.json
+++ b/apps/OpenSignServer/package.json
@@ -54,7 +54,8 @@
     "rate-limiter-flexible": "^7.2.0",
     "sharp": "^0.34.3",
     "speakeasy": "^2.0.0",
-    "ws": "^8.18.3"
+    "ws": "^8.18.3",
+    "escape-html": "^1.0.3"
   },
   "type": "module",
   "devDependencies": {
EOF
@@ -54,7 +54,8 @@
"rate-limiter-flexible": "^7.2.0",
"sharp": "^0.34.3",
"speakeasy": "^2.0.0",
"ws": "^8.18.3"
"ws": "^8.18.3",
"escape-html": "^1.0.3"
},
"type": "module",
"devDependencies": {
This fix introduces these dependencies
Package Version Security advisories
escape-html (npm) 1.0.3 None
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
console.error('Account deletion error:', error);
const errorMessage = error?.message || 'An error occurred while deleting your account.';
sendmailtoSupport(userDetails, errorMessage);
return res.status(500).send(errorMessage);

Check warning

Code scanning / CodeQL

Exception text reinterpreted as HTML

[Exception text](1) is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix

AI 4 months ago

To fix the XSS vulnerability, any error message or user-controllable string sent as part of a server response with HTML or text content must be properly escaped before being sent to the client. The most robust approach is to encode HTML meta-characters (<, >, &, ", ', /) in the error message such that if the message is rendered in a browser, it can't be interpreted as HTML or JavaScript. This can be accomplished by using a standard library such as he or escape-html, which specifically escapes HTML characters. The replacement should be at the point where the error message is being sent to clients, i.e., inside the catch block on line 409. Add the relevant import at the top of the file.

Required changes:

  1. Add an import for an HTML-escaping function (such as from the escape-html package).
  2. Before sending errorMessage, ensure it is properly escaped.
  3. Only touch the lines sending the error message (res.status(500).send(errorMessage); → escape before send).
  4. No other functionality should change.

Suggested changeset 2
apps/OpenSignServer/cloud/customRoute/deleteUser.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/OpenSignServer/cloud/customRoute/deleteUser.js b/apps/OpenSignServer/cloud/customRoute/deleteUser.js
--- a/apps/OpenSignServer/cloud/customRoute/deleteUser.js
+++ b/apps/OpenSignServer/cloud/customRoute/deleteUser.js
@@ -1,4 +1,5 @@
 import axios from 'axios';
+import escapeHtml from 'escape-html';
 import { cloudServerUrl, generateId, serverAppId } from '../../Utils.js';
 import sendmailtoSupport from './sendMailToSupport.js';
 import { deleteContactsInBatch, deleteDataFiles, deleteInBatches } from './deleteFileUrl.js';
@@ -406,7 +407,7 @@
     console.error('Account deletion error:', error);
     const errorMessage = error?.message || 'An error occurred while deleting your account.';
     sendmailtoSupport(userDetails, errorMessage);
-    return res.status(500).send(errorMessage);
+    return res.status(500).send(escapeHtml(errorMessage));
   }
 };
 
EOF
@@ -1,4 +1,5 @@
import axios from 'axios';
import escapeHtml from 'escape-html';
import { cloudServerUrl, generateId, serverAppId } from '../../Utils.js';
import sendmailtoSupport from './sendMailToSupport.js';
import { deleteContactsInBatch, deleteDataFiles, deleteInBatches } from './deleteFileUrl.js';
@@ -406,7 +407,7 @@
console.error('Account deletion error:', error);
const errorMessage = error?.message || 'An error occurred while deleting your account.';
sendmailtoSupport(userDetails, errorMessage);
return res.status(500).send(errorMessage);
return res.status(500).send(escapeHtml(errorMessage));
}
};

apps/OpenSignServer/package.json
Outside changed files

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/OpenSignServer/package.json b/apps/OpenSignServer/package.json
--- a/apps/OpenSignServer/package.json
+++ b/apps/OpenSignServer/package.json
@@ -54,7 +54,8 @@
     "rate-limiter-flexible": "^7.2.0",
     "sharp": "^0.34.3",
     "speakeasy": "^2.0.0",
-    "ws": "^8.18.3"
+    "ws": "^8.18.3",
+    "escape-html": "^1.0.3"
   },
   "type": "module",
   "devDependencies": {
EOF
@@ -54,7 +54,8 @@
"rate-limiter-flexible": "^7.2.0",
"sharp": "^0.34.3",
"speakeasy": "^2.0.0",
"ws": "^8.18.3"
"ws": "^8.18.3",
"escape-html": "^1.0.3"
},
"type": "module",
"devDependencies": {
This fix introduces these dependencies
Package Version Security advisories
escape-html (npm) 1.0.3 None
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@vercel
Copy link

vercel bot commented Sep 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
open-sign Ready Ready Preview Sep 8, 2025 5:01am

@prafull-opensignlabs prafull-opensignlabs merged commit 1496c1b into main Sep 8, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants