Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update references to OXO #20

Merged
merged 1 commit into from
Mar 18, 2024
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
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@ _Semgrep is a fast, open-source, static analysis engine for finding bugs, detect
---


This repository is an implementation of [Ostorlab Agent](https://pypi.org/project/ostorlab/) for [Semgrep](https://github.com/returntocorp/semgrep).
This repository is an implementation of [OXO Agent](https://pypi.org/project/ostorlab/) for [Semgrep](https://github.com/returntocorp/semgrep).

## Getting Started
To perform your first analysis, simply run the following command.
```shell
ostorlab scan run --install --agent agent/ostorlab/semgrep file code.c
oxo scan run --install --agent agent/ostorlab/semgrep file code.c
```

This command will download and install `agent/ostorlab/semgrep` and analyze the source file `code.c`.
For more information, please refer to the [Ostorlab Documentation](https://github.com/Ostorlab/ostorlab/blob/main/README.md)
For more information, please refer to the [OXO Documentation](https://oxo.ostorlab.co/docs)


## Usage

Agent Semgrep can be installed directly from the ostorlab agent store or built from this repository.
Agent Semgrep can be installed directly from the oxo agent store or built from this repository.

### Install directly from ostorlab agent store
### Install directly from oxo agent store

```shell
ostorlab agent install agent/ostorlab/semgrep
oxo agent install agent/ostorlab/semgrep
```

You can then run the agent with the following command:
`ostorlab scan run --install --agent agent/ostorlab/semgrep file code.c`
`oxo scan run --install --agent agent/ostorlab/semgrep file code.c`


### Build directly from the repository

1. To build the semgrep agent you need to have [ostorlab](https://pypi.org/project/ostorlab/) installed in your machine. If you have already installed ostorlab, you can skip this step.
1. To build the semgrep agent you need to have [oxo](https://pypi.org/project/ostorlab/) installed in your machine. If you have already installed oxo, you can skip this step.

```shell
pip3 install ostorlab
Expand All @@ -51,21 +51,21 @@ pip3 install ostorlab
git clone https://github.com/Ostorlab/agent_semgrep.git && cd agent_semgrep
```

3. Build the agent image using ostorlab cli.
3. Build the agent image using oxo cli.

```shell
ostorlab agent build --file=ostorlab.yaml
oxo agent build --file=ostorlab.yaml
```
You can pass the optional flag `--organization` to specify your organisation. The organization is empty by default.

4. Run the agent using on of the following commands:
* If you did not specify an organization when building the image:
```shell
ostorlab scan run --agent agent//semgrep file code.c
oxo scan run --agent agent//semgrep file code.c
```
* If you specified an organization when building the image:
```shell
ostorlab scan run --agent agent/[ORGANIZATION]/semgrep file code.c
oxo scan run --agent agent/[ORGANIZATION]/semgrep file code.c
```


Expand Down
1 change: 1 addition & 0 deletions agent/semgrep_agent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Ostorlab Agent implementation for Semgrep"""

import json
import logging
import subprocess
Expand Down
1 change: 1 addition & 0 deletions agent/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Utilities for Semgrep Agent"""

import dataclasses
import mimetypes
import requests
Expand Down
24 changes: 12 additions & 12 deletions ostorlab.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,47 @@ kind: Agent
name: semgrep
version: 0.3.2
description: |
This repository is an implementation of [Ostorlab Agent](https://pypi.org/project/ostorlab/) for [Semgrep](https://github.com/returntocorp/semgrep) by r2c.
This repository is an implementation of [OXO Agent](https://pypi.org/project/ostorlab/) for [Semgrep](https://github.com/returntocorp/semgrep) by r2c.
## Getting Started
To perform your first scan, simply run the following command:
```shell
ostorlab scan run --install --agent agent/ostorlab/semgrep file code.c
oxo scan run --install --agent agent/ostorlab/semgrep file code.c
```
This command will download and install `agent/ostorlab/semgrep` and analyze the file `code.c`.
For more information, please refer to the [Ostorlab Documentation](https://github.com/Ostorlab/ostorlab/blob/main/README.md)
For more information, please refer to the [OXO Documentation](https://oxo.ostorlab.co/docs)
## Usage
Agent Semgrep can be installed directly from the ostorlab agent store or built from this repository.
Agent Semgrep can be installed directly from the oxo agent store or built from this repository.

### Install directly from ostorlab agent store
### Install directly from oxo agent store
```shell
ostorlab agent install agent/ostorlab/semgrep
oxo agent install agent/ostorlab/semgrep
```
You can then run the agent with the following command:
```shell
ostorlab scan run --install --agent agent/ostorlab/semgrep file code.c
oxo scan run --install --agent agent/ostorlab/semgrep file code.c
```
### Build directly from the repository
1. To build the semgrep agent you need to have [ostorlab](https://pypi.org/project/ostorlab/) installed in your machine. if you have already installed ostorlab, you can skip this step.
1. To build the semgrep agent you need to have [oxo](https://pypi.org/project/ostorlab/) installed in your machine. if you have already installed oxo, you can skip this step.
```shell
pip3 install ostorlab
```
2. Clone this repository.
```shell
git clone https://github.com/Ostorlab/agent_semgrep.git && cd agent_semgrep
```
3. Build the agent image using ostorlab cli.
3. Build the agent image using oxo cli.
```shell
ostorlab agent build --file=ostorlab.yaml
oxo agent build --file=ostorlab.yaml
```
You can pass the optional flag `--organization` to specify your organisation. The organization is empty by default.
4. Run the agent using on of the following commands:
* If you did not specify an organization when building the image:
```shell
ostorlab scan run --agent agent//semgrep file code.c
oxo scan run --agent agent//semgrep file code.c
```
* If you specified an organization when building the image:
```shell
ostorlab scan run --agent agent/[ORGANIZATION]/semgrep file code.c
oxo scan run --agent agent/[ORGANIZATION]/semgrep file code.c
```
## License
[Apache-2.0](./LICENSE)
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""conftest for semgrep agent tests"""

import random
import pathlib
from typing import Any, cast
Expand Down
1 change: 1 addition & 0 deletions tests/semgrep_agent_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unittests for Semgrep agent."""

import subprocess

from ostorlab.agent.message import message
Expand Down
1 change: 1 addition & 0 deletions tests/utils_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unittests for Semgrep Agent Utilities"""

from typing import Any
import requests

Expand Down
Loading