Skip to content

Commit 5a5bcd8

Browse files
committed
feat: add golang.org security contact fallback for go packages
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
1 parent 9f4ac47 commit 5a5bcd8

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

  • services/apps/packages_worker/src/security-contacts/extractors/registry
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { ExtractorResult, ProvenanceEntry, RawContact } from '../../types'
2+
3+
const SOURCE = 'go.dev/security-policy'
4+
const POLICY_URL = 'https://go.dev/doc/security/policy#reporting-a-security-bug'
5+
6+
export async function fetchGo(): Promise<ExtractorResult> {
7+
const fetchedAt = new Date().toISOString()
8+
const prov = (): ProvenanceEntry[] => [
9+
{ source: SOURCE, sourceTier: 'D', path: POLICY_URL, fetchedAt },
10+
]
11+
const contacts: RawContact[] = [
12+
{
13+
channel: 'email',
14+
value: 'security@golang.org',
15+
role: 'security-team',
16+
tier: 'D',
17+
provenance: prov(),
18+
},
19+
{
20+
channel: 'web-form',
21+
value: 'https://g.co/vulnz',
22+
role: 'security-team',
23+
tier: 'D',
24+
provenance: prov(),
25+
},
26+
]
27+
return { contacts, policies: {} }
28+
}

services/apps/packages_worker/src/security-contacts/extractors/registry/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Extractor, ExtractorResult, RawContact, RepoPolicies } from '../../type
22

33
import { fetchCargo } from './cargo'
44
import { fetchComposer } from './composer'
5+
import { fetchGo } from './go'
56
import { fetchMaven } from './maven'
67
import { fetchNpm } from './npm'
78
import { fetchNuget } from './nuget'
@@ -16,7 +17,7 @@ type EcosystemFetcher = (
1617
repoUrl?: string,
1718
) => Promise<ExtractorResult>
1819

19-
// Keyed by the lowercased packages.ecosystem value. go has no package-manifest contacts.
20+
// Keyed by the lowercased packages.ecosystem value.
2021
const FETCHERS: Record<string, EcosystemFetcher> = {
2122
npm: fetchNpm,
2223
pypi: fetchPypi,
@@ -25,6 +26,7 @@ const FETCHERS: Record<string, EcosystemFetcher> = {
2526
nuget: fetchNuget,
2627
rubygems: fetchRubygems,
2728
composer: fetchComposer,
29+
go: fetchGo,
2830
}
2931

3032
export const extractManifest: Extractor = async (target, deps) => {

0 commit comments

Comments
 (0)