Skip to content

fix(security): retry the bulk advisory request once on transient failure - #195

Merged
convyusboy merged 2 commits into
boonfrom
ridho/fix-security-fast-audit-retry
Sep 4, 2026
Merged

convyusboy merged 2 commits into
boonfrom
ridho/fix-security-fast-audit-retry

Conversation

@convyusboy

@convyusboy convyusboy commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The security-fast CI check (Audit production dependencies, scripts/pre-commit/pnpm-audit-prod.mjs) failed twice in a row on an unrelated release PR (#193) with Bulk advisory request exceeded timeout of 60000ms.

Why This Change Was Made

This check sends one fixed-size bulk-advisory query per run against the whole workspace pnpm-lock.yaml — the exact same payload shape regardless of what a given PR actually changes. The same check passed on every other recent PR (including a prior release PR of the identical shape), so this isn't a payload-size or dependency issue introduced by #193 — it's registry.npmjs.org's bulk advisory endpoint being transiently slow, and a single 60s attempt is fragile against that.

fetchBulkAdvisories now retries once (2s delay) on any failure — timeout, network error, or non-2xx — before giving up. This does not weaken the audit: a real advisory finding only ever surfaces once a request actually succeeds and gets parsed, so a retry only shortens the gap between "the registry hiccuped" and "the check passes" — it changes nothing about what counts as a finding or how findings are evaluated.

Existing tests are pinned to maxAttempts: 1 so they keep testing the single-attempt timeout/abort/body-cap mechanics in isolation, without retry-loop noise or added delay. Two new tests cover the retry path itself: succeeding on the second attempt after the first times out, and exhausting all attempts and rethrowing the last error.

User Impact

Internal CI reliability only — no product behavior change, no change to what advisory severities fail the check.

Evidence


Summary by cubic

Retries the bulk advisory request once after a 2s delay so the security-fast CI check no longer fails on transient registry.npmjs.org timeouts. The previous single-attempt check failed twice on an unrelated release PR even though the identical query had passed moments earlier; retrying doesn't weaken the audit since findings only surface from successful requests.

Behavior

  • Retries only transient failures (timeout, network error, or 5xx) before giving up; deterministic failures like 4xx, oversized bodies, and malformed JSON are not retried.
  • Existing tests pin maxAttempts: 1 to keep single-attempt coverage; new tests cover retrying to success, exhausting all attempts, and non-retryable failures.

Written for commit 430a01c. Summary will update on new commits.

Review in cubic

The security-fast CI check (pnpm-audit-prod.mjs) failed twice in a row on an
unrelated release PR with 'Bulk advisory request exceeded timeout of 60000ms'
-- the same fixed-size query against the whole workspace pnpm-lock.yaml that
passes on every other PR, so this is registry.npmjs.org's bulk advisory
endpoint being transiently slow, not a payload-size or dependency issue.

fetchBulkAdvisories now retries once (2s delay) on any failure -- timeout,
network error, or non-2xx -- before giving up. This does not weaken the
audit: a real advisory finding only surfaces once a request actually
succeeds, so retrying only shortens the gap between a registry hiccup and
the check passing, not what counts as a finding. Existing tests pinned to
maxAttempts:1 to keep testing single-attempt timeout/abort mechanics without
retry noise; new tests cover succeeding on retry and exhausting retries.
@convyusboy
convyusboy requested a review from a team September 4, 2026 04:36
@claude

claude Bot commented Sep 4, 2026 •

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/pre-commit/pnpm-audit-prod.mjs Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 2 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/pre-commit/pnpm-audit-prod.mjs Resolved
@convyusboy
convyusboy merged commit e66a72b into boon Sep 4, 2026
121 of 123 checks passed
@convyusboy
convyusboy deleted the ridho/fix-security-fast-audit-retry branch September 4, 2026 06:02
convyusboy added a commit that referenced this pull request Sep 4, 2026
Live-verified (2026-09-04): a bulk advisory request to
registry.npmjs.org containing only "@a2ui/web_core" hangs indefinitely
-- confirmed twice, 15-20s+ each time, zero bytes received -- even
though the package's own registry metadata resolves normally in under
a second. Not payload-size related: it reproduces with this single
package alone, and blocks security-fast on every PR that pulls it in
as a production dependency (the canvas extension's a2ui bundle), not
just ones that touch it. The existing retry-once mechanism (#195, #196)
doesn't help since it retries the identical request against the same
broken endpoint behavior.

Exclude it from the bulk request entirely (not just filter it from
findings afterward) so the rest of production dependencies still get
audited. Remove once npm fixes the underlying advisory-lookup bug for
this package.
convyusboy added a commit that referenced this pull request Sep 4, 2026
)

* fix(browser-handoff): make the scheduled recheck actually re-check

Live-verified on arief-openclaw-test: a resumed cron turn would
sometimes end silently without ever calling browser_handoff
action="status" at all -- confirmed via boon-core's own request logs,
which show zero GET /browser_handoff/status calls for a cron-resumed
turn that nonetheless completed normally. The resumed model appears to
pattern-match the old wording's "if it's still pending, end your turn
without replying" against its own recent context (it had just told the
customer moments earlier that sign-in hadn't come through) and answer
from memory instead of actually checking again -- silently breaking the
recheck chain, since handleStatus (the only place that reschedules the
next check) never runs.

Rewrite the scheduled message to remove that shortcut: state up front
that whatever the model already believes is stale, and make the tool
call the first, unconditional action for the turn rather than one leg
of a conditional the model can reason its way around.

* fix(browser-handoff): validate site as a hostname at the tool boundary

Review feedback: site is model-supplied and gets interpolated directly
into scheduled-turn and reply prompt text in several places (schedule
recheck's message, the request_login reply, status/error text). A value
containing quotes, newlines, or instruction-like text there is a
prompt-injection surface.

site is documented as a hostname (e.g. "app.procore.com"), so validate
it as one at readSite -- the actual boundary where model-supplied args
enter the tool -- rather than trying to escape it at every
interpolation site.

* fix(browser-handoff): cap hostname length, fix a non-exercising test

Review feedback: HOSTNAME_PATTERN bounded each label to 63 characters
but not the total hostname length, so an arbitrary number of valid
labels could still produce an unbounded string -- one that then gets
embedded in prompts and used to build state/schedule keys. Add the
standard 253-character total-length bound.

Also fixes a test that claimed to cover newline rejection but whose
fixture contained no actual newline character -- it was passing for
the wrong reason (the quote/instruction-text portion alone already
failed validation). The fixture now includes a real newline.

* fix(security): exclude @a2ui/web_core from the bulk advisory request

Live-verified (2026-09-04): a bulk advisory request to
registry.npmjs.org containing only "@a2ui/web_core" hangs indefinitely
-- confirmed twice, 15-20s+ each time, zero bytes received -- even
though the package's own registry metadata resolves normally in under
a second. Not payload-size related: it reproduces with this single
package alone, and blocks security-fast on every PR that pulls it in
as a production dependency (the canvas extension's a2ui bundle), not
just ones that touch it. The existing retry-once mechanism (#195, #196)
doesn't help since it retries the identical request against the same
broken endpoint behavior.

Exclude it from the bulk request entirely (not just filter it from
findings afterward) so the rest of production dependencies still get
audited. Remove once npm fixes the underlying advisory-lookup bug for
this package.

* fix(security): warn loudly instead of silently on excluded packages

Review feedback: silently excluding a package from the bulk advisory
request means it was never checked, but the check still reports
success -- indistinguishable from full coverage. Excluding it from the
bulk endpoint request is still necessary (the endpoint hangs on it
regardless of batch size, confirmed by testing it in isolation), so
make the gap impossible to miss instead: print a clear warning naming
the package whenever it's actually a production dependency, so a
passing security-fast never silently implies full coverage.

Also renames the exclusion test to describe the asserted behavior
instead of reading like an incident report.

* fix(security): correct the all-excluded message, strengthen a test

Review feedback: when the only production dependency present was the
excluded package, the audit reported "No production dependencies
found" -- misleading, since a dependency was found, it was just
excluded (and the SECURITY WARNING above it already says so). Give
that case its own message that doesn't contradict the warning just
printed.

Also strengthens the "no warning" negative test: it previously proved
only that an absent package produces no warning, not that a package
present as a devDependency (non-production) does not. The fixture now
includes @a2ui/web_core as an explicit devDependency so the test
actually exercises the scenario its name claims.
insomnius added a commit that referenced this pull request Sep 4, 2026
…200)

Ships #198 (ENG-19115) — the gateway-audience OBO finally reaches the wire:
agent-runner-utils builds the primary-turn sender context from run.oboToken
and run.ts copies it into the attempt params, verified end to end on a local
stack (gateway fetched the org signing key and verified the token). Also
#197 browser-handoff recheck, #194 sentry-monitor tenant tag + hook
allow-list, #195/#196 CI dependency-audit hardening. Lockstep bump via
release:prep; CHANGELOG.md gains the 2026.6.11-boon.37 section the prepack
requires.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants