{"id":22014763,"url":"https://github.com/neuralegion/cvss","last_synced_at":"2025-05-07T00:30:30.809Z","repository":{"id":38012558,"uuid":"276699920","full_name":"NeuraLegion/cvss","owner":"NeuraLegion","description":"The Common Vulnerability Scoring System (CVSS) base score calculator and validator library written in TypeScript.","archived":false,"fork":false,"pushed_at":"2024-02-08T18:17:49.000Z","size":600,"stargazers_count":14,"open_issues_count":3,"forks_count":3,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-05T06:36:38.253Z","etag":null,"topics":["cvss","cvss3","cvssv3","score","security","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/NeuraLegion.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2020-07-02T16:50:23.000Z","updated_at":"2024-06-15T14:17:19.000Z","dependencies_parsed_at":"2024-12-26T12:32:38.223Z","dependency_job_id":"ec54376f-39a1-4d5c-bde8-dca2d2f8977c","html_url":"https://github.com/NeuraLegion/cvss","commit_stats":{"total_commits":33,"total_committers":4,"mean_commits":8.25,"dds":"0.33333333333333337","last_synced_commit":"192ba26c5530079d2063035cbbf69f8cfe4b55de"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuraLegion%2Fcvss","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuraLegion%2Fcvss/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuraLegion%2Fcvss/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NeuraLegion%2Fcvss/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NeuraLegion","download_url":"https://codeload.github.com/NeuraLegion/cvss/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252790976,"owners_count":21804688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["cvss","cvss3","cvssv3","score","security","typescript"],"created_at":"2024-11-30T04:17:43.653Z","updated_at":"2025-05-07T00:30:30.771Z","avatar_url":"https://github.com/NeuraLegion.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cvss\n\nThe Common Vulnerability Scoring System ([CVSS](https://www.first.org/cvss/)) [base](https://www.first.org/cvss/specification-document#Base-Metrics) [score](https://www.first.org/cvss/specification-document#1-2-Scoring) calculator and validator library written in [TypeScript](https://www.typescriptlang.org/).\n\n## Basics 🧾\n\nCVSS outputs numerical scores, indicating severity of vulnerability, based on some principal technical vulnerability characteristics.\nIts outputs include numerical scores indicating the severity of a vulnerability relative to other vulnerabilities. [Link](https://www.first.org/cvss/v3.1/specification-document#Introduction)\n\nThe CVSS v3 vector string begins with the label `CVSS:` and numeric representation of the version.\nAfter version string, it contains a set of `/`-separated CVSS metrics.\nEach metric consists of name and value (both abbreviated) separated with ':'.\n\n### Sample\n\nSample CVSS v3.1 vector string: `CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:N`\n\nScore is: [3.8](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:N), severity: [Low](https://www.first.org/cvss/calculator/3.1#CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:N)\n\n### Current library limitations 🚧\n\nCVSS specification defines three metric groups: `Base`, `Temporal`, and `Environmental`, but only `Base` metrics are supported by given library for now.\n\nSupported CVSS versions: [3.0](https://www.first.org/cvss/v3-0/) and [3.1](https://www.first.org/cvss/v3-1/)\n\n## Install 🚀\n\n`npm i --save @neuralegion/cvss`\n\n## API\n\n\u003cdetails\u003e\n\u003csummary\u003eScore Calculator\u003c/summary\u003e\n\n`calculateBaseScore(cvssString): number`\n\nCalculates [Base Score](https://www.first.org/cvss/v3.1/specification-document#7-1-Base-Metrics-Equations),\nwhich depends on sub-formulas for Impact Sub-Score (ISS), Impact, and Exploitability,\n\n`calculateIss(metricsMap): number`\n\nCalculates [Impact Sub-Score (ISS)](https://www.first.org/cvss/v3.1/specification-document#7-1-Base-Metrics-Equations)\n\n`calculateImpact(metricsMap, iss): number`\n\nCalculates [Impact](https://www.first.org/cvss/v3.1/specification-document#7-1-Base-Metrics-Equations)\n\n`calculateExploitability(metricsMap): number`\n\nCalculates [Exploitability](https://www.first.org/cvss/v3.1/specification-document#7-1-Base-Metrics-Equations)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eValidator\u003c/summary\u003e\n\n`validate(cvssString): void`\n\nThrows an Error if given CVSS string is either invalid or unsupported.\n\nError contains verbose message with error details. Sample error messages:\n\n- CVSS vector must start with \"CVSS:\"\n- Invalid CVSS string. Example: CVSS:3.0/AV:A/AC:H/PR:H/UI:R/S:U/C:N/I:N/A:L\n- Unsupported CVSS version: 2.0. Only 3.0 and 3.1 are supported\n- Duplicated metric: \"AC:L\"\n- Missing mandatory CVSS base metric C (Confidentiality)\n- Unknown CVSS metric \"X\". Allowed metrics: AV, AC, PR, UI, S, C, I, A\n- Invalid value for CVSS metric PR (Privileges Required): Y. Allowed values: N (None), L (Low), H (High)\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eHumanizer\u003c/summary\u003e\n\n`humanizeBaseMetric(metric)`\n\nReturn un-abbreviated metric name: e.g. 'Confidentiality' for input 'C'\n\n`humanizeBaseMetricValue(value, metric)`\n\nReturn un-abbreviated metric value: e.g. 'Network' for input ('AV', 'N')\n\n\u003c/details\u003e\n\n## Usage\n\n\u003cdetails\u003e\n\u003csummary\u003eECMAScript 2015, Typescript modules\u003c/summary\u003e\n\n```\nimport { calculateBaseScore } from '@neuralegion/cvss';\n\nconsole.log('score: ', calculateBaseScore('CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N'));\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eNodeJS (CommonJS module)\u003c/summary\u003e\n\n```\nconst cvss = require('@neuralegion/cvss');\n\nconsole.log(cvss.calculateBaseScore('CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N'));\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eNodeJS (experimental ESM support)\u003c/summary\u003e\n\n`usage.mjs` file:\n\n```\nimport cvss from '@neuralegion/cvss';\n\nconsole.log(cvss.calculateBaseScore('CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N'));\n```\n\nRunning: `node --experimental-modules ./usage.mjs`\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eBrowser (globals from umd bundle)\u003c/summary\u003e\n\n```\n\u003cscript src=\"./node_modules/@neuralegion/cvss/dist/bundle.umd.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  alert(`Score: ${cvss.calculateBaseScore('CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N')}`);\n\u003c/script\u003e\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eBrowser (ES modules)\u003c/summary\u003e\n\n```\n\u003cscript type=\"module\"\u003e\n  import { calculateBaseScore } from './node_modules/@neuralegion/cvss/dist/bundle.es.js';\n  alert(`Score: ${calculateBaseScore('CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N')}`);\n\u003c/script\u003e\n```\n\n\u003c/details\u003e\n\n## Development 🛠\n\nIssues and pull requests are highly welcome. 👍\n\nPlease, don't forget to lint (`npm run lint`) and test (`npm t`) the code.\n\n## License\n\nCopyright © 2020 [NeuraLegion](https://github.com/NeuraLegion).\n\nThis project is licensed under the MIT License - see the [LICENSE file](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuralegion%2Fcvss","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneuralegion%2Fcvss","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuralegion%2Fcvss/lists"}