Skip to content

Commit c6953f8

Browse files
authored
Revert "Initial suspicious commands (#917)" (#930)
This reverts commit f0c387f.
1 parent a3f3643 commit c6953f8

File tree

10 files changed

+40
-6804
lines changed

10 files changed

+40
-6804
lines changed

poetry.lock

+37-622
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ sqlite-vec-sl-tmp = "==0.0.4"
3232
greenlet = "==3.1.1"
3333
cachetools = "==5.5.1"
3434
legacy-cgi = "==2.6.2"
35-
torch = "==2.6.0"
36-
pandas = "==2.2.3"
3735

3836
[tool.poetry.group.dev.dependencies]
3937
pytest = "==8.3.4"

src/codegate/pipeline/extract_snippets/output.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from codegate.pipeline.base import AlertSeverity, CodeSnippet, PipelineContext
99
from codegate.pipeline.extract_snippets.extract_snippets import extract_snippets
1010
from codegate.pipeline.output import OutputPipelineContext, OutputPipelineStep
11-
from codegate.pipeline.suspicious_commands.suspicious_commands import SuspiciousCommands
1211
from codegate.storage import StorageEngine
1312
from codegate.utils.package_extractor import PackageExtractor
1413

@@ -43,23 +42,13 @@ def _create_chunk(self, original_chunk: ModelResponse, content: str) -> ModelRes
4342

4443
async def _snippet_comment(self, snippet: CodeSnippet, context: PipelineContext) -> str:
4544
"""Create a comment for a snippet"""
46-
comment = ""
47-
sc = SuspiciousCommands.get_instance()
48-
class_, prob = await sc.classify_phrase(snippet.code)
49-
if class_ == 1:
50-
liklihood = "possibly"
51-
language = "code"
52-
if prob > 0.9:
53-
liklihood = "likely"
54-
if snippet.language is not None:
55-
language = snippet.language
56-
comment = f"{comment}\n\n🛡️ CodeGate: The {language} supplied is {liklihood} unsafe. Please check carefully!\n\n" # noqa: E501
5745

46+
# extract imported libs
5847
snippet.libraries = PackageExtractor.extract_packages(snippet.code, snippet.language)
5948

6049
# If no libraries are found, just return empty comment
6150
if len(snippet.libraries) == 0:
62-
return comment
51+
return ""
6352

6453
# Check if any of the snippet libraries is a bad package
6554
storage_engine = StorageEngine()
@@ -93,7 +82,7 @@ async def _snippet_comment(self, snippet: CodeSnippet, context: PipelineContext)
9382
)
9483

9584
# Add a codegate warning for the bad packages found in the snippet
96-
comment = f"{comment}\n\nWarning: CodeGate detected one or more potentially malicious or \
85+
comment = f"\n\nWarning: CodeGate detected one or more potentially malicious or \
9786
archived packages: {libobjects_text}\n"
9887
comment += "\n### 🚨 Warnings\n" + "\n".join(warnings) + "\n"
9988

Binary file not shown.

src/codegate/pipeline/suspicious_commands/suspicious_commands.py

-189
This file was deleted.

tests/data/suspicious_commands/benign_test_cmds.csv

-34
This file was deleted.

tests/data/suspicious_commands/malicious_test_cmds.csv

-18
This file was deleted.

0 commit comments

Comments
 (0)