{"id":32300141,"url":"https://github.com/evandersondev/darto_security","last_synced_at":"2026-02-20T23:01:30.032Z","repository":{"id":287983709,"uuid":"966451755","full_name":"evandersondev/darto_security","owner":"evandersondev","description":"The darto_security package provides a set of plug-and-play middlewares inspired by Helmet.js to improve the security of your Darto application. These middlewares help protect your API against common threats like XSS, CSRF, request spamming, and more.","archived":false,"fork":false,"pushed_at":"2025-08-29T19:45:31.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-23T05:18:56.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/darto_security","language":"Dart","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/evandersondev.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}},"created_at":"2025-04-15T00:15:53.000Z","updated_at":"2025-10-07T18:13:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"d3f9ffe2-588e-497a-bf64-7a85f022a8e1","html_url":"https://github.com/evandersondev/darto_security","commit_stats":null,"previous_names":["evandersondev/darto_security"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/evandersondev/darto_security","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evandersondev%2Fdarto_security","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evandersondev%2Fdarto_security/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evandersondev%2Fdarto_security/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evandersondev%2Fdarto_security/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/evandersondev","download_url":"https://codeload.github.com/evandersondev/darto_security/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/evandersondev%2Fdarto_security/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29667119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T19:49:36.704Z","status":"ssl_error","status_checked_at":"2026-02-20T19:44:05.372Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2025-10-23T05:12:12.996Z","updated_at":"2026-02-20T23:01:30.026Z","avatar_url":"https://github.com/evandersondev.png","language":"Dart","funding_links":["https://buymeacoffee.com/evandersondev"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/evandersondev/darto_security\"\u003e\u003ch1 align=\"center\"\u003eDarto Security\u003c/h1\u003e\u003c/a\u003e\n  \u003cbr/\u003e\n    The \u003ccode\u003edarto_security\u003c/code\u003e package provides a set of plug-and-play middlewares inspired by \u003ca href=\"https://helmetjs.github.io/\"\u003eHelmet.js\u003c/a\u003e to improve the security of your Darto application. These middlewares help protect your API against common threats like XSS, CSRF, request spamming, and more.\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\u003cbr/\u003e\n\n### Support 💖\n\nIf you find Darto Security useful, please consider supporting its development 🌟[Buy Me a Coffee](https://buymeacoffee.com/evandersondev).🌟 Your support helps us improve the package and make it even better!\n\n\u003cbr\u003e\n\u003cbr\u003e\n\n## Installing\n\n```bash\ndart pub add darto_security\n```\n\nor\n\nAdd the package to your `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  darto_security: ^0.0.3\n```\n\nThen, run the following command:\n\n```bash\nflutter pub get\n```\n\n---\n\n\u003cbr\u003e\n\n## Usage\n\nTo use all security features with default settings:\n\n```dart\nimport 'package:darto/darto.dart';\nimport 'package:darto_security/darto_security.dart';\n\nvoid main() {\n  final app = Darto();\n\n  app.use(dartoSecurity());\n\n  app.get('/', (req, res) {\n    res.send('🔐 Secured by darto_security!');\n  });\n\n  app.listen(3000, () {\n    print('🔹 Server is running at http://localhost:3000');\n  });\n}\n```\n\n\u003cbr\u003e\n\n---\n\n\u003cbr\u003e\n\n## Available Middleware Flags\n\nYou can selectively enable or disable each middleware by passing its respective flag:\n\n| Middleware              | Flag name               | Default | Description                                          |\n| ----------------------- | ----------------------- | ------- | ---------------------------------------------------- |\n| Block User Agents       | `blockUserAgents`       | `true`  | Blocks user agents provided in `blockedAgents`.      |\n| Block IPs               | `ipBlock`               | `true`  | Blocks IPs provided in `blockedIps`.                 |\n| CORS                    | `corsEnabled`           | `true`  | Enables CORS.                                        |\n| Content-Security-Policy | `contentSecurityPolicy` | `true`  | Adds `Content-Security-Policy` header.               |\n| Nonce CSP               | `nonceCsp`              | `false` | Adds nonce-based CSP header.                         |\n| Frameguard              | `frameGuard`            | `true`  | Protects against clickjacking via `X-Frame-Options`. |\n| Hide Powered By         | `hidePoweredBy`         | `true`  | Removes `X-Powered-By` header.                       |\n| HSTS                    | `hstsEnabled`           | `true`  | Adds `Strict-Transport-Security` header.             |\n| IE No Open              | `ieNoOpenEnabled`       | `true`  | Adds `X-Download-Options` for IE.                    |\n| No Cache                | `noCacheEnabled`        | `true`  | Prevents caching of sensitive data.                  |\n| No Sniff                | `noSniff`               | `true`  | Adds `X-Content-Type-Options: nosniff`.              |\n| Rate Limiting           | `rateLimit`             | `true`  | Prevents abuse via excessive requests.               |\n| Referrer Policy         | `referrerPolicy`        | `true`  | Adds `Referrer-Policy` header.                       |\n| Generic Sec Headers     | `securityHeaders`       | `true`  | Adds common security headers.                        |\n| XSS Protection          | `xssProtection`         | `true`  | Enables XSS filter in browsers.                      |\n\n\u003cbr\u003e\n\n---\n\n\u003cbr\u003e\n\n## Custom Parameters\n\nSome middlewares accept custom parameters:\n\n```dart\ndartoSecurity(\n  blockedAgents: ['BadBot', 'Scanner'],\n  blockedIps: ['192.168.0.10'],\n  allowedOrigins: ['https://myapp.com'],\n  allowedMethods: ['GET', 'POST'],\n  rateLimitMaxRequests: 50,\n  rateLimitDuration: Duration(seconds: 30),\n);\n```\n\n\u003cbr\u003e\n\n### Parameters Description\n\n| Parameter              | Type           | Description                    |\n| ---------------------- | -------------- | ------------------------------ |\n| `blockedAgents`        | `List\u003cString\u003e` | User agents to block.          |\n| `blockedIps`           | `List\u003cString\u003e` | IP addresses to block.         |\n| `allowedOrigins`       | `List\u003cString\u003e` | Origins allowed in CORS.       |\n| `allowedMethods`       | `List\u003cString\u003e` | Methods allowed in CORS.       |\n| `rateLimitMaxRequests` | `int`          | Max requests before blocking.  |\n| `rateLimitDuration`    | `Duration`     | Time window for rate limiting. |\n\n\u003e ⚠️ Middlewares like `blockUserAgents` and `ipBlock` require their respective lists to be non-empty to take effect.\n\n\u003cbr\u003e\n\n---\n\n\u003cbr\u003e\n\n## Disable Middleware\n\nTo disable a specific middleware, set its flag to `false`:\n\n```dart\ndartoSecurity(\n  xssProtection: false,\n  rateLimit: false,\n  corsEnabled: false,\n);\n```\n\n\u003cbr\u003e\n\n---\n\n\u003cbr\u003e\n\n## Full Example\n\n```dart\nimport 'package:darto/darto.dart';\nimport 'package:darto_security/darto_security.dart';\n\nvoid main() {\n  final app = Darto();\n\n  app.use(dartoSecurity(\n    blockedAgents: ['BadBot'],\n    blockedIps: ['123.123.123.123'],\n    allowedOrigins: ['https://secure-app.com'],\n    allowedMethods: ['GET', 'POST'],\n    rateLimitMaxRequests: 60,\n    rateLimitDuration: Duration(minutes: 1),\n  ));\n\n  app.get('/', (req, res) {\n    res.send('🔐 Secured and customized!');\n  });\n\n  app.listen(3000, () {\n    print('🔹 Server is running at http://localhost:3000');\n  });\n}\n```\n\n\u003cbr\u003e\n\n---\n\n\u003cbr\u003e\n\nMade by evandersondev with ❤️ for Dart/Flutter developers! 🎯\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevandersondev%2Fdarto_security","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevandersondev%2Fdarto_security","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevandersondev%2Fdarto_security/lists"}