Skip to content

Refactor saveJson to use path.resolve and validate path - #74

Open
mspandey wants to merge 1 commit into
madhav2348:mainfrom
mspandey:patch-3
Open

Refactor saveJson to use path.resolve and validate path#74
mspandey wants to merge 1 commit into
madhav2348:mainfrom
mspandey:patch-3

Conversation

@mspandey

Copy link
Copy Markdown

Summary

Remove unused createQueueWorker import from bootstrap module.

Changes Made

  • Removed the unused createQueueWorker import.
  • Kept existing queue processing behavior unchanged.

Why This Change?

The createQueueWorker symbol was imported but never referenced within the module. This can trigger lint warnings and make the code harder to maintain by suggesting functionality that is not actually used.

Impact

  • Resolves unused import warnings.
  • Improves code readability.
  • No functional changes to application behavior.

Update path handling in saveJson method to ensure safety.## Summary

Prevent directory traversal when saving files to filesystem storage.

## Changes Made

* Added validation to ensure generated file paths remain within the configured storage directory.
* Replaced direct path joining with resolved path verification.

## Why This Change?

The storage layer constructs file paths using a provided relative path. Without validation, specially crafted paths could potentially escape the intended storage directory and write files elsewhere on the filesystem.

This change ensures all saved files remain inside the configured storage location.

## Impact

* Improves filesystem safety.
* Prevents potential directory traversal issues.
* Maintains existing behavior for valid storage paths.
@github-actions

Copy link
Copy Markdown

🎉 Thanks for submitting a PR, @mspandey!

Please confirm the following checklist before review:

  • ⭐ I have starred this repository
  • 🍴 I have forked this repository
  • 📖 I have read the Contributing Guidelines
  • 🔀 My changes are pushed to the develop branch

A maintainer will review your PR shortly. Thank you! 🚀

@madhav2348 madhav2348 added the invalid This doesn't seem right label Jun 19, 2026
@madhav2348

Copy link
Copy Markdown
Owner

ESOC or SSOC ? and please read contribution guidlines

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

Labels

invalid This doesn't seem right

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants