{"id":30421471,"url":"https://github.com/oven-sh/security-scanner-template","last_synced_at":"2026-02-26T02:31:47.590Z","repository":{"id":310902200,"uuid":"1038815328","full_name":"oven-sh/security-scanner-template","owner":"oven-sh","description":"Template for authoring Bun install security scanners","archived":false,"fork":false,"pushed_at":"2025-08-21T22:11:47.000Z","size":39,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-09T22:46:19.842Z","etag":null,"topics":["bun","install","security"],"latest_commit_sha":null,"homepage":"https://bun.com/docs/install/security-scanner-api","language":"TypeScript","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/oven-sh.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":"2025-08-15T21:45:16.000Z","updated_at":"2025-10-18T12:29:44.000Z","dependencies_parsed_at":"2025-08-20T23:39:40.784Z","dependency_job_id":"35ec3b96-ed99-419e-a121-feb8467d88b3","html_url":"https://github.com/oven-sh/security-scanner-template","commit_stats":null,"previous_names":["oven-sh/security-provider-template","oven-sh/security-scanner-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/oven-sh/security-scanner-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oven-sh%2Fsecurity-scanner-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oven-sh%2Fsecurity-scanner-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oven-sh%2Fsecurity-scanner-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oven-sh%2Fsecurity-scanner-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oven-sh","download_url":"https://codeload.github.com/oven-sh/security-scanner-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oven-sh%2Fsecurity-scanner-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29848634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T22:37:40.667Z","status":"online","status_checked_at":"2026-02-26T02:00:06.774Z","response_time":89,"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":["bun","install","security"],"created_at":"2025-08-22T09:02:12.620Z","updated_at":"2026-02-26T02:31:47.579Z","avatar_url":"https://github.com/oven-sh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://bun.com/logo.png\" height=\"36\" /\u003e\n\n# Bun Security Scanner Template\n\nA template for creating a security scanner for Bun's package installation\nprocess. Security scanners scan packages against your threat intelligence feeds\nand control whether installations proceed based on detected threats.\n\n📚 [**Full documentation**](https://bun.com/docs/install/security-scanner-api)\n\n## How It Works\n\nWhen packages are installed via Bun, your security scanner:\n\n1. **Receives** package information (name, version)\n2. **Queries** your threat intelligence API\n3. **Validates** the response data\n4. **Categorizes** threats by severity\n5. **Returns** advisories to control installation (empty array if safe)\n\n### Advisory Levels\n\n- **Fatal** (`level: 'fatal'`): Installation stops immediately\n  - Examples: malware, token stealers, backdoors, critical vulnerabilities\n- **Warning** (`level: 'warn'`): User prompted for confirmation\n  - In TTY: User can choose to continue or cancel\n  - Non-TTY: Installation automatically cancelled\n  - Examples: protestware, adware, deprecated packages\n\nAll advisories are always displayed to the user regardless of level.\n\n### Error Handling\n\nIf your `scan` function throws an error, it will be gracefully handled by Bun, but the installation process **will be cancelled** as a defensive precaution.\n\n### Validation\n\nWhen fetching threat feeds over the network, use schema validation  \n(e.g., Zod) to ensure data integrity. Invalid responses should fail immediately\nrather than silently returning empty advisories.\n\n```typescript\nimport {z} from 'zod';\n\nconst ThreatFeedItemSchema = z.object({\n\tpackage: z.string(),\n\tversion: z.string(),\n\turl: z.string().nullable(),\n\tdescription: z.string().nullable(),\n\tcategories: z.array(z.enum(['backdoor', 'botnet' /* ... */])),\n});\n```\n\n### Useful Bun APIs\n\nBun provides several built-in APIs that are particularly useful for security scanner:\n\n- [**Security scanner API Reference**](https://bun.com/docs/install/security-scanner-api): Complete API documentation for security scanners\n- [**`Bun.semver.satisfies()`**](https://bun.com/docs/api/semver): Essential for checking if package versions match vulnerability ranges. No external dependencies needed.\n\n  ```typescript\n  if (Bun.semver.satisfies(version, '\u003e=1.0.0 \u003c1.2.5')) {\n  \t// Version is vulnerable\n  }\n  ```\n\n- [**`Bun.hash`**](https://bun.com/docs/api/hashing#bun-hash): Fast hashing for package integrity checks\n- [**`Bun.file`**](https://bun.com/docs/api/file-io): Efficient file I/O, could be used for reading local threat databases\n\n## Testing\n\nThis template includes tests for a known malicious package version.\nCustomize the test file as needed.\n\n```bash\nbun test\n```\n\n## Publishing Your Provider\n\nPublish your security scanner to npm:\n\n```bash\nbun publish\n```\n\nUsers can now install your provider and add it to their `bunfig.toml` configuration.\n\nTo test locally before publishing, use [`bun link`](https://bun.sh/docs/cli/link):\n\n```bash\n# In your provider directory\nbun link\n\n# In your test project\nbun link @acme/bun # this is the name in package.json of your provider\n```\n\n## Contributing\n\nThis is a template repository. Fork it and customize for your organization's\nsecurity requirements.\n\n## Support\n\nFor docs and questions, see the [Bun documentation](https://bun.com/docs/install/security-scanner-api) or [Join our Discord](https://bun.com/discord).\n\nFor template issues, please open an issue in this repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foven-sh%2Fsecurity-scanner-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foven-sh%2Fsecurity-scanner-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foven-sh%2Fsecurity-scanner-template/lists"}