Skip to content

fix: isolate axios instance and token redaction per check - #1199

Merged
mcm1957 merged 1 commit into
masterfrom
fix/1193-isolate-per-check-axios
Oct 14, 2026
Merged

mcm1957 merged 1 commit into
masterfrom
fix/1193-isolate-per-check-axios

Conversation

@mcm1957

@mcm1957 mcm1957 commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1193.

Problem

When repochecker runs as a library with parallel checks (as the dev-portal does), two module-level variables in lib/common.js were shared across all concurrent checks:

  • axiosInstance — overwritten by each initAxios() call, so check B's instance would be used for check A's in-flight requests, sending A's requests with B's token.
  • effectiveGithubToken — overwritten the same way, so errors from check A would only be redacted using B's token, potentially leaking A's token in logs.

Fix

lib/common.js

  • Removed axiosInstance entirely — initAxios() now only writes context.axios; downloadURL and getFilesList use context.axios directly. The fallback was dead code: every caller either has a valid context.axios (set before the pipeline runs) or is in local mode where axios is never used.
  • Replaced effectiveGithubToken with a Set (knownTokens) that accumulates every token registered by any initAxios() call. redactString() iterates the set, so all known tokens are redacted regardless of which check is active.

downloadURL(context, url, binary)

Added context as first argument (was (url, binary)). Uses context.axios directly.

getFilesList(context)

Uses context.axios directly for both the jsdelivr request and the GitHub API fallback.

Updated callers

  • lib/common.js — getFile() passes context through to downloadURL()
  • lib/M1000_IOPackageJson.js — three call sites updated; also fixed the getFile(null, …) "TODO BE ADAPTED" call to pass context instead of null
  • lib/M5500__JsonConfig.js — one call site updated

Impact

The dev-portal can lift its one-at-a-time serialization workaround (see ioBroker/dev-portal#203 and the TODO referencing this issue).

see: #1193

🤖 Generated with Claude Code

When the repochecker runs as a library with parallel checks, each check
now uses its own per-check axios instance (context.axios) rather than a
shared module-level axiosInstance. This prevents a check started later
from overwriting the authorized instance used by an earlier check still
in flight.

Token redaction is also now per-check-aware: a Set (knownTokens) collects
every token registered via initAxios() so that redactString() redacts all
known tokens regardless of which check is currently active.

Changes:
- downloadURL() now receives context as its first argument and uses
  context.axios (falling back to axiosInstance for safety)
- getFilesList() uses context.axios instead of the module-level instance
- getFile() passes context through to downloadURL()
- All external callers of downloadURL() updated to pass context
- effectiveGithubToken module-level var replaced by knownTokens Set

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mcm1957
mcm1957 force-pushed the fix/1193-isolate-per-check-axios branch from 85bb62c to ffe156c Compare October 14, 2026 11:43
@mcm1957
mcm1957 merged commit e219cbe into master Oct 14, 2026
5 checks passed
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.

[BUG] githubToken is not isolated per check: module-level axiosInstance and redaction state are shared

1 participant