Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(spec): adopt OSV Format #13

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATES/T-Attack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Document Attack Pattern
description: Suggest a Attack Pattern
labels: ["T-Attack"]
body:
- type: markdown
attributes:
value: |
Please ensure that the attack is not listed and has not already been requested or discussed in the issue tracker.

- type: dropdown
attributes:
label: Category
description: What category is the feature for?
multiple: true
options:
- Market Attacks
- Economic Attacks
- MEV Vectors
- Governance Vectors
- On-Chain
- Inter-Chain
- Solidity/SWC
- Off-Chain
# - Process Creation, Command Execution, Access Esclation, Service Modification, Trust Modification, Code Injection
validations:
required: true
- type: textarea
attributes:
label: Describe the attack pattern
description: Please also describe any known usages in the wild of said pattern/vector
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: Add any other context to the feature (like screenshots, resources)
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATES/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Contact
url: mailto:sam@manifoldfinance.com
about: Contact me via e-mail if you have a security issue or question.
76 changes: 76 additions & 0 deletions lib/announcements-rss.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:sets="http://exslt.org/sets"
xmlns:exsl="http://exslt.org/common"
xmlns:str="http://exslt.org/strings"
extension-element-prefixes="exsl sets str"
exclude-result-prefixes="xhtml"
>

<xsl:output method='xml' encoding="UTF-8" omit-xml-declaration="no" />

<xsl:template match="changelog">

<!--<?xml version="1.0" encoding="UTF-8"?>-->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Manifold Finance Changelog</title>
<link>https://manifoldfinance.com/changelog.html</link>
<atom:link href="https://manifoldfinance.com/defi-trheat-rss.xml" rel="self" type="application/rss+xml" />
<description>DeFi Threat Matrix</description>
<fh:complete xmlns:fh="http://purl.org/syndication/history/1.0"/>

<image>
<title>DeFi Threat Announcements</title>
<url>https://manifoldfinance.com/static/logo/defithreat.png</url>
<link>https://manifoldfinance.com/defi-threat.html</link>
</image>

<xsl:for-each select="item">
<item>
<title><xsl:apply-templates select="title/child::node()" mode="id" /></title>
<link>https://manifoldfinance.com/threats/announcements.html#<xsl:value-of select="title/@id" /></link>
<description><xsl:apply-templates select="description/child::node()" mode="serialize" /></description>
<pubDate><xsl:value-of select="pubDate" /></pubDate>
<guid isPermaLink="false"><xsl:value-of select="pubDate" /></guid>
</item>
</xsl:for-each>
</channel>
</rss>
</xsl:template>

<!-- from https://stackoverflow.com/a/15783514 -->
<xsl:template match="*" mode="serialize">
<xsl:text>&lt;</xsl:text>
<xsl:value-of select="name()"/>
<xsl:apply-templates select="@*" mode="serialize" />
<xsl:choose>
<xsl:when test="node()">
<xsl:text>&gt;</xsl:text>
<xsl:apply-templates mode="serialize" />
<xsl:text>&lt;/</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>&gt;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text> /&gt;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template match="@*" mode="serialize">
<xsl:text> </xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>="</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:template>

<xsl:template match="text()" mode="serialize">
<xsl:value-of select="."/>
</xsl:template>

</xsl:stylesheet>
38 changes: 38 additions & 0 deletions lib/gen-rss.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const { promises: fs } = require('fs')
const path = require('path')
const RSS = require('rss')
const matter = require('gray-matter')

async function generate() {
const feed = new RSS({
title: 'DeFi Threat Matrix',
site_url: 'https://apt.securerpc.com',
feed_url: 'https://apt.securerpc.com/feed.xml'
});

const posts = await fs.readdir(path.join(__dirname, '..', 'pages', 'posts'))

await Promise.all(
posts.map(async (name) => {
if (name.startsWith('index.')) return

const content = await fs.readFile(
path.join(__dirname, '..', 'pages', 'posts', name)
)
const frontmatter = matter(content)

feed.item({
title: frontmatter.data.title,
url: '/posts/' + name.replace(/\.mdx?/, ''),
date: frontmatter.data.date,
description: frontmatter.data.description,
categories: frontmatter.data.tag.split(', '),
author: frontmatter.data.author
})
})
)

await fs.writeFile('./public/feed.xml', feed.xml({ indent: true }))
}

generate();
Loading