{"id":25934405,"url":"https://github.com/sanand0/staticauth","last_synced_at":"2026-02-09T08:06:24.001Z","repository":{"id":270281500,"uuid":"909743205","full_name":"sanand0/staticauth","owner":"sanand0","description":"A minimal static file server with authentication.","archived":false,"fork":false,"pushed_at":"2025-01-20T13:06:09.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T11:00:00.286Z","etag":null,"topics":["tool"],"latest_commit_sha":null,"homepage":"","language":"Python","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/sanand0.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,"zenodo":null}},"created_at":"2024-12-29T16:43:11.000Z","updated_at":"2025-04-17T07:00:57.000Z","dependencies_parsed_at":"2024-12-30T01:27:48.509Z","dependency_job_id":"8e70c2b7-e11c-470f-9488-6b441ea02e3d","html_url":"https://github.com/sanand0/staticauth","commit_stats":null,"previous_names":["sanand0/staticauth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sanand0/staticauth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanand0%2Fstaticauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanand0%2Fstaticauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanand0%2Fstaticauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanand0%2Fstaticauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanand0","download_url":"https://codeload.github.com/sanand0/staticauth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanand0%2Fstaticauth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29259483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["tool"],"created_at":"2025-03-04T00:57:44.322Z","updated_at":"2026-02-09T08:06:23.983Z","avatar_url":"https://github.com/sanand0.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Static Auth\n\nA minimal static file server with Google OAuth authentication.\n\n- Serves static files from current directory\n- Google OAuth authentication\n- Email-based access control via regex patterns\n- Blocks access to dotfiles (`.git`, `.env`, etc.)\n- CORS enabled\n\n## Usage\n\n1. Create OAuth credentials at [Google Cloud Console](https://console.cloud.google.com/apis/credentials)\n   - Set authorized redirect URI to `http://localhost:8000/googleauth/`\n   - If you're deploying at `https://yourdomain.com/`, add `https://yourdomain.com/googleauth/`\n2. In the folder where you want to serve files, create a `.env` file with the following variables. (Or set them as environment variables.) This is typically done using CI/CD pipelines.\n\n   ```env\n   GOOGLE_CLIENT_ID=your-client-id\n   GOOGLE_CLIENT_SECRET=your-client-secret\n   REDIRECT_URI=http://localhost:8000/googleauth/\n   PORT=8000  # Optional, defaults to 8000\n   AUTH=*@yourdomain.com,specific@email.com  # Optional, defaults to all emails\n   ```\n\n3. Run the server:\n\n   ```bash\n   uv run https://raw.githubusercontent.com/sanand0/staticauth/main/app.py\n   ```\n\nOpen the browser and navigate to `http://localhost:8000`. Only users that match the pattern in `AUTH` will be able to access the files.\n\n## Restricting access\n\nThe `AUTH` environment variable is a comma-separated list of email patterns. The patterns are matched against the email address of the user. For example:\n\n- `*@example.com` matches all emails from `example.com`\n- `user@example.com` matches only `user@example.com`\n- `user*@example.com` matches all emails from `example.com` that start with `user`\n- `*user@example.com` matches all emails from `example.com` that end with `user`\n- `*@*.edu` matches all emails from all `.edu` domains\n- `*` matches all emails (default if no AUTH or .auth file exists)\n\nYou can also use a `.auth` file in the folder to restrict access, useful to commit email patterns in the repository.\n\nThe `.auth` file is a text file with one pattern per line. The patterns are matched against the email address of the user. For example:\n\n```text\n*@example.com       # Allow all emails from example.com\nuser@example.com    # Allow user@example.com\n*@*.edu             # Allow all emails from all .edu domains\n```\n\n**NOTE:**\n\n- The `.auth` file and environment variables are cached. Restart the server if you change either.\n- For security, the server blocks access to all dotfiles (files/folders starting with `.`)\n- Files are served with cache headers (1 hour private cache) and security headers\n- If the server fails to bind to 0.0.0.0, it will fall back to 127.0.0.1 (localhost only)\n\n## Testing\n\n```bash\nuv run test_app.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanand0%2Fstaticauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanand0%2Fstaticauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanand0%2Fstaticauth/lists"}