Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tintinweb/smart-contract-vulndb

🍋 An open dataset containing smart contract audit issues from various sources.
https://github.com/tintinweb/smart-contract-vulndb

smart-contract-security vulnerabilities

Last synced: 1 day ago
JSON representation

🍋 An open dataset containing smart contract audit issues from various sources.

Awesome Lists containing this project

README

        

[The Creed Rebellion!](https://thecreed.xyz/)

[[ 🌐 ](https://thecreed.xyz/)[ 🫂 ](https://community.thecreed.xyz/c/start-here)]


# Smart Contract VulnDB

An open dataset of publicly available smart contract issues aggregated from various audit reports. The dataset can be accessed at 🌻 [vulns.json](dataset/vulns.json), is updated once a day, and a live demo is available 🌐 [here](https://tintinweb.github.io/smart-contract-vulndb/
).


LMK if you're building cool things with this dataset and I'll list them here 😊🙏

## 🔸 DataSet

⚠️ NOTE: Breaking Change due to [GIT Large File Policy](https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github#file-size-limits)
Switching from one big `vulns.json` to files a 25k issues `vulns-1.json`, `vulns-2.json`, ...

[image](https://github.com/tintinweb/smart-contract-vulndb/blob/main/dataset/vulns.json)

```typescript
const issue: Issue = {
title: "",
severity: Severity.Medium,
body: "",
dataSource: {
name: "",
repo: "",
url: ""
}
};
```

To work around [GitHub File Size Limits](https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github#file-size-limits) we'll split the database into equal files of 25k issues

* [vulns-1.json](dataset/vulns-1.json) - a 25k issues
* [vulns-2.json](dataset/vulns-2.json)

## 🔸 Live Demo

[image](https://tintinweb.github.io/smart-contract-vulndb/)

* [Demo](https://tintinweb.github.io/smart-contract-vulndb/)

## 🔸 Accessing the Latest Snapshot

- Shell
```
⇒ curl https://tintinweb.github.io/smart-contract-vulndb/cache/vulns-1.json
⇒ curl https://tintinweb.github.io/smart-contract-vulndb/cache/vulns-2.json
```

- JavaScript
```javascript
const all_issues = []
for(let idx=1; idx<10; idx++){
try {
const all = await (await fetch(`https://tintinweb.github.io/smart-contract-vulndb/cache/vulns-${idx}.json`)).text();
for(let line of all.split("\n")){
if(line.trim().length == 0){
continue;
}
try{
all_issues.push(JSON.parse(line))
} catch(e){
console.log(line)
throw e
}
}
} catch (e){
console.log(e)
break;
}
}
```

- JavaScript Local
```javascript
const fs = require("fs")
let issues = [];
for(let idx=1; idx<10; idx++){
if(!fs.existsSync(`./dataset/vulns-${idx}.json`)) {
break;
}
const data = fs.readFileSync(`./dataset/vulns-${idx}.json`, "utf-8");
const part = data.split('\n').filter(l => l.trim().length > 0).map(l => JSON.parse(l))
issues = [...issues, ...part]
}
console.log(issues.length)
// 39125
[... new Set(issues.map(i => i.severity))]
/*
[
'medium', 'minor',
null, 'major',
'critical', undefined,
'info'
]
*/
```

- [NodeJs](./examples/javascript/example.js)
- [TypeScript](./examples/typescript/example.ts)
- [Python](./examples/python/example.py)

## 🤓 For Nerds

First, run the development server:

```bash
npm run dev
# or
yarn dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

## 🎓 Citation

If you are using this dataset in your research and paper, here's how you can cite this dataset:

- APA6
```
Ortner, M. (n.d.). Smart Contract VulnDB. Retrieved from https://github.com/tintinweb/smart-contract-vulndb.
```

- LateX (Bib)
```
@article{smart_contract_vulndb,
title={Smart Contract VulnDB},
url={https://github.com/tintinweb/smart-contract-vulndb},
author={Ortner, Martin}}
```