fix(route)(hackerone): make sure report is disclosed (#8313)

This commit is contained in:
imlonghao 2022-01-23 00:01:01 +08:00 committed by GitHub
parent a4ee8e23c1
commit 0a2a9e161f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 14 deletions

View File

@ -27,19 +27,21 @@ module.exports = async (ctx) => {
ctx.state.data = {
title: 'HackerOne Hacker Activity',
link: 'https://hackerone.com/hacktivity',
item: response.data.data.hacktivity_items.edges.map((item) => {
const author = item.node.reporter ? item.node.reporter.username : 'Someone';
const vendor = item.node.team.name;
const state = item.node.report.substate.replace(/^[a-z]/g, (L) => L.toUpperCase());
const severity = item.node.severity_rating ? item.node.severity_rating.replace(/^[a-z]/g, (L) => L.toUpperCase()) : 'No Rating';
const awarded = item.node.total_awarded_amount ? item.node.total_awarded_amount : 0;
return {
title: item.node.report.title,
description: `By ${author} to ${vendor} | ${state} | ${severity} | $${awarded}`,
author,
pubDate: new Date(item.node.latest_disclosable_activity_at).toUTCString(),
link: `https://hackerone.com/reports/${item.node.databaseId}`,
};
}),
item: response.data.data.hacktivity_items.edges
.filter((item) => item.node.type === 'Disclosed')
.map((item) => {
const author = item.node.reporter ? item.node.reporter.username : 'Someone';
const vendor = item.node.team.name;
const state = item.node.report.substate.replace(/^[a-z]/g, (L) => L.toUpperCase());
const severity = item.node.severity_rating ? item.node.severity_rating.replace(/^[a-z]/g, (L) => L.toUpperCase()) : 'No Rating';
const awarded = item.node.total_awarded_amount ? item.node.total_awarded_amount : 0;
return {
title: item.node.report.title,
description: `By ${author} to ${vendor} | ${state} | ${severity} | $${awarded}`,
author,
pubDate: new Date(item.node.latest_disclosable_activity_at).toUTCString(),
link: `https://hackerone.com/reports/${item.node.databaseId}`,
};
}),
};
};