Skip to content

Commit

Permalink
fix: removed author
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-ippolito committed Mar 20, 2024
1 parent 55c3b55 commit e2e9ebf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 25 deletions.
3 changes: 1 addition & 2 deletions components/git/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,9 @@ async function updateReleaseDate(argv) {
}

async function createPreRelease(argv) {
const destination = argv.destination;
const logStream = process.stdout.isTTY ? process.stdout : process.stderr;
const cli = new CLI(logStream);
const preRelease = new SecurityPreRelease(cli, destination);
const preRelease = new SecurityPreRelease(cli);
return preRelease.create();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/github/templates/security-pre-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ category: vulnerability
title: %RELEASE_DATE% Security Releases
slug: %SLUG%
layout: blog-post.hbs
author: %AUTHOR%
author: The Node.js Project
---

# Summary
Expand Down
1 change: 0 additions & 1 deletion lib/security-release/security-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const PLACEHOLDERS = {
affectedLines: '%AFFECTED_LINES%',
annoucementDate: '%ANNOUNCEMENT_DATE%',
slug: '%SLUG%',
author: '%AUTHOR%',
affectedVersions: '%AFFECTED_VERSIONS%',
openSSLUpdate: '%OPENSSL_UPDATES%',
impact: '%IMPACT%',
Expand Down
23 changes: 2 additions & 21 deletions lib/security_pre_release.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import fs from 'node:fs';
import auth from './auth.js';
import Request from './request.js';
import path from 'node:path';
import _ from 'lodash';
import {
Expand All @@ -13,19 +11,13 @@ import {

export default class SecurityPreRelease {
repository = NEXT_SECURITY_RELEASE_REPOSITORY;
constructor(cli, destination) {
constructor(cli) {
this.cli = cli;
this.destination = destination;
}

async create() {
const { cli } = this;

const credentials = await auth({
github: true,
h1: true
});

// checkout on security release branch
checkoutOnSecurityReleaseBranch(cli, this.repository);

Expand All @@ -36,20 +28,16 @@ export default class SecurityPreRelease {
const releaseDate = new Date(content.releaseDate);

const template = this.getSecurityPreReleaseTemplate();
const req = new Request(credentials);
const data = {
annoucementDate: await this.getAnnouncementDate(cli),
releaseDate: this.formatReleaseDate(releaseDate),
author: await this.getAuthor(req),
affectedVersions: this.getAffectedVersions(content),
vulnerabilities: this.getVulnerabilities(content),
slug: this.getSlug(releaseDate),
impact: this.getImpact(content)
};
const preRelease = this.buildPreRelease(template, data);
const destination = this.destination
? path.resolve(this.destination)
: process.cwd();
const destination = path.resolve(this.destination);
const file = path.join(destination, 'pre-release.md');
fs.writeFileSync(file, preRelease);
cli.ok(`Pre-release announcement file created at ${file}`);
Expand All @@ -69,15 +57,13 @@ export default class SecurityPreRelease {
const {
annoucementDate,
releaseDate,
author,
affectedVersions,
vulnerabilities,
slug,
impact
} = data;
return template.replaceAll(PLACEHOLDERS.annoucementDate, annoucementDate)
.replaceAll(PLACEHOLDERS.slug, slug)
.replaceAll(PLACEHOLDERS.author, author)
.replaceAll(PLACEHOLDERS.affectedVersions, affectedVersions)
.replaceAll(PLACEHOLDERS.vulnerabilities, vulnerabilities)
.replaceAll(PLACEHOLDERS.releaseDate, releaseDate)
Expand Down Expand Up @@ -134,11 +120,6 @@ export default class SecurityPreRelease {
return impactText.join('\n');
}

async getAuthor(req) {
const user = await req.getUser();
return user.name;
}

getVulnerabilities(content) {
const grouped = _.groupBy(content.reports, 'severity.rating');
const text = [];
Expand Down

0 comments on commit e2e9ebf

Please sign in to comment.