{"id":30359105,"url":"https://github.com/sam701/rtask","last_synced_at":"2025-08-19T11:22:49.771Z","repository":{"id":308325499,"uuid":"1030364065","full_name":"sam701/rtask","owner":"sam701","description":"RTask is a secure task runner with API key management that exposes system commands as HTTP endpoints.","archived":false,"fork":false,"pushed_at":"2025-08-05T09:20:06.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-05T11:27:41.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sam701.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,"zenodo":null}},"created_at":"2025-08-01T14:08:26.000Z","updated_at":"2025-08-05T09:20:08.000Z","dependencies_parsed_at":"2025-08-10T13:16:37.141Z","dependency_job_id":null,"html_url":"https://github.com/sam701/rtask","commit_stats":null,"previous_names":["sam701/rtask"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/sam701/rtask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Frtask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Frtask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Frtask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Frtask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sam701","download_url":"https://codeload.github.com/sam701/rtask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam701%2Frtask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271144062,"owners_count":24706518,"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-08-19T02:00:09.176Z","response_time":63,"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":"2025-08-19T11:22:46.143Z","updated_at":"2025-08-19T11:22:49.764Z","avatar_url":"https://github.com/sam701.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RTask\n\nRTask is a secure task runner with API key management that exposes system commands as HTTP endpoints. It provides authenticated access to configured tasks with rate limiting, metrics collection, and secure API key management.\n\n## Features\n\n- **Secure API Key Management**: Argon2-based key hashing with CBOR encoding\n- **Rate Limiting**: Configurable per-task rate limiting to prevent abuse\n- **Metrics Collection**: Prometheus metrics for monitoring task execution and rejections\n- **Task Configuration**: TOML-based configuration for defining tasks and their permissions\n- **Concurrent Safety**: Mutex-based locking to prevent concurrent task execution\n- **Flexible Execution**: Support for both blocking and non-blocking task execution\n\n## Installation\n\n### Prerequisites\n\n- Go 1.24.3 or later\n- Optional: [just](https://github.com/casey/just) for build automation\n\n### Build from Source\n\n```bash\ngit clone \u003crepository-url\u003e\ncd rtask.go\ngo build\n```\n\nOr using just:\n\n```bash\njust build\n```\n\n## Configuration\n\nRTask uses TOML configuration files to define tasks and API key settings.\n\n### Main Configuration (`config.toml`)\n\n```toml\napiKeysFile = \"./api-keys.toml\"\n\n[tasks.hello]\ncommand = [\"./test.nu\"]\napiKeyNames = [\"a1\", \"a3\"]\nblocking = true\nrateLimit = 1.0\n\n[tasks.build]\ncommand = [\"make\", \"build\"]\nworkdir = \"/path/to/project\"\napiKeyNames = [\"github-action\"]\nblocking = false\nrateLimit = 0.5\n```\n\n### Task Configuration Options\n\n- `command`: Array of command and arguments to execute\n- `workdir`: Working directory for command execution (optional)\n- `apiKeyNames`: List of API key names that can access this task\n- `blocking`: If true, streams stdout/stderr to HTTP response; if false, runs asynchronously\n- `rateLimit`: Requests per second (default: 0.5)\n\n## Usage\n\n### Starting the Server\n\n```bash\n# Start with default configuration\n./rtask run\n\n# Start with custom configuration and addresses\n./rtask run --config ./my-config.toml --api-address localhost:8080 --metrics-address localhost:9091\n```\n\n### Managing API Keys\n\n```bash\n# Add a new API key\n./rtask add-key my-key-name\n```\n\nThis will output an API key that can be used to authenticate requests.\n\n### Making Requests\n\nSend HTTP requests to task endpoints with Bearer authentication:\n\n```bash\n# Execute a task\ncurl -X POST \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -d \"input data\" \\\n  http://localhost:8800/tasks/hello\n```\n\n### Monitoring\n\nPrometheus metrics are available at the metrics endpoint:\n\n```bash\ncurl http://localhost:9090/metrics\n```\n\nAvailable metrics:\n- `task_duration_seconds`: Histogram of task execution times\n- `task_rejection_total`: Counter of rejected requests by reason\n\n## API Endpoints\n\n- `POST /tasks/{task-name}`: Execute the specified task\n- `GET /metrics`: Prometheus metrics endpoint\n\n## Security Features\n\n- **API Key Hashing**: Keys are hashed using Argon2 with configurable parameters\n- **Bearer Token Authentication**: Standard HTTP Bearer token authentication\n- **Rate Limiting**: Per-task rate limiting to prevent abuse\n- **Concurrent Execution Control**: Mutex locking prevents multiple simultaneous executions\n- **Secure Key Storage**: API keys are stored in TOML files with restricted permissions (0600)\n\n## Error Responses\n\n- `401 Unauthorized`: Missing or invalid API key\n- `429 Too Many Requests`: Rate limit exceeded or task already running\n- `500 Internal Server Error`: Task execution failed\n\n## Development\n\n### Running in Debug Mode\n\n```bash\nGO_LOG=debug ./rtask run\n```\n\n### Using Just\n\n```bash\n# Build the project\njust build\n\n# Run with debug logging\njust run run --config config.toml\n```\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam701%2Frtask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsam701%2Frtask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam701%2Frtask/lists"}