BPrasanthi035580 (Community Member) asked a question.

How to fix CWE-99 (resource injection issue).

When I am trying to perform code scan for few python code files, Scan results are 100%, no vulnerabilities. But after I include extra files to the scan, vulnerabilities got fixed in extra added files , but vulnerabilities got reopened in existing files. Could you please help me on this to resolve issue.


  • BPrasanthi035580 (Community Member)

    Occurred CWE-99 at this line - 

    s3_client.upload_file(f"/tmp/{source_dat_file}", self.s3_pre_processed_bucket_name, s3_file_path).

    To resolved this issue, Used below solution and issue resolved but after I include extra files to the scan, vulnerabilities got fixed in extra added files(these files also having same CWE-99 issueonly) , but vulnerabilities got reopened in existing files.

    sanitized_filename = os.path.basename(source_dat_file)

    s3_file_path = self.s3_feeder_prefix + "/" + self.s3_feeder_prefix + "_" + file_name + self.year_key + self.year + self.month_key + self.month + self.day_key + self.day + "/" + sanitized_filename

    s3_key = s3_file_path

    temp_file_path = f"/tmp/{sanitized_filename}"

     PRE_PROCESSED_BUCKET = self.s3_pre_processed_bucket_name

     s3_client.upload_file(temp_file_path, PRE_PROCESSED_BUCKET, s3_key)

     

     

    Expand Post

Topics (3)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.