Skip to content

Conversation

@shitrerohit
Copy link
Contributor

What?

Merge latest develop branch into qa

bhavanakarwade and others added 19 commits August 13, 2025 13:33
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
Signed-off-by: bhavanakarwade <bhavana.karwade@ayanworks.com>
Signed-off-by: shitrerohit <rohit.shitre@ayanworks.com>
feat: SSO changes for fetching, update and delete session
const encryptedToken = CryptoJS.AES.encrypt(JSON.stringify(clientCredential), process.env.CRYPTO_PRIVATE_KEY).toString();
const command = `${process.cwd()}/${scriptPath} ${dbUrl}`;

const { stdout, stderr } = await execPromise(command);

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
absolute path
.

Copilot Autofix

AI 6 months ago

To fix the problem, we should avoid constructing a shell command string and passing it to exec (or its promisified version). Instead, we should use execFile (or its promisified version), which allows us to pass the command and its arguments as separate parameters, avoiding shell interpretation of spaces or metacharacters. Specifically, we should:

  • Split the command into the script path and its arguments.
  • Use execFile (or a promisified version) to run the script, passing the script path as the command and the database URL as an argument.
  • Update the import to use execFile from child_process.
  • Promisify execFile instead of exec.
  • Update the call in importGeoLocationMasterData to use the new approach.

All changes are within libs/prisma-service/prisma/seed.ts.


Suggested changeset 1
libs/prisma-service/prisma/seed.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/libs/prisma-service/prisma/seed.ts b/libs/prisma-service/prisma/seed.ts
--- a/libs/prisma-service/prisma/seed.ts
+++ b/libs/prisma-service/prisma/seed.ts
@@ -4,9 +4,9 @@
 import { PrismaClient } from '@prisma/client';
 import { CommonConstants } from '../../common/src/common.constant';
 import * as CryptoJS from 'crypto-js';
-import { exec } from 'child_process';
+import { execFile } from 'child_process';
 import * as util from 'util';
-const execPromise = util.promisify(exec);
+const execFilePromise = util.promisify(execFile);
 
 const prisma = new PrismaClient();
 const logger = new Logger('Init seed DB');
@@ -401,9 +400,9 @@
       throw new Error('Environment variables GEO_LOCATION_MASTER_DATA_IMPORT_SCRIPT or DATABASE_URL are not set.');
     }
 
-    const command = `${process.cwd()}/${scriptPath} ${dbUrl}`;
+    const absoluteScriptPath = `${process.cwd()}/${scriptPath}`;
 
-    const { stdout, stderr } = await execPromise(command);
+    const { stdout, stderr } = await execFilePromise(absoluteScriptPath, [dbUrl]);
 
     if (stdout) {
       logger.log(`Shell script output: ${stdout}`);
EOF
@@ -4,9 +4,9 @@
import { PrismaClient } from '@prisma/client';
import { CommonConstants } from '../../common/src/common.constant';
import * as CryptoJS from 'crypto-js';
import { exec } from 'child_process';
import { execFile } from 'child_process';
import * as util from 'util';
const execPromise = util.promisify(exec);
const execFilePromise = util.promisify(execFile);

const prisma = new PrismaClient();
const logger = new Logger('Init seed DB');
@@ -401,9 +400,9 @@
throw new Error('Environment variables GEO_LOCATION_MASTER_DATA_IMPORT_SCRIPT or DATABASE_URL are not set.');
}

const command = `${process.cwd()}/${scriptPath} ${dbUrl}`;
const absoluteScriptPath = `${process.cwd()}/${scriptPath}`;

const { stdout, stderr } = await execPromise(command);
const { stdout, stderr } = await execFilePromise(absoluteScriptPath, [dbUrl]);

