{"id":21557229,"url":"https://github.com/kernel-loophole/post-proxy","last_synced_at":"2025-10-09T00:41:59.116Z","repository":{"id":258564767,"uuid":"874179365","full_name":"kernel-loophole/post-proxy","owner":"kernel-loophole","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-17T11:44:09.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-19T15:34:29.620Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kernel-loophole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-10-17T11:41:24.000Z","updated_at":"2024-10-17T11:44:12.000Z","dependencies_parsed_at":"2024-10-19T15:34:36.738Z","dependency_job_id":"781b611e-9b56-4f46-8bad-d80f887b537b","html_url":"https://github.com/kernel-loophole/post-proxy","commit_stats":null,"previous_names":["kernel-loophole/post-proxy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kernel-loophole/post-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel-loophole%2Fpost-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel-loophole%2Fpost-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel-loophole%2Fpost-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel-loophole%2Fpost-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kernel-loophole","download_url":"https://codeload.github.com/kernel-loophole/post-proxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kernel-loophole%2Fpost-proxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000640,"owners_count":26082879,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-24T08:11:42.180Z","updated_at":"2025-10-09T00:41:59.098Z","avatar_url":"https://github.com/kernel-loophole.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust PostgreSQL Proxy API\n\nThis project provides a secure API for authenticating users and selectively exposing a PostgreSQL database. The API implements rate limiting and IP whitelisting to ensure that only authorized users can access their database schemas. It is designed for environments where exposing the database publicly is not an option, allowing users to opt into direct access\n\n## Table of Contents\n\n- [Features](#features)\n- [Prerequisites](#prerequisites)\n- [Getting Started](#getting-started)\n- [API Endpoints](#api-endpoints)\n- [Usage](#usage)\n- [Configuration](#configuration)\n- [License](#license)\n\n## Features\n\n- **User Authentication**: Validate user credentials against the PostgreSQL database.\n- **Rate Limiting**: Prevent abuse by limiting the number of login attempts.\n- **IP Whitelisting**: Allow users to specify which IP addresses can access their database.\n- **Opt-in Database Exposure**: Users can choose to expose their PostgreSQL database safely.\n\n## Prerequisites\n\nMake sure you have the following installed:\n\n- Rust (latest stable version)\n- PostgreSQL\n- Cargo (comes with Rust installation)\n\n## Getting Started\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/kernel-loophole/post-proxy.git\n    cd post-proxy\n    ```\n\n2. Set up your PostgreSQL database and create the necessary tables for user credentials.\n\n3. Update your `.env` file or configuration section in the code to include your database credentials.\n\n4. Build the project:\n\n    ```bash\n    cargo build\n    ```\n\n5. Run the application:\n\n    ```bash\n    cargo run\n    ```\n\n## API Endpoints\n\n### Authenticate User\n\n- **Endpoint**: `POST /auth`\n- **Description**: Authenticates a user based on the provided credentials and IP address.\n- **Request Body**:\n\n```json\n{\n    \"psql\": \"your_psql_username\",\n    \"password\": \"your_password\",\n    \"ip\": \"user_ip_address\",\n    \"db_host\": \"database_host\",\n    \"db_user\": \"database_username\",\n    \"db_password\": \"database_password\",\n    \"db_name\": \"database_name\"\n}\n```\nalso you can use it using curl \n```curl\ncurl -X POST http://127.0.0.1:8080/auth -H \"Content-Type: application/json\" -d '{\"username\": \"postgres\", \"password\": \"new_password\", \"ip\": \"localhost\", \"db_host\": \"127.0.0.1\", \"db_user\": \"postgres\", \"db_password\": \"new_password\", \"db_name\": \"my_database\"}'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernel-loophole%2Fpost-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkernel-loophole%2Fpost-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkernel-loophole%2Fpost-proxy/lists"}