Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

dacoburn
Copy link
Collaborator

This PR adds support for a base_paths parameter to fullscans and diffscans functionality, allowing users to specify multiple base directory paths to strip from uploaded file keys for cleaner file organization in Socket scans.

Why?

Currently, users can only specify a single base_path to strip from file paths when uploading files for scanning. In complex projects with multiple source directories or monorepo structures, users may need to strip different base paths from different files to create clean, organized file keys in their Socket scans.

This feature enables users to specify multiple base paths in a list, allowing for more flexible file organization. For example, files from /home/user/project/src/ and /opt/app/config/ can both be properly organized by stripping their respective base paths.

Benefits:

  • Support for complex project structures with multiple base directories
  • Cleaner file organization in Socket scan results
  • Maintains full backward compatibility with existing base_path parameter
  • Works with both lazy loading and regular file uploading
  • Follows existing SDK patterns and conventions

Public Changelog

Added base_paths parameter to FullScans.post() and DiffScans.create_from_repo() methods to support stripping multiple base directory paths from uploaded file keys. This enables cleaner file organization in Socket scans for complex project structures. The existing base_path parameter remains fully supported for backward compatibility.

- Add base_paths parameter to Utils.load_files_for_sending_lazy() to support multiple base paths for file key stripping
- Update FullScans.post() method to accept base_paths parameter with lazy loading support
- Update DiffScans.create_from_repo() method to accept base_paths parameter
- Maintain backward compatibility with existing base_path parameter
- Fix test issues: correct fullscans.get() usage in comprehensive integration test
- Update test expectations to match correct API path handling (path segments vs query params)

The base_paths parameter takes precedence over base_path when both are provided,
allowing users to specify multiple directory paths to strip from uploaded file keys
for cleaner file organization in Socket scans.
@dacoburn dacoburn requested a review from a team as a code owner September 12, 2025 15:25
@dacoburn dacoburn added the product changelog Any public-facing change in the product's features label Sep 12, 2025
@dacoburn dacoburn requested review from Raynos and reberhardt7 and removed request for a team September 12, 2025 15:25
Copy link

🚀 Preview package published!

Install with:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketdev==3.0.6.dev1

@dacoburn dacoburn merged commit fab2f79 into main Sep 12, 2025
6 checks passed
@dacoburn dacoburn deleted the doug/add-support-for-sub-paths branch September 12, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product changelog Any public-facing change in the product's features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants