Skip to content

Conversation

@nxglabs
Copy link
Collaborator

@nxglabs nxglabs commented Nov 1, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 1, 2025 11:53
@vercel
Copy link

vercel bot commented Nov 1, 2025

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

Project Deployment Preview Comments Updated (UTC)
open-sign Ready Ready Preview Comment Nov 1, 2025 11:53am

@prafull-opensignlabs prafull-opensignlabs merged commit ca1b873 into staging Nov 1, 2025
11 checks passed
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR downgrades the MongoDB driver from version 6.20.0 to 5.9.2, improves SMTP authentication configuration to handle optional credentials, refactors signature management to use Parse Cloud Functions, and fixes error messages for consistency.

  • Downgraded MongoDB driver to version 5.9.2 to address compatibility issues
  • Enhanced SMTP configuration to conditionally add authentication only when both username and password are provided
  • Refactored signature operations from direct Parse SDK queries to server-side Cloud Functions for better security and maintainability

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
apps/OpenSignServer/package.json Downgraded mongodb dependency from 6.20.0 to 5.9.2
apps/OpenSignServer/package-lock.json Updated lock file with mongodb 5.9.2 and new dependencies (ip-address, smart-buffer, socks)
apps/OpenSignServer/index.js Modified SMTP configuration to conditionally add auth only when credentials exist
apps/OpenSignServer/cloud/parsefunction/sendMailv3.js Applied same conditional SMTP auth logic and improved error messages
apps/OpenSignServer/cloud/parsefunction/saveSignature.js New Cloud Function to save/update signatures with authorization checks
apps/OpenSignServer/cloud/parsefunction/manageSign.js New Cloud Function for managing signatures with different field handling
apps/OpenSignServer/cloud/parsefunction/getSignature.js New Cloud Function to retrieve user signatures
apps/OpenSignServer/cloud/main.js Registered new Cloud Functions
apps/OpenSign/src/utils/widgetUtils.js Refactored to use savesignature Cloud Function
apps/OpenSign/src/pages/Managesign.jsx Refactored to use managesign and getdefaultsignature Cloud Functions
apps/OpenSign/src/constant/Utils.js Fixed comment typo and refactored to use getdefaultsignature Cloud Function
Files not reviewed (1)
  • apps/OpenSignServer/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Missing userId parameter.');
}
if (userId !== request.user?.id) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.');
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message 'Cannot save signature for the current user' is misleading. When userId !== request.user?.id, the user is attempting to save a signature for a different user (not the current user), which should be prevented. The message should be 'Cannot save signature for another user.' or 'You can only save signatures for yourself.'

Suggested change
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.');
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'You can only save signatures for yourself.');

Copilot uses AI. Check for mistakes.
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Missing userId parameter.');
}
if (userId !== request.user?.id) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.');
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message 'Cannot save signature for the current user' is misleading. When userId !== request.user?.id, the user is attempting to save a signature for a different user (not the current user), which should be prevented. The message should be 'Cannot save signature for another user.' or 'You can only save signatures for yourself.'

Suggested change
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.');
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'You can only save signatures for yourself.');

Copilot uses AI. Check for mistakes.
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Missing userId parameter.');
}
if (userId !== request.user?.id) {
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.');
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message 'Cannot save signature for the current user' is incorrect for a get operation. This function retrieves signatures, not saves them. The message should be 'Cannot retrieve signature for another user.' or 'You can only retrieve your own signatures.'

Suggested change
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot save signature for the current user.');
throw new Parse.Error(Parse.Error.INVALID_QUERY, 'Cannot retrieve signature for another user.');

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +27
if (userPtr) {
signatureCls.set('UserId', userPtr);
}
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition 'if (userPtr)' is unnecessary because userPtr is defined unconditionally on line 10. Since userId is already validated to be non-null on lines 4-6, userPtr will always exist. This check should be removed and 'UserId' should always be set.

Suggested change
if (userPtr) {
signatureCls.set('UserId', userPtr);
}
signatureCls.set('UserId', userPtr);

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +21
if (userPtr) {
signatureCls.set('UserId', userPtr);
}
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition 'if (userPtr)' is unnecessary because userPtr is defined unconditionally on line 10. Since userId is already validated to be non-null on lines 4-6, userPtr will always exist. This check should be removed and 'UserId' should always be set.

Suggested change
if (userPtr) {
signatureCls.set('UserId', userPtr);
}
signatureCls.set('UserId', userPtr);

Copilot uses AI. Check for mistakes.
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.

3 participants