Skip to content

Commit 6bf01bf

Browse files
authored
fix(ci): restrict SCM diffs to pull requests
1 parent 0e03a6f commit 6bf01bf

2 files changed

Lines changed: 4 additions & 18 deletions

File tree

socketsecurity/socketcli.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,8 @@ def _select_pull_request_provider(integration_type: str, scm_type: str) -> str:
133133
return scm_type if scm_type in ("github", "gitlab") else integration_type
134134

135135

136-
def _should_create_scm_diff(
137-
event_type: str,
138-
enable_diff: bool = False,
139-
force_diff_mode: bool = False,
140-
) -> bool:
141-
return event_type == "diff" or enable_diff or force_diff_mode
136+
def _should_create_scm_diff(event_type: str) -> bool:
137+
return event_type == "diff"
142138

143139

144140
def build_socket_sdk(config: CliConfig) -> socketdev:
@@ -745,11 +741,7 @@ def _is_unprocessed(c):
745741

746742
elif scm is not None and not force_api_mode:
747743
log.info("Push initiated flow")
748-
if _should_create_scm_diff(
749-
scm_event_type,
750-
enable_diff=config.enable_diff,
751-
force_diff_mode=force_diff_mode,
752-
):
744+
if _should_create_scm_diff(scm_event_type):
753745
log.info("Starting comment logic for PR/MR event")
754746
diff = core.create_new_diff(
755747
scan_paths,

tests/unit/test_socketcli.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,10 @@ def test_scm_merge_request_event_creates_diff():
7878
assert socketcli._should_create_scm_diff("diff") is True
7979

8080

81-
def test_scm_branch_event_defaults_to_full_scan():
81+
def test_scm_branch_event_always_uses_full_scan():
8282
assert socketcli._should_create_scm_diff("main") is False
8383

8484

85-
@pytest.mark.parametrize("override", ["enable_diff", "force_diff_mode"])
86-
def test_scm_branch_event_honors_diff_override(override):
87-
options = {override: True}
88-
assert socketcli._should_create_scm_diff("main", **options) is True
89-
90-
9185
# ---------------------------------------------------------------------------
9286
# Buildkite-aware infrastructure error formatting.
9387
# ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)