if (stdout) {
logger.log(`Shell script output: ${stdout}`);
Copilot is powered by AI and may make mistakes. Always verify output.
async function main(): Promise<void> {
const command = `${process.cwd()}/${scriptPath} ${dbUrl} ${encryptedClientId} ${encryptedClientSecret}`;

const { stdout, stderr } = await execPromise(command);

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
absolute path
.

Copilot Autofix

AI 6 months ago

To fix the problem, we should avoid constructing a shell command as a single string and passing it to exec (or its promisified version). Instead, we should use execFile (or its promisified version), which takes the command and its arguments as separate parameters, thus avoiding shell interpretation and the associated risks. This means:

  • Parse the script path and arguments into an array, not a single string.
  • Use execFile instead of exec for execution.
  • Promisify execFile as needed.
  • Update the import and the execPromise definition.
  • Update the call site to use the new function signature.

All changes are within libs/prisma-service/prisma/seed.ts:

  • Import execFile from child_process.
  • Promisify execFile instead of exec.
  • Change the command construction to an array of arguments.
  • Use execFilePromise with the script path and arguments.

Suggested changeset 1
libs/prisma-service/prisma/seed.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/libs/prisma-service/prisma/seed.ts b/libs/prisma-service/prisma/seed.ts
--- a/libs/prisma-service/prisma/seed.ts
+++ b/libs/prisma-service/prisma/seed.ts
@@ -4,9 +4,9 @@
 import { PrismaClient } from '@prisma/client';
 import { CommonConstants } from '../../common/src/common.constant';
 import * as CryptoJS from 'crypto-js';
-import { exec } from 'child_process';
+import { execFile } from 'child_process';
 import * as util from 'util';
-const execPromise = util.promisify(exec);
+const execFilePromise = util.promisify(execFile);
 
 const prisma = new PrismaClient();
 const logger = new Logger('Init seed DB');
@@ -447,10 +446,10 @@
     const encryptedClientId = await encryptClientCredential(process.env.KEYCLOAK_MANAGEMENT_CLIENT_ID);
     const encryptedClientSecret = await encryptClientCredential(process.env.KEYCLOAK_MANAGEMENT_CLIENT_SECRET);
 
-    const command = `${process.cwd()}/${scriptPath} ${dbUrl} ${encryptedClientId} ${encryptedClientSecret}`;
+    const scriptFullPath = `${process.cwd()}/${scriptPath}`;
+    const args = [dbUrl, encryptedClientId, encryptedClientSecret];
+    const { stdout, stderr } = await execFilePromise(scriptFullPath, args);
 
-    const { stdout, stderr } = await execPromise(command);
-
     if (stdout) {
       logger.log(`Shell script output: ${stdout}`);
     }
EOF
@@ -4,9 +4,9 @@
import { PrismaClient } from '@prisma/client';
import { CommonConstants } from '../../common/src/common.constant';
import * as CryptoJS from 'crypto-js';
import { exec } from 'child_process';
import { execFile } from 'child_process';
import * as util from 'util';
const execPromise = util.promisify(exec);
const execFilePromise = util.promisify(execFile);

const prisma = new PrismaClient();
const logger = new Logger('Init seed DB');
@@ -447,10 +446,10 @@
const encryptedClientId = await encryptClientCredential(process.env.KEYCLOAK_MANAGEMENT_CLIENT_ID);
const encryptedClientSecret = await encryptClientCredential(process.env.KEYCLOAK_MANAGEMENT_CLIENT_SECRET);

const command = `${process.cwd()}/${scriptPath} ${dbUrl} ${encryptedClientId} ${encryptedClientSecret}`;
const scriptFullPath = `${process.cwd()}/${scriptPath}`;
const args = [dbUrl, encryptedClientId, encryptedClientSecret];
const { stdout, stderr } = await execFilePromise(scriptFullPath, args);

const { stdout, stderr } = await execPromise(command);

if (stdout) {
logger.log(`Shell script output: ${stdout}`);
}
Copilot is powered by AI and may make mistakes. Always verify output.
@coderabbitai
Copy link

coderabbitai bot commented Aug 19, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch develop

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@shitrerohit shitrerohit self-assigned this Aug 19, 2025
@sonarqubecloud
Copy link

@shitrerohit shitrerohit merged commit a2e2f4b into qa Aug 19, 2025
10 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.

4 participants