{"id":37703512,"url":"https://github.com/quiltdata/raja","last_synced_at":"2026-04-01T17:34:26.246Z","repository":{"id":332429181,"uuid":"1133668076","full_name":"quiltdata/raja","owner":"quiltdata","description":"Resource Authorization JWT Authority for Software-Defined Authorization","archived":false,"fork":false,"pushed_at":"2026-03-25T00:40:28.000Z","size":1498,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-25T05:46:14.881Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quiltdata.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-01-13T16:55:08.000Z","updated_at":"2026-03-19T20:45:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/quiltdata/raja","commit_stats":null,"previous_names":["quiltdata/raja"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/quiltdata/raja","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiltdata%2Fraja","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiltdata%2Fraja/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiltdata%2Fraja/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiltdata%2Fraja/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quiltdata","download_url":"https://codeload.github.com/quiltdata/raja/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quiltdata%2Fraja/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31290537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-16T13:05:17.612Z","updated_at":"2026-04-01T17:34:26.237Z","avatar_url":"https://github.com/quiltdata.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RAJA\n\nThis README is intentionally short and focused on day-to-day usage.\n\nFor architecture, design notes, tests, and deeper docs, see [AGENTS.md](AGENTS.md).\n\n## Target Workflow\n\n1. Set env and deploy the stack.\n2. Use the Admin UI and/or call RALE via `boto3`.\n3. Add S3 buckets for testing.\n\n## 1) Set Env And Deploy\n\nPrereqs:\n- AWS credentials configured locally\n- `uv`, `terraform`, `docker`\n\n```bash\nuv sync\n\n# one-time (if missing)\ncp infra/terraform/terraform.tfvars.example infra/terraform/terraform.tfvars\n\n# required admin key used by protected control-plane endpoints\ncat \u003e .env \u003c\u003c'ENV'\nRAJA_ADMIN_KEY=change-me-admin-key\nRAJA_USERS=ernest-staging,kevin-staging,simon-staging\nENV\n\n./poe deploy\npython scripts/show_outputs.py\n```\n\n`./poe deploy` writes deployment outputs to `infra/tf-outputs.json`.\n\n## 2) Run Admin UI\n\n```bash\nexport API_URL=\"$(python - \u003c\u003c'PY'\nimport json\nprint(json.load(open('infra/tf-outputs.json'))['api_url'])\nPY\n)\"\n\nopen \"$API_URL\"\n```\n\n- Browse to `/` for the Admin UI.\n- Enter the same `RAJA_ADMIN_KEY` you used for deploy.\n- The Token and Enforcement forms default to the first `RAJA_USERS` entry from `.env`.\n\nQuick API check:\n\n```bash\ncurl -sS \"$API_URL/principals\" \\\n  -H \"Authorization: Bearer $RAJA_ADMIN_KEY\"\n```\n\n## 3) Call RALE With boto3\n\nThis uses the RAJEE endpoint (which fronts RALE) with normal S3 API calls.\n\n```bash\nexport API_URL=\"$(python - \u003c\u003c'PY'\nimport json\no=json.load(open('infra/tf-outputs.json'))\nprint(o['api_url'])\nPY\n)\"\nexport RAJEE_ENDPOINT=\"$(python - \u003c\u003c'PY'\nimport json\no=json.load(open('infra/tf-outputs.json'))\nprint(o['rajee_endpoint'])\nPY\n)\"\nexport TEST_BUCKET=\"$(python - \u003c\u003c'PY'\nimport json\no=json.load(open('infra/tf-outputs.json'))\nprint(o['rajee_test_bucket_name'])\nPY\n)\"\n\n# create a principal with test-bucket permissions\nexport DEMO_PRINCIPAL=\"$(python - \u003c\u003c'PY'\nimport os\nimport boto3\n\nusers = [u.strip() for u in os.environ[\"RAJA_USERS\"].split(\",\") if u.strip()]\naccount_id = boto3.client(\"sts\").get_caller_identity()[\"Account\"]\nprint(f\"arn:aws:iam::{account_id}:user/{users[0]}\")\nPY\n)\"\n\ncurl -sS -X POST \"$API_URL/principals\" \\\n  -H \"Authorization: Bearer $RAJA_ADMIN_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"principal\\\":\\\"${DEMO_PRINCIPAL}\\\",\\\"scopes\\\":[\\\"S3Object:${TEST_BUCKET}/*:s3:GetObject\\\",\\\"S3Object:${TEST_BUCKET}/*:s3:PutObject\\\",\\\"S3Bucket:${TEST_BUCKET}:s3:ListBucket\\\"]}\"\n\n# mint a RAJEE token for that principal\nexport RAJEE_TOKEN=\"$(curl -sS -X POST \"$API_URL/token\" \\\n  -H \"Authorization: Bearer $RAJA_ADMIN_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \"{\\\"principal\\\":\\\"${DEMO_PRINCIPAL}\\\",\\\"token_type\\\":\\\"rajee\\\"}\" | python -c 'import sys,json; print(json.load(sys.stdin)[\"token\"])')\"\n```\n\n```python\nimport os\nimport boto3\nfrom botocore.config import Config\n\nregion = os.environ.get(\"AWS_REGION\") or os.environ.get(\"AWS_DEFAULT_REGION\") or \"us-east-1\"\nendpoint = os.environ[\"RAJEE_ENDPOINT\"]\ntoken = os.environ[\"RAJEE_TOKEN\"]\nbucket = os.environ[\"TEST_BUCKET\"]\n\ns3 = boto3.client(\n    \"s3\",\n    endpoint_url=endpoint,\n    region_name=region,\n    config=Config(s3={\"addressing_style\": \"path\"}),\n)\n\ndef _headers(request, **_):\n    request.headers[\"Host\"] = f\"s3.{region}.amazonaws.com\"\n    request.headers[\"x-raja-authorization\"] = f\"Bearer {token}\"\n\ns3.meta.events.register(\"before-sign.s3\", _headers)\n\ns3.put_object(Bucket=bucket, Key=\"rajee-integration/hello.txt\", Body=b\"hello\")\nprint(s3.get_object(Bucket=bucket, Key=\"rajee-integration/hello.txt\")[\"Body\"].read())\nprint([x[\"Key\"] for x in s3.list_objects_v2(Bucket=bucket, Prefix=\"rajee-integration/\").get(\"Contents\", [])])\n```\n\n## 4) Add Buckets To Test With\n\n1. Add a new `aws_s3_bucket` (+ versioning/encryption/public-access-block) in `infra/terraform/main.tf`.\n2. Add that bucket ARN to both IAM policies in `infra/terraform/main.tf`:\n   - `aws_iam_role_policy.rale_router_permissions`\n   - `aws_iam_role_policy.rajee_task_permissions`\n3. Add an output in `infra/terraform/outputs.tf` if you want the bucket name in `infra/tf-outputs.json`.\n4. Re-deploy:\n\n```bash\n./poe deploy\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquiltdata%2Fraja","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquiltdata%2Fraja","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquiltdata%2Fraja/lists"}