Repository navigation
Fail fast on unsanitized plugin output in FSLinkStorage #177
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -474,8 +474,13 @@ def get(self, job_id): | |||||||
| else: | ||||||||
| storage = FSLinkStorage(app.config) | ||||||||
|
|
||||||||
| content = storage.get_data(job_id, outgoing_dir, | ||||||||
| job_output_path=job_output_path) | ||||||||
| try: | ||||||||
| content = storage.get_data(job_id, outgoing_dir, | ||||||||
| job_output_path=job_output_path) | ||||||||
| except Exception as e: | ||||||||
| logger.error(f'Error fetching job {job_id} output data, ' | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 MEDIUM RISK Avoid exposing internal error details to the client to prevent information disclosure (e.g., internal paths). Additionally, use
Suggested change
|
||||||||
| f'detail: {str(e)}') | ||||||||
| abort(500, message=str(e)) | ||||||||
| download_name = f'{job_id}.json' | ||||||||
| mimetype = 'application/json' | ||||||||
|
|
||||||||
|
|
@@ -486,16 +491,22 @@ def get(self, job_id): | |||||||
| job_output_path = job_output_path.lstrip('/') | ||||||||
| job_dir = os.path.join(self.storebase_mount, 'key-' + job_id) | ||||||||
| outgoing_dir = os.path.join(job_dir, 'outgoing') | ||||||||
|
|
||||||||
| if not os.path.exists(outgoing_dir): | ||||||||
| os.mkdir(outgoing_dir) | ||||||||
|
|
||||||||
| if self.storage_env == 'swift': | ||||||||
| storage = SwiftStorage(app.config) | ||||||||
| else: | ||||||||
| storage = S3Storage(app.config) | ||||||||
| content = storage.get_output_metadata( | ||||||||
| job_id, outgoing_dir, | ||||||||
| job_output_path=job_output_path) | ||||||||
| try: | ||||||||
| content = storage.get_output_metadata( | ||||||||
| job_id, outgoing_dir, | ||||||||
| job_output_path=job_output_path) | ||||||||
| except Exception as e: | ||||||||
| logger.error(f'Error fetching job {job_id} output ' | ||||||||
| f'metadata, detail: {str(e)}') | ||||||||
| abort(500, message=str(e)) | ||||||||
|
|
||||||||
| download_name = f'{job_id}.json' | ||||||||
| mimetype = 'application/json' | ||||||||
|
|
@@ -509,7 +520,12 @@ def get(self, job_id): | |||||||
| os.mkdir(outgoing_dir) | ||||||||
|
|
||||||||
| storage = ZipFileStorage(app.config) | ||||||||
| content = storage.get_data(job_id, outgoing_dir) | ||||||||
| try: | ||||||||
| content = storage.get_data(job_id, outgoing_dir) | ||||||||
| except Exception as e: | ||||||||
| logger.error(f'Error fetching job {job_id} output data, ' | ||||||||
| f'detail: {str(e)}') | ||||||||
| abort(500, message=str(e)) | ||||||||
| else: | ||||||||
| job_dir = os.path.join(self.storebase_mount, 'key-' + job_id) | ||||||||
| if not os.path.isdir(job_dir): | ||||||||
|
|
@@ -521,7 +537,12 @@ def get(self, job_id): | |||||||
|
|
||||||||
| if self.storage_env == 'zipfile': | ||||||||
| storage = ZipFileStorage(app.config) | ||||||||
| content = storage.get_data(job_id, outgoing_dir) | ||||||||
| try: | ||||||||
| content = storage.get_data(job_id, outgoing_dir) | ||||||||
| except Exception as e: | ||||||||
| logger.error(f'Error fetching job {job_id} output data, ' | ||||||||
| f'detail: {str(e)}') | ||||||||
| abort(500, message=str(e)) | ||||||||
|
|
||||||||
| logger.info(f'Successfully retrieved job {job_id} output data') | ||||||||
|
|
||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ LOW RISK
Suggestion: Consider using
logger.exceptionto ensure the full stack trace is captured in the logs before the worker exits, facilitating easier debugging of copy failures.