Skip to content

Commit 5f32ed1

Browse files
committed
fix: clear PVR reporting URL on disable; drain poison repos
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
1 parent c50d5e9 commit 5f32ed1

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

services/apps/packages_worker/src/security-contacts/processBatch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ export async function processBatch(qx: QueryExecutor, config: Config): Promise<B
163163
await processRepo(target, deps, qx)
164164
} catch (err) {
165165
log.error({ repoId: target.repoId, errMsg: (err as Error).message }, 'Repo processing failed')
166+
// Best-effort mark so a persistently-failing repo drains on cadence rather than making the
167+
// sweep hot-loop (it would otherwise stay eligible and keep processed > 0 forever).
168+
await markRepoAttempted(qx, target.repoId).catch(() => undefined)
166169
}
167170
})
168171

services/apps/packages_worker/src/security-contacts/writeContacts.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ export async function writeContacts(
4646
await tx.result(
4747
// COALESCE preserves previously stored values when a run doesn't (re)discover a field —
4848
// a partial/failed extractor pass must not wipe still-valid policy URLs or the PVR flag.
49+
// vulnerability_reporting_url is PVR-derived, so when PVR is authoritatively resolved we
50+
// overwrite it (clearing it once PVR is disabled); otherwise it is preserved.
4951
`UPDATE repos SET
5052
security_policy_url = COALESCE($(securityPolicyUrl), security_policy_url),
51-
vulnerability_reporting_url = COALESCE($(vulnerabilityReportingUrl), vulnerability_reporting_url),
53+
vulnerability_reporting_url = CASE WHEN $(pvrResolved)
54+
THEN $(vulnerabilityReportingUrl)
55+
ELSE COALESCE($(vulnerabilityReportingUrl), vulnerability_reporting_url)
56+
END,
5257
bug_bounty_url = COALESCE($(bugBountyUrl), bug_bounty_url),
5358
security_txt_url = COALESCE($(securityTxtUrl), security_txt_url),
5459
pvr_enabled = COALESCE($(pvrEnabled), pvr_enabled),
@@ -58,6 +63,7 @@ export async function writeContacts(
5863
repoId,
5964
securityPolicyUrl: policies.securityPolicyUrl ?? null,
6065
vulnerabilityReportingUrl: policies.vulnerabilityReportingUrl ?? null,
66+
pvrResolved: policies.pvrEnabled !== undefined,
6167
bugBountyUrl: policies.bugBountyUrl ?? null,
6268
securityTxtUrl: policies.securityTxtUrl ?? null,
6369
pvrEnabled: policies.pvrEnabled ?? null,

0 commit comments

Comments
 (0)