{"id":17249290,"url":"https://github.com/0xle0ne/socknet","last_synced_at":"2026-04-02T14:01:40.421Z","repository":{"id":13917885,"uuid":"74861267","full_name":"0xle0ne/socknet","owner":"0xle0ne","description":"PropTypes style for secure your socket.io application","archived":false,"fork":false,"pushed_at":"2024-10-11T03:54:02.000Z","size":1532,"stargazers_count":12,"open_issues_count":2,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-24T22:35:30.161Z","etag":null,"topics":["argument-parser","framework","nodejs","security","socket-io","websockets"],"latest_commit_sha":null,"homepage":"https://leon3s.github.io/socknet/","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/0xle0ne.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}},"created_at":"2016-11-27T01:50:53.000Z","updated_at":"2024-08-04T20:06:43.000Z","dependencies_parsed_at":"2024-12-10T19:18:08.025Z","dependency_job_id":"09da21b3-c4f9-4bc3-92cc-30d1e21a155e","html_url":"https://github.com/0xle0ne/socknet","commit_stats":{"total_commits":104,"total_committers":3,"mean_commits":"34.666666666666664","dds":"0.10576923076923073","last_synced_commit":"b8539fcced96cb3aab6e70ce9d44c65108aec373"},"previous_names":["leo-vernisse/socknet","0xle0ne/socknet"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/0xle0ne/socknet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xle0ne%2Fsocknet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xle0ne%2Fsocknet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xle0ne%2Fsocknet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xle0ne%2Fsocknet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xle0ne","download_url":"https://codeload.github.com/0xle0ne/socknet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xle0ne%2Fsocknet/sbom","scorecard":{"id":584817,"data":{"date":"2025-08-11","repo":{"name":"github.com/leon3s/socknet","commit":"d1a9b063f1a685e8c957c3b8e480dc4a55f93581"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Code-Review","score":1,"reason":"Found 2/20 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/pr.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/leon3s/socknet/pr.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/pr.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/leon3s/socknet/pr.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/leon3s/socknet/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/leon3s/socknet/release.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   2 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":2,"reason":"8 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T20:10:10.448Z","repository_id":13917885,"created_at":"2025-08-20T20:10:10.448Z","updated_at":"2025-08-20T20:10:10.448Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31307460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"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":["argument-parser","framework","nodejs","security","socket-io","websockets"],"created_at":"2024-10-15T06:43:52.869Z","updated_at":"2026-04-02T14:01:40.358Z","avatar_url":"https://github.com/0xle0ne.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg\n  width=\"160px\"\n  src=\"https://image.ibb.co/c11zDk/logo_leo.png\"\u003e\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003eSocknet\u003c/h1\u003e\n\n[![Build Status](https://travis-ci.org/leon3s/socknet.svg?branch=master)](https://travis-ci.org/leon3s/socknet)\n[![Dependency Status](https://david-dm.org/leon3s/socknet.svg)](https://david-dm.org/leon3s/socknet.svg)\n[![NPM version](https://badge.fury.io/js/socknet.svg)](https://www.npmjs.com/package/socknet)\n[![npm](https://img.shields.io/npm/dt/socknet.svg)]()\n\n[![NPM](https://nodei.co/npm/socknet.png)](https://nodei.co/npm/socknet/)\n\n\u003c!-- ## Take a look at our get started and documentation on [socknet.io](http://socknet.io) --\u003e\n\n## Overview\nSocknet hook any socket.io like library that allow you to use your favourite validation lib before calling your all your events.\n\nIt\u0026apos;s inspired by react component declaration style for event creation focusing on lisibility, modularity and security.\nFully compatible with socket.io client it works on every platform,\n  browser or device, focusing equally on reliability, and speed.\n\n### How to use\n\n## Installing\n```sh\n$ npm install --save socknet\n```\n\n## Parametes\n\n`Socknet` constructor take an options object before all socket.io [Server](https://socket.io/docs/v4/server-api/) constructor parameters:\n\n{\n  schemas: schemas indexed by eventName,\n  validate: a validation function which receive schema and data to validate. Must throw on error, could be async\n}\n\n## Examples\n### Basic usage\n\nserver.js\n```js\nimport { Socknet } from 'socknet';\nimport * as Joi from 'joi';\n\n\n// Note that schema is an array of all args\nconst schema = Joi.array().ordened([\n  Joi.object({\n    data: Joi.string(),\n  }),\n  Joi.object({\n    data2: Joi.string(),\n  }),\n])\n\nconst socknet = new Socknet({ schemas: { '/test': schema }, validate: (schema: Joi.AnySchema, data: unknown[]) =\u003e schema.validateAsync(data) }, httpServer)\nconst socknet.listen(PORT)\n\nconst testEvent = (...args: any[]) =\u003e {\n  console.log('received and validated args', args);\n}\n\nsocknet.on('connection', (socket) =\u003e {\n  // event /test now have arguments protection\n  socket.on('/test', testEvent);\n});\n\n```\n\nclient.js\n```js\nimport { Socket } from 'socket.io-client';\n\nSocket = io('http://localhost:' + PORT) as unknown as Socket;\n\nSocket.emit('/test', { data: 'test' }, { data2: test2});\n```\n\nServer should log\n\n```json\n[{ \"data\": \"test\" }, { \"data2\": \"test2\" }]\n```\n\nNote that in this case invalid data will cause request is cancelled see below for error handling\n\n### Response callback\n\nserver.js\n```js\nimport { Socknet } from 'socknet';\nimport * as Joi from 'joi';\n\n\n// Note that schema must contain callback function to allow it\nconst schema = Joi.array().ordened([\n  Joi.string(),\n  Joi.func()\n])\n\nconst socknet = new Socknet({ schemas: { '/test': schema }, validate: (schema: Joi.AnySchema, data: unknown[]) =\u003e schema.validateAsync(data) }, httpServer)\nconst socknet.listen(PORT)\n\nconst testEvent = ((username, eventCallback) =\u003e {\n    const error = doSomething();\n\n    // Here whe handle both cases with callback or not but you could validate the function as `Joi.func().required()` and always have it\n    if (eventCallback) {\n        if (error) eventCallback(error)\n        else eventCallback(null, username)\n    }\n})\n\nsocknet.on('connection', (socket) =\u003e {\n  // event /test now have arguments protection\n  socket.on('/test', testEvent);\n});\n```\n\nclient.js\n```js\nimport { Socket } from 'socket.io-client';\n\nSocket = io('http://localhost:' + PORT) as unknown as Socket;\n\nSocket.emit('/test', 'someusername', function (error, response) {\n  if (error) {\n    // handle error\n  } else {\n    console.log(response);\n  }\n});\n```\n\nClient should log\n\n```json\n[\"someusername\"]\n```\n\n### Ajv\n```js\n\nimport { Socknet } from 'socknet';\nimport Ajv, { JSONSchemaType } from 'ajv';\n\nimport { Location } from '@/types';\n\nconst LocationSchema = {\n  type: 'array',\n  items: [\n    {\n      type: 'integer',\n    },\n    {\n      type: 'integer',\n    },\n  ],\n  minItems: 2,\n  maxItems: 2,\n} as JSONSchemaType\u003cLocation\u003e;\n\n\nexport const ajv = new Ajv({\n  schemas: {\n    location: LocationSchema,\n  },\n});\n\nconst socknet = new Socknet(\n  {\n    schemas: {\n      '/test': 'location',\n    },\n    validate: (schema, data) =\u003e {\n      try {\n        console.log(ajv.validate(schema, data));\n      } catch (error) {\n        console.log(error);\n        throw error;\n      }\n    },\n  },\n);\n\nconst socknet.listen(PORT)\n\nconst testEvent = ((longitude, latitude, eventCallback) =\u003e {\n    const error = doSomething(longitude, latitude);\n\n    if (eventCallback) {\n        if (error) eventCallback(error)\n        else eventCallback(null, username)\n    }\n})\n\nsocknet.on('connection', (socket) =\u003e {\n  // event /test now have arguments protection\n  socket.on('/test', testEvent);\n});\n```\n\n\n\nclient.js\n```js\nimport { Socket } from 'socket.io-client';\n\nSocket = io('http://localhost:' + PORT) as unknown as Socket;\n\nSocket.emit('/test', 1.184646, 50.123415);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xle0ne%2Fsocknet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xle0ne%2Fsocknet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xle0ne%2Fsocknet/lists"}