Skip to content

Conversation

@cx-sumit-morchhale
Copy link
Contributor

By submitting this pull request, you agree to the terms within the Checkmarx Code of Conduct. Please review the contributing guidelines for guidance on creating high-quality pull requests.

Description

Implemented code changes for multi part upload when source folder size exceeds the 5GB and introduce 'multipart_file_size' environment variable in checkmarx.yml file where customer can give the file part size according to internet banwidth.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

Related Issues

Link any related issues or tickets.

Checklist

  • I have performed a self-review of my code
  • I have added necessary documentation (if appropriate)
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

Screenshots (if applicable)

Add screenshots to help explain your changes.

Additional Notes

Add any other relevant information.

@cx-sumit-morchhale cx-sumit-morchhale changed the title implemented multipart upload implement multipart upload(AST-24859) Nov 5, 2025
@cx-sumit-morchhale cx-sumit-morchhale changed the title implement multipart upload(AST-24859) Implement multipart upload(AST-24859) Nov 5, 2025
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Logo
Checkmarx One – Scan Summary & Detailsd4d354ba-4769-4cef-9744-42427198cc7b

Great job! No new security vulnerabilities introduced in this pull request

flagResponse, _ := featureFlagsWrapper.GetSpecificFlag(wrappers.IncreaseFileUploadLimit)
if flagResponse.Status && fileInfo.Size() > MaxSizeBytes {
// File size >5GB, proceed with multipart upload
logger.PrintIfVerbose("File size >5GB and INCREASE_FILE_UPLOAD_LIMIT flag is enabled,hence uploading file in multiple parts...")
Copy link
Collaborator

Choose a reason for hiding this comment

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

update message & removed Flag name from log message

Copy link
Collaborator

Choose a reason for hiding this comment

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

Uploading source code in multiple parts.

preSignedURL, zipFilePathErr = uploadsWrapper.UploadFileInMultipart(zipFilePath, featureFlagsWrapper)
} else {
// File size is within <=5GB, proceed with upload in single part
logger.PrintIfVerbose("File size is within the limit and uploading file in a single part...")
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove this log

// calculate file size and compare with 5GB limit
fileInfo, err := os.Stat(sourcesFile)
if err != nil {
return nil, errors.Wrapf(err, "Failed to stat - %s", sourcesFile)
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove error condition

// Generate presigned URL
presignedURL, err := getPresignedURLForMultipartUploading(startMultipartUploadResponse, partNumber)
if err != nil {
return nil, fmt.Errorf("failed to get presigned URL for part%d - %s", partNumber, err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Failed - change f to F

// Upload part
etag, err := uploadPart(presignedURL, partPath, featureFlagsWrapper)
if err != nil {
return nil, fmt.Errorf("failed to upload part%d - %s", partNumber, err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change f to F

path := viper.GetString(commonParams.CompleteMultipartUploadPathEnv)
jsonBytes, err := json.Marshal(completeMultipartUpload)
if err != nil {
return nil, errors.Errorf("Failed to marshal complete multipart upload request body - %s", err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

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

change the error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants