wip-census2
This commit is contained in:
parent
e285ee6095
commit
211b896f82
1 changed files with 2 additions and 2 deletions
|
|
@ -47,7 +47,7 @@ const run = (cmd, args) => spawnSync(cmd, args, { cwd: ROOT, encoding: 'utf8', e
|
|||
const BUILTIN = [
|
||||
{ re: 'sk\\.eyJ', why: 'a Mapbox SECRET token' },
|
||||
{ re: 'BEGIN (RSA|OPENSSH|EC) PRIVATE', why: 'a private key' },
|
||||
{ re: 'oauth2:', why: 'a credential in a URL' },
|
||||
{ re: 'oauth2[:]', why: 'a credential in a URL' }, // [:] so this line does not match itself
|
||||
]
|
||||
const CENSUS_FILE = process.env.DOXA_CENSUS_FILE || resolve(ROOT, '..', 'internal-tracker', 'public-census.tsv')
|
||||
if (!existsSync(CENSUS_FILE)) refuse(`the public-safety census list is missing (${CENSUS_FILE})`,
|
||||
|
|
@ -62,7 +62,7 @@ for (const c of census) {
|
|||
if (g.status > 1) refuse(`census: git grep failed on /${c.re}/`, g.stderr.trim())
|
||||
for (const line of g.stdout.split('\n').filter(Boolean)) {
|
||||
const m = /^HEAD:([^:]+):(\d+):(.*)$/.exec(line)
|
||||
if (!m || c.excl.includes(m[1])) continue
|
||||
if (!m || (c.excl || []).includes(m[1])) continue
|
||||
if (c.allow && new RegExp(c.allow).test(m[3])) continue
|
||||
hits.push(`${m[1]}:${m[2]} ${c.why || `census pattern #${census.indexOf(c) + 1}`}`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue