Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"

[project]
name = "socketsecurity"
version = "2.2.86"
version = "2.2.88"
requires-python = ">= 3.11"
license = {"file" = "LICENSE"}
dependencies = [
Expand Down
2 changes: 1 addition & 1 deletion 2 socketsecurity/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__author__ = 'socket.dev'
__version__ = '2.2.86'
__version__ = '2.2.88'
USER_AGENT = f'SocketPythonCLI/{__version__}'
11 changes: 10 additions & 1 deletion 11 socketsecurity/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
},
"pnpm-workspace.yml": {
"pattern": "pnpm-workspace.yml"
},
"bun.lock": {
"pattern": "bun.lock"
},
"bun.lockb": {
"pattern": "bun.lockb"
},
"vlt-lock.json": {
"pattern": "vlt-lock.json"
}
},
"pypi": {
Expand Down Expand Up @@ -105,4 +114,4 @@
"pattern": "packages.lock.json"
}
}
}
}
43 changes: 43 additions & 0 deletions 43 tests/core/test_has_manifest_files.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
from unittest.mock import patch

from socketsecurity.core import Core
from socketsecurity.core.utils import socket_globs

# Minimal patterns matching what the Socket API returns
MOCK_PATTERNS = {
"npm": {
"packagejson": {"pattern": "package.json"},
"packagelockjson": {"pattern": "package-lock.json"},
"yarnlock": {"pattern": "yarn.lock"},
"bunlock": {"pattern": "bun.lock"},
"bunlockb": {"pattern": "bun.lockb"},
"vltlockjson": {"pattern": "vlt-lock.json"},
},
"pypi": {
"requirements": {"pattern": "*requirements.txt"},
Expand Down Expand Up @@ -66,3 +70,42 @@ def test_dot_slash_prefix_normalized(self, mock_patterns):
def test_pom_xml_root(self, mock_patterns):
core = Core.__new__(Core)
assert core.has_manifest_files(["pom.xml"]) is True

def test_bun_lock_root(self, mock_patterns):
core = Core.__new__(Core)
assert core.has_manifest_files(["bun.lock"]) is True

def test_bun_lockb_root(self, mock_patterns):
core = Core.__new__(Core)
assert core.has_manifest_files(["bun.lockb"]) is True

def test_vlt_lock_json_root(self, mock_patterns):
core = Core.__new__(Core)
assert core.has_manifest_files(["vlt-lock.json"]) is True

def test_bun_lock_subdirectory(self, mock_patterns):
core = Core.__new__(Core)
assert core.has_manifest_files(["apps/web/bun.lock"]) is True


@patch.object(Core, "get_supported_patterns", side_effect=RuntimeError("API unreachable"))
@patch.object(Core, "__init__", lambda self, *a, **kw: None)
class TestHasManifestFilesFallback:
"""Exercises the socket_globs fallback path used when the Socket API is unreachable."""

def test_fallback_matches_bun_lock(self, mock_patterns):
core = Core.__new__(Core)
assert core.has_manifest_files(["bun.lock"]) is True

def test_fallback_matches_bun_lockb(self, mock_patterns):
core = Core.__new__(Core)
assert core.has_manifest_files(["bun.lockb"]) is True

def test_fallback_matches_vlt_lock_json(self, mock_patterns):
core = Core.__new__(Core)
assert core.has_manifest_files(["vlt-lock.json"]) is True

def test_fallback_patterns_dict_contains_new_entries(self, mock_patterns):
assert "bun.lock" in socket_globs["npm"]
assert "bun.lockb" in socket_globs["npm"]
assert "vlt-lock.json" in socket_globs["npm"]
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.