{"id":18487132,"url":"https://github.com/botirk38/guardianai","last_synced_at":"2025-04-08T20:30:41.172Z","repository":{"id":226668161,"uuid":"769338129","full_name":"botirk38/GuardianAI","owner":"botirk38","description":"Safe Contracts is a tool that analyzes smart contracts for security vulnerabilities. It uses AI to detect common security issues in Solana code. The tool is accessible through an API that can be used to analyze smart contracts programmatically.","archived":false,"fork":false,"pushed_at":"2024-06-19T13:52:49.000Z","size":635239,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T17:48:53.630Z","etag":null,"topics":["ai","rust","security","solana"],"latest_commit_sha":null,"homepage":"https://www.smart-guardian.com/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/botirk38.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-08T20:53:58.000Z","updated_at":"2024-07-30T16:16:58.000Z","dependencies_parsed_at":"2024-03-14T12:28:51.280Z","dependency_job_id":"bc792cb6-97b8-48c4-b67f-1edb4e5b2d1a","html_url":"https://github.com/botirk38/GuardianAI","commit_stats":null,"previous_names":["botirk38/guardianai"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/botirk38%2FGuardianAI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/botirk38%2FGuardianAI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/botirk38%2FGuardianAI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/botirk38%2FGuardianAI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/botirk38","download_url":"https://codeload.github.com/botirk38/GuardianAI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247922636,"owners_count":21018835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","rust","security","solana"],"created_at":"2024-11-06T12:50:14.696Z","updated_at":"2025-04-08T20:30:40.832Z","avatar_url":"https://github.com/botirk38.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Project: Safe Contracts API\n\nSafe Contracts is a tool that analyzes smart contracts for security vulnerabilities. It uses static analysis to detect common security issues in Solana code. The tool is accessible through an API that can be used to analyze smart contracts programmatically.\n\n## Table of Contents\n\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Running with Docker Compose](#running-with-docker-compose)\n- [Calling the API](#calling-the-api)\n  - [Authentication](#authentication)\n  - [Connect to WebSocket](#connect-to-websocket)\n  - [Direct API Call](#direct-api-call)\n- [Using the Extension](#using-the-extension)\n- [Troubleshooting](#troubleshooting)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Prerequisites\n\nBefore you begin, ensure you have the following installed on your machine:\n\n- Docker\n- Docker Compose\n\n## Installation\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/botirk38/GuardianAI.git\n    cd GuardianAI\n    ```\n\n## Running with Docker Compose\n\nTo build and run the services using Docker Compose, follow these steps:\n\n1. **Navigate to the root directory of the project:**\n\n    ```bash\n    cd GuardianAI\n    ```\n\n2. **Build and run the containers:**\n\n    ```bash\n    docker-compose -f docker-compose.yml up --build\n    ```\n\nThis will start the Spring Cloud Gateway on `http://localhost:8080` and the `code-detective` service on `http://localhost:8081`.\n\n## Calling the API\n\nYou can interact with the `code-detective` service through the API Gateway.\n\n### Authentication\n\nObtain an access token from Auth0:\n\n```bash\ncurl --request POST \\\n  --url https://dev-az3di7fabdoc8vlz.uk.auth0.com/oauth/token \\\n  --header 'content-type: application/json' \\\n  --data '{\"client_id\":\"your_client_id\",\"client_secret\":\"your_client_secret\",\"audience\":\"https://safe-contracts/\",\"grant_type\":\"client_credentials\"}'\n```\n\nReplace `your_client_id` and `your_client_secret` with your Auth0 client ID and client secret, which can be obtained from the Auth0 dashboard.\n\n### Connect to WebSocket\n\nConnect to the WebSocket to receive the response from the API call:\n\n```bash\ncurl -i -N \\\n  -H \"Connection: Upgrade\" \\\n  -H \"Upgrade: websocket\" \\\n  -H \"Host: localhost:8080\" \\\n  -H \"Origin: http://localhost:8080\" \\\n  -H \"Sec-WebSocket-Version: 13\" \\\n  -H \"Sec-WebSocket-Key: $(echo -n $RANDOM | base64)\" \\\n  http://localhost:8080/code-detective-model/ws/your_request_id\n```\n\n### Direct API Call\n\nTo call the `analyze_code` endpoint directly, use the following `curl` command:\n\n```bash\ncurl -X POST http://localhost:8080/code-detective/analyze_code \\\n     -H \"Authorization: Bearer YOUR_JWT_TOKEN\" \\\n     -H \"Content-Type: application/json\" \\\n     -d '{\"code\": \"your code here\", \"request_id\": \"request_id here\"}'\n```\n\nReplace `YOUR_JWT_TOKEN` with a valid JWT token and `{\"code\": \"your code here\", \"request_id\": \"request_id here\"}` with the appropriate payload for your request.\n\n## Using the Extension\n\nYou can also use the Safe Contracts VS Code extension that interacts with the API Gateway to analyze your code for vulnerabilities. The extension is available in the `smartguardian` directory.\n\n## Troubleshooting\n\n- **503 Service Unavailable:** Ensure that both the Spring Cloud Gateway and `code-detective` service are running. Verify that the services can communicate within the Docker network.\n- **OAuth2 Issues:** Ensure your Okta OAuth2 configuration is correct in the `application.yml` file of the `api_gateway` service. Verify that the issuer and audience values are properly set.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbotirk38%2Fguardianai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbotirk38%2Fguardianai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbotirk38%2Fguardianai/lists"}