-
Notifications
You must be signed in to change notification settings - Fork 73
merge: DEV to QA #1381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
merge: DEV to QA #1381
Conversation
* feat: added logic for updated routes for agent Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * refactor: uncommented required code Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * feat:added logic to get token from cloudwatch Signed-off-by: Sahil Kamble <sahil.kamble@ayanworks.com> * feat: update credo image in taskdef Signed-off-by: Sahil Kamble <sahil.kamble@ayanworks.com> * feat: change service name for testing Signed-off-by: Sahil Kamble <sahil.kamble@ayanworks.com> * chore: WIP Signed-off-by: Sahil Kamble <sahil.kamble@ayanworks.com> * debug: added logs for agent details Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * refactor:removed console logs Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * refactor:removed commented code Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * feat: added token for old wallet Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * refactor: cloud wallet urls and token changes Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * refactor: removed logs from shell scripts Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * refactor: resolve comment Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * refactor: resolve comments for getOrgAgentApiKey Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * refactor: agent service comments Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> --------- Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> Signed-off-by: Sahil Kamble <sahil.kamble@ayanworks.com> Co-authored-by: Sahil Kamble <sahil.kamble@ayanworks.com>
Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com>
* fix: schema by id Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * fix: schema by id Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> --------- Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com>
* fix: schema by id Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * fix: schema by id Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * fix: duplicate URL creation Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * fix: added await in common method Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * fix: added logic for get token Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> * fix: polygon routes Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com> --------- Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com>
| walletStorageHost, | ||
| walletStoragePassword, | ||
| walletStoragePort, | ||
| walletStorageUser, |
Check warning
Code scanning / CodeQL
Shell command built from environment values Medium
absolute path
Show autofix suggestion
Hide autofix suggestion
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. Instead, we should use execFile (or execFileSync if synchronous execution is desired), which allows us to specify the command and its arguments separately. This prevents shell interpretation of arguments and mitigates the risk of shell injection.
Detailed steps:
- Parse the shell script path and arguments separately.
- Use
execFileto run the shell script, passing the arguments as an array. - Ensure that all arguments are passed as individual array elements, not concatenated into a single string.
- Update the code in
apps/agent-provisioning/src/agent-provisioning.service.tsat lines 43–45 to useexecFileinstead ofexec. - No additional dependencies are required, as
execFileis part of Node.js'schild_processmodule.
-
Copy modified lines R43-R68 -
Copy modified line R70
| @@ -42,5 +42,30 @@ | ||
| // The wallet provision command is used to invoke a shell script | ||
| const walletProvision = `${process.cwd() + process.env.AFJ_AGENT_SPIN_UP} ${orgId} "${externalIp}" "${walletName}" "${walletPassword}" ${seed} ${webhookEndpoint} ${walletStorageHost} ${walletStoragePort} ${walletStorageUser} ${walletStoragePassword} ${containerName} ${protocol} ${tenant} ${credoImage} "${indyLedger}" ${inboundEndpoint} ${process.env.SCHEMA_FILE_SERVER_URL} ${apiKey} ${process.env.AGENT_HOST} ${process.env.AWS_ACCOUNT_ID} ${process.env.S3_BUCKET_ARN} ${process.env.CLUSTER_NAME} ${process.env.TESKDEFINITION_FAMILY}`; | ||
| const scriptPath = process.cwd() + process.env.AFJ_AGENT_SPIN_UP; | ||
| const walletProvisionArgs = [ | ||
| orgId, | ||
| externalIp, | ||
| walletName, | ||
| walletPassword, | ||
| seed, | ||
| webhookEndpoint, | ||
| walletStorageHost, | ||
| walletStoragePort, | ||
| walletStorageUser, | ||
| walletStoragePassword, | ||
| containerName, | ||
| protocol, | ||
| tenant, | ||
| credoImage, | ||
| indyLedger, | ||
| inboundEndpoint, | ||
| process.env.SCHEMA_FILE_SERVER_URL, | ||
| apiKey, | ||
| process.env.AGENT_HOST, | ||
| process.env.AWS_ACCOUNT_ID, | ||
| process.env.S3_BUCKET_ARN, | ||
| process.env.CLUSTER_NAME, | ||
| process.env.TESKDEFINITION_FAMILY | ||
| ]; | ||
| const spinUpResponse: object = new Promise(async (resolve) => { | ||
| await exec(walletProvision, async (err, stdout, stderr) => { | ||
| await execFile(scriptPath, walletProvisionArgs, async (err, stdout, stderr) => { | ||
| this.logger.log(`shell script output: ${stdout}`); |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
…r images (#1376) Signed-off-by: Sahil Kamble <sahil.kamble@ayanworks.com>
Signed-off-by: Krishna Waske <krishna.waske@ayanworks.com>
Signed-off-by: Tipu_Singh <tipu.singh@ayanworks.com>
|



This pull request introduces significant improvements and refactoring across the agent provisioning and interaction flow: