diff --git a/app/components/support/crate-report-form.css b/app/components/support/crate-report-form.css index fbb6a739938..55b70729184 100644 --- a/app/components/support/crate-report-form.css +++ b/app/components/support/crate-report-form.css @@ -62,6 +62,22 @@ } } +.vulnerability-report { + padding: var(--space-s) var(--space-s); + background-color: light-dark(white, #141413); + border: 1px solid var(--gray-border); + border-radius: var(--space-3xs); + width: 100%; + + :first-child { + margin-top: 0; + } + + :last-child { + margin-bottom: 0; + } +} + .buttons { position: relative; margin: var(--space-m) 0; diff --git a/app/components/support/crate-report-form.gjs b/app/components/support/crate-report-form.gjs index 926c972f01a..625f0407536 100644 --- a/app/components/support/crate-report-form.gjs +++ b/app/components/support/crate-report-form.gjs @@ -2,6 +2,7 @@ import { Input, Textarea } from '@ember/component'; import { fn, uniqueId } from '@ember/helper'; import { on } from '@ember/modifier'; import { action } from '@ember/object'; +import { LinkTo } from '@ember/routing'; import { service } from '@ember/service'; import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; @@ -24,8 +25,12 @@ const REASONS = [ description: 'it is abusive or otherwise harmful', }, { - reason: 'security', - description: 'it contains a vulnerability (please try to contact the crate author first)', + reason: 'malicious-code', + description: 'it contains malicious code', + }, + { + reason: 'vulnerability', + description: 'it contains a vulnerability', }, { reason: 'other', @@ -76,6 +81,14 @@ export default class CrateReportForm extends Component { this.reasonsInvalid = false; } + get isMaliciousCodeReport() { + return this.selectedReasons.includes('malicious-code'); + } + + get isVulnerabilityReport() { + return this.selectedReasons.includes('vulnerability'); + } + @action submit() { if (!this.validate()) { @@ -87,7 +100,7 @@ export default class CrateReportForm extends Component { } composeMail() { - let crate = this.crate; + let { crate, isMaliciousCodeReport } = this; let reasons = this.reasons .map(({ reason, description }) => { let selected = this.isReasonSelected(reason); @@ -103,9 +116,16 @@ Additional details: ${this.detail} `; let subject = `The "${crate}" crate`; - let address = 'help@crates.io'; - let mailto = `mailto:${address}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`; - return mailto; + if (isMaliciousCodeReport) { + subject = `[SECURITY] ${subject}`; + } + + let addresses = 'help@crates.io'; + if (isMaliciousCodeReport) { + addresses += ',security@rust-lang.org'; + } + + return `mailto:${addresses}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`; }