Skip to content

feat: send the token of GITHUB_TOKEN or GH_TOKEN to the GitHub API of a github download, and say when its rate limit is reached - #2144

Merged
lagergren merged 5 commits into
redhat-developer:mainfrom
lagergren:feat/github-token-for-installer-downloads
Nov 23, 2026
Merged

lagergren merged 5 commits into
redhat-developer:mainfrom
lagergren:feat/github-token-for-installer-downloads

Conversation

@lagergren

@lagergren lagergren commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #2142

Please merge with "Rebase and merge", not "Squash and merge". Each of the five commits is one change, and its title names what users will notice, so a rebase merge puts both in the release notes.

What

A download task with a github source finds its asset through the GitHub REST API, GET https://api.github.com/repos/<owner>/<repo>/releases?per_page=100, and sent no token.

  • The limit: without a token, the API allows 60 requests an hour per IP address, which everything behind that address shares: a corporate network, a VPN, CI runners.
  • What happened then: once they were used up, the console showed GitHub API returned HTTP 403 with a stack trace, and the download fell back to its url.
  • Installers left with nothing: 9 of the 15 bundled installers that download from GitHub have no url. So they couldn't install until the limit reset, and nothing said why or when.

Change

  • Token: when the environment variable GITHUB_TOKEN, or else GH_TOKEN, is set and isn't blank, the request to the GitHub API has Authorization: Bearer <token>, and the limit is 5,000 requests an hour.
  • Only to the GitHub API: the header is set on the request to api.github.com only, and the download of the asset doesn't get it. On a redirect, HttpURLConnection keeps it for the same host, port and protocol (a renamed repository), and drops it for any other: it calls requests.remove("Authorization") when !sameDestination. Tests check both.
  • Messages:
    • At the rate limit (403 or 429 with X-RateLimit-Remaining: 0, or a Retry-After), the console says that the limit is reached, what the limit is, and when it resets in local time (X-RateLimit-Reset) or when to try again (Retry-After). Without a token, it adds that GITHUB_TOKEN raises the limit.
    • A 401 with a token says that GitHub refused the token of that variable.
    • Neither has a stack trace, and other errors are shown as before.
  • When GitHub refuses the token (86988e8), the console says why:
    • SAML single sign-on: the organization enforces it and the token isn't authorized for it, with GitHub's link to authorize it, which expires after an hour. The link is shown only if it's a plain https URL that doesn't contain the token; it holds the token's id, not the token.
    • Missing permissions: a 403 with X-Accepted-GitHub-Permissions names the permissions the token lacks.
    • 404: the repository was not found, or it's private; with a token, that the token can't read it, and with the permissions header, which permission reading it needs. A 404 says "needs", not "lacks", because GitHub sends that header on a 200 too.
  • Retry without the token (4ed4b74): when GitHub refuses the token (401, 404, or 403/429 other than a secondary rate limit, including the token's own rate limit), the request is sent once more without it, and the console says so. A request without a token is never retried, and neither is a secondary rate limit, at which GitHub asks clients to wait.
  • Which tokens work: any token. Public repositories need no scope or permission: fine-grained tokens always include read-only access to them, and classic tokens need no scope. Only public repositories are supported, because the asset download sends no token. The 5,000 an hour are per user, shared by all their tokens; in GitHub Actions, GITHUB_TOKEN allows 1,000 an hour per repository.
  • Log (1e0fce4): through SLF4J, as the rest of LSP4IJ, which the IDE routes to idea.log. No sink is configured.
    • INFO: one line per download, with its URL, size and duration, and where the URL came from: the GitHub API with the token of a named variable or anonymously, Maven Central, or its url. Also each fallback: anonymously after a refused token, or to the url.
    • WARN: a rate limit, a refused token, a failed download, no download for the OS and architecture.
    • DEBUG, with #com.redhat.devtools.lsp4ij.installation in Help | Diagnostic Tools | Debug Log Settings: each GitHub API request with its URL, status, X-RateLimit-Remaining/X-RateLimit-Limit and duration.
  • X-GitHub-Api-Version isn't sent: without it, GitHub answers with the 2022-11-28 version, as today. A pinned 2022-11-28 would get 410 Gone after its support ends on 2028-03-10.
  • Docs: a "GitHub API rate limit" section in docs/UserDefinedLanguageServerTemplate.md: which tokens work, what each message means, the retry, and where the log is.

Behaviour changes

Change Commit
With GITHUB_TOKEN or GH_TOKEN set, a github download sends the token to the GitHub API, whose rate limit rises from 60 to 5,000 requests an hour. b065be3
At the GitHub API rate limit, the installer console says so, says when the limit resets, and that a token raises it; when GitHub refuses the token, it says so and names the variable. f600e5c
When GitHub refuses the token of a github download, the console says which permissions it lacks or that SAML single sign-on must authorize it, with GitHub's link; a 404 says that the repository was not found or is private. 86988e8
When GitHub refuses the token of a github download, the request is sent once more without the token, so a bad token no longer stops a public download. 4ed4b74
Installers log each download to idea.log, with its URL, size, duration and where the URL came from, and their fallbacks; they warn at a rate limit, a refused token or a failed download, and Debug Log Settings add each GitHub API request with its status, rate limit and duration. 1e0fce4

Backward compatibility

  • Without either variable: the same request, and the same console output, except for the message at the rate limit.
  • With a token that GitHub refuses (expired, revoked, not authorized by single sign-on, lacking permissions, or out of its rate limit), the request is tried once more without the token, so it installs as it did before this PR; the console says why.
  • A 404 without a token says "not found, or private" instead of HTTP 404 and a stack trace.
  • GitHubAssetFetcher(String, String) and Reporter are unchanged. AssetFetcher gets a default method, getSource(), so its implementations still compile.

Security: the token's handling

  • Where it's read: from the environment only. It's never put in the URL, the console, the log, an exception message or a notification; the console names the variable, not the token.
  • Where it's sent: to api.github.com only, not with the asset download, and it's dropped on a redirect to another host, port or protocol.
  • Malformed values: a value with a space or a control character inside isn't sent, and the console says so without the value. HttpURLConnection would reject a header with a line break, with an exception whose message contains the value.
  • Token.toString() leaves the value out.
  • The log never has the token or the Authorization header (tested for every kind of response, also with a token that has a line break). It names the variable only.
  • The single sign-on link shown is GitHub's authorization-request URL, which holds the token's id, not the token. A link containing the token, or one that isn't a plain https URL, isn't shown.
  • Unchanged by this PR: the JDK's sun.net.www.protocol.http.HttpURLConnection logger logs request headers at FINE, which is off unless turned on in Debug Log Settings.

Possible follow-ups

  • A token from the IDE: a setting kept in Password Safe, or the account of IntelliJ's GitHub plugin, as an optional dependency.
  • The notification of a failed download that has no url could carry the rate-limit message.

Test

  • New tests: GitHubAssetFetcherTest (37) and GitHubDownloadTaskTest (8). They run against a local HttpServer that records the request headers, so there's no network.
  • Coverage:
    • the header with GITHUB_TOKEN, with GH_TOKEN, and the order between them;
    • blank values and values with spaces around them;
    • a line break inside a value;
    • a redirect within the API, and to another host;
    • the asset download without the header;
    • every message;
    • single sign-on, with a link and partial-results, and a link containing the token not shown;
    • missing permissions, one set and two;
    • 404 with and without a token;
    • the retry without the token: 401, single sign-on, a missing permission, the token's rate limit, 404 then 404, and a DownloadTask that installs anonymously after a 401;
    • no retry without a token, or at a secondary rate limit;
    • the log at every level, captured through JUL;
    • that the console and the log never contain the token.
  • Test runs: --tests 'com.redhat.devtools.lsp4ij.installation.*' --rerun-tasks --no-build-cache gives 172 tests, 0 skipped, 0 failures, on 2024.2, 2025.3 and IU 2026.3. The full suite on 2024.2 gives 2,108 tests, 7 skipped (as before), 0 failures.
  • Without the change, 15 of the 20 new tests fail. The other 5 are guards. Mutations show that they catch a leak, a re-sent header and a blank value counted as a token.
  • Without each of the three later commits, its new tests fail: 8 of 8, 6 of 8 and 8 of 8. Mutations show that the guards catch the token in a link or in the log, and a retry that shouldn't happen.
  • Live:
    • One request with GITHUB_TOKEN set gets X-RateLimit-Limit: 5000, where it's 60 without. The console doesn't contain the token.
    • Without a token, testBundledInstallers (a local harness that runs bundled installers for real) passes for clangd, rust-analyzer, clojure-lsp, docker-language-server and codelldb, and their Intel downloads run; idea.log has their download lines, and no token.
    • With an invalid GITHUB_TOKEN: 401, then the anonymous retry finds the asset.
  • Not verified live: the missing-permission messages with a fine-grained token, as there was none to test with. They follow GitHub's documented X-Accepted-GitHub-Permissions header. A classic token showed that GitHub sends X-Accepted-OAuth-Scopes on a 200 as well as a 404, which is why a 404 says what reading the repository "needs", not what the token "lacks".

…o the GitHub API

A download task with a github source lists the releases through the GitHub API, which allows 60 requests an hour per
IP address without a token, and 5,000 with one. When the environment variable GITHUB_TOKEN, or else GH_TOKEN, is set
and isn't blank, the request to the GitHub API now has the header "Authorization: Bearer <token>". The environment is
the IDE's, as the commands of exec tasks get it, with the variables of the login shell on macOS.

The token goes to the GitHub API only. The download of the asset doesn't get it, and HttpURLConnection drops it on a
redirect to another host, port or protocol, which a test checks. The console says which variable the token comes
from, never the token. A value with a space or a control character inside isn't sent, since HttpURLConnection would
put a header with a line break in the message of its exception.

Without a token, nothing changes.

Refs redhat-developer#2142
…and when GitHub refuses the token

When the GitHub API answered a github download with an error, the console showed "GitHub API returned HTTP <code>"
and a stack trace. At the rate limit, a 403 or a 429 with X-RateLimit-Remaining: 0 or a Retry-After, it now says that
the rate limit is reached, the limit, when it resets in local time, from X-RateLimit-Reset, or when to try again, from
Retry-After, and, without a token, that a token in GITHUB_TOKEN raises the limit to 5,000 requests an hour. A 401 for
a token says that GitHub refused the token of its variable, which is invalid or has expired. These messages have no
stack trace. Other errors are shown as before.

Refs redhat-developer#2142
@lagergren lagergren added this to the 0.30.2 milestone Nov 23, 2026
@lagergren lagergren added enhancement New feature or request install labels Nov 23, 2026
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • GitHub release lookups can use GITHUB_TOKEN or, if unset, GH_TOKEN to increase the API rate limit. Tokens are used for release lookups, not asset downloads.
    • If GitHub refuses a token, release lookup retries anonymously when applicable. When rate limits prevent a lookup, downloads fall back to the configured URL when available.
    • Messages provide available reset or retry timing and explain authentication, access, or rate-limit issues without revealing token values.
  • Documentation
    • Added guidance on GitHub API limits, token setup, fallback behavior, and related messages.

GitHub release lookup now supports optional environment-based tokens, selected anonymous retries, and specific API error messages. Download tasks track and log URL sources and outcomes. Tests cover authentication, token secrecy, retries, rate limits, and URL fallback. Documentation describes the token and rate-limit behavior.

Changes: GitHub API authentication and download handling

Layer / File(s) Summary
Authenticated release lookup and error handling
src/main/java/com/redhat/devtools/lsp4ij/installation/download/GitHubAssetFetcher.java, src/test/java/com/redhat/devtools/lsp4ij/installation/download/GitHubAssetFetcherTest.java, src/test/java/com/redhat/devtools/lsp4ij/installation/download/LocalHttpServer.java
The fetcher supports configurable API and environment lookups, selects and validates GITHUB_TOKEN before GH_TOKEN, and sends valid tokens as Bearer authorization. It retries anonymously after selected token refusals and reports specific API errors. Tests cover token handling, redirects, errors, and token redaction.
Download source reporting and fallback
src/main/java/com/redhat/devtools/lsp4ij/installation/download/AssetFetcher.java, src/main/java/com/redhat/devtools/lsp4ij/installation/download/MavenArtifactFetcher.java, src/main/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/DownloadTask.java, src/test/java/com/redhat/devtools/lsp4ij/installation/download/GitHubDownloadTaskTest.java, src/test/java/com/redhat/devtools/lsp4ij/installation/download/LogRecorder.java, docs/UserDefinedLanguageServerTemplate.md
Fetchers provide a source description, and download tasks record the selected URL source and log download results and failures. Tests verify that tokens do not reach asset requests or output, and cover anonymous retry and configured URL fallback. Documentation describes API limits, token handling, errors, and fallback behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant DownloadTask
  participant GitHubAssetFetcher
  participant GitHubAPI
  participant AssetURL
  DownloadTask->>GitHubAssetFetcher: Fetch matching release asset
  GitHubAssetFetcher->>GitHubAPI: Request releases with optional Bearer token
  GitHubAPI-->>GitHubAssetFetcher: Return release data or API error
  GitHubAssetFetcher-->>DownloadTask: Return asset URL or fetch failure
  DownloadTask->>AssetURL: Download asset without API token
  DownloadTask->>DownloadTask: Use configured URL fallback when available
Loading

Suggested reviewers: angelozerr

Merge Risk: Minimal · up to 1e0fc

This change adds optional GitHub token support for installer downloads, clearer rate-limit and token-refusal messages, and extra logging. Behavior without a token is unchanged, and the token is not sent to asset downloads or logged. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: optional GITHUB_TOKEN or GH_TOKEN support for GitHub API requests in github downloads, plus a clearer message when the rate limit is reached. The changeset adds token …
Description check Passed The description is detailed and matches the changeset. It covers the token lookup order, the header scope, rate-limit and token-refusal messages, the anonymous retry, logging, documentation, and tests…
Linked Issues check Passed Only #2142 is linked, as a direct target. It is open. Its coding requirements are:

1. Optional token from the environment [#2142]: GITHUB_TOKEN, then GH_TOKEN, read through EnvironmentUtil.getValue a…
Out of Scope Changes check Passed The changes since the previous review are: SAML and permission messages and 404 handling (86988e8), the single anonymous retry (4ed4b74), and installer logging with the getSource() default method (1…
Full details: Title check

Explanation

The title names the main change: optional GITHUB_TOKEN or GH_TOKEN support for GitHub API requests in github downloads, plus a clearer message when the rate limit is reached. The changeset adds token handling, rate-limit messages, token-refusal handling, retry, and logging, so the title covers the primary change. It is long (127 characters), but it is specific and on-topic.

Full details: Description check

Explanation

The description is detailed and matches the changeset. It covers the token lookup order, the header scope, rate-limit and token-refusal messages, the anonymous retry, logging, documentation, and tests. It also lists behaviour changes and backward-compatibility notes.

Full details: Linked Issues check

Explanation

Only #2142 is linked, as a direct target. It is open. Its coding requirements are:

  1. Optional token from the environment [#2142]: GITHUB_TOKEN, then GH_TOKEN, read through EnvironmentUtil.getValue at each request. Blank values are skipped. Commit b065be3 covers this, and tests cover precedence and blank values.
  2. Header only for api.github.com [#2142]: Authorization: Bearer <token> goes only to the API request. The asset download does not get it. On a redirect to another host, port, or protocol, requests.remove("Authorization") runs. Tests cover both cases.
  3. Token never printed [#2142]: Console and log name the variable, not the value. Token.toString() omits the value. The log is tested for every response kind, including a token with a line break. The new SAML link is shown only if it is a plain https URL that does not contain the token.
  4. Rate-limit messaging [#2142]: On 403 or 429 with X-RateLimit-Remaining: 0 (or Retry-After), the console states that the limit is reached, the limit, and the reset time (X-RateLimit-Reset) or retry time. Without a token, it states that GITHUB_TOKEN raises the limit. Commit f600e5c covers this.
  5. No change without a token [#2142]: Without either variable, the request is unchanged. Retry without the token applies only to requests that had a token, so the anonymous path is not affected.

The IDE token sources (Password Safe, GitHub plugin) are optional in #2142 and listed as follow-ups in the PR. They are not required here.

The later commits (86988e8, 4ed4b74, 1e0fce4) add refusal messages, a single anonymous retry, and logging. They do not conflict with any requirement above. The summary states that the new tests cover them. I did not run the tests. The assessment relies on the PR summary and test descriptions.

Full details: Out of Scope Changes check

Explanation

The changes since the previous review are: SAML and permission messages and 404 handling (86988e8), the single anonymous retry (4ed4b74), and installer logging with the getSource() default method (1e0fce4).

  • SAML, permission, and 404 messages explain refused tokens. They extend the token and rate-limit messaging of #2142, so they connect to it.
  • The anonymous retry keeps a bad token from blocking public downloads. Without it, the new token feature would break installs. This connects to #2142.
  • The idea.log entries show the source of each URL, including the named token variable. They also show rate-limit status for GitHub API requests. These support the diagnosis that #2142 describes. The download size and timing lines apply to all downloads in DownloadTask, which is broader than #2142. The connection is indirect, but it is not unrelated.
  • getSource() on AssetFetcher, and the MavenArtifactFetcher override, support the log lines that name the URL source.
  • LogRecorder and LocalHttpServer are test utilities for these changes.
  • Docs: the new rate-limit section documents the token behavior.

No change was found that has no connection to #2142 or to the token and rate-limit behavior it introduces.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9c70b125-5658-4bed-a2e6-96014ec650d1
Commits

Reviewing files that changed from the base of the PR and between f600e5c and 1e0fce4.

Files selected for processing: 9

  • docs/UserDefinedLanguageServerTemplate.md
  • src/main/java/com/redhat/devtools/lsp4ij/installation/definition/tasks/DownloadTask.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/download/AssetFetcher.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/download/GitHubAssetFetcher.java
  • src/main/java/com/redhat/devtools/lsp4ij/installation/download/MavenArtifactFetcher.java
  • src/test/java/com/redhat/devtools/lsp4ij/installation/download/GitHubAssetFetcherTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/installation/download/GitHubDownloadTaskTest.java
  • src/test/java/com/redhat/devtools/lsp4ij/installation/download/LocalHttpServer.java
  • src/test/java/com/redhat/devtools/lsp4ij/installation/download/LogRecorder.java
Files skipped from review as they are similar to previous changes: 1

  • docs/UserDefinedLanguageServerTemplate.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.28571% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.49%. Comparing base (a802177) to head (1e0fce4).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...p4ij/installation/download/GitHubAssetFetcher.java 89.57% 9 Missing and 8 partials ⚠️
...ij/installation/definition/tasks/DownloadTask.java 93.54% 2 Missing ⚠️
...ols/lsp4ij/installation/download/AssetFetcher.java 0.00% 1 Missing ⚠️
...ij/installation/download/MavenArtifactFetcher.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2144      +/-   ##
==========================================
+ Coverage   53.21%   53.49%   +0.27%     
==========================================
  Files         826      827       +1     
  Lines       34717    34899     +182     
  Branches     5423     5457      +34     
==========================================
+ Hits        18475    18669     +194     
+ Misses      13472    13449      -23     
- Partials     2770     2781      +11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…on must authorize it, when GitHub refuses a github download

When the GitHub API refused the token of a github download with 403 or 404, the console showed "GitHub API returned
HTTP <code>" and a stack trace. It now says why:

- a 403 or 404 with X-GitHub-SSO: the organization enforces SAML single sign-on, and the token of its variable isn't
  authorized for it, with the link which authorizes it when the header has one. The link identifies the
  authorization request, not the token; one which would show the token isn't shown.
- a 403 with X-Accepted-GitHub-Permissions: the token lacks the permissions that it names.
- a 404: the repository was not found, or it is private and the token of its variable can't read it, with the
  permissions which read it when GitHub names them; without a token, that it was not found, or is private.

The docs say that a github download supports public repositories only, since the asset download has no token, that
the 5,000 requests an hour are per user, shared by all their tokens, that GITHUB_TOKEN in GitHub Actions allows 1,000
an hour per repository, and what the messages mean.

Refs redhat-developer#2142
…s the token

The releases of a public repository don't need a token, but a token which GitHub refused kept a github download from
installing: an expired or revoked one, one which SAML single sign-on doesn't authorize, one which lacks permissions,
or one whose rate limit is reached. When the request had a token and the GitHub API answers 401, 404, or 403 or 429
other than a secondary rate limit, the console now says why, adds "Trying again without the token.", and the request
is sent once more without the Authorization header. If that one fails too, the console says why, as for any request
without a token.

A request is tried again once only, and only when it had a token. A secondary rate limit, whose Retry-After asks to
wait before the next request, isn't tried again.

Refs redhat-developer#2142
…of installers to idea.log

What a download task did was only in the installer console, which is gone with the IDE session. It now logs with
SLF4J, which the IDE writes to idea.log:

- INFO, one line per download: its URL, its size, how long it took, and where the URL comes from: the GitHub API,
  with the token of an environment variable, by its name, or anonymously; Maven Central; or the 'url' of the
  download. Also when a request is tried again anonymously, since GitHub refused the token, and when a download falls
  back to its 'url'.
- WARN: a rate limit, a token which GitHub refused, a GitHub API request which failed, and a download which failed.
- DEBUG, with #com.redhat.devtools.lsp4ij.installation in Debug Log Settings: each request to the GitHub API, with its
  URL, its HTTP status, X-RateLimit-Remaining and X-RateLimit-Limit, and how long it took.

The log never has the token, nor the Authorization header. AssetFetcher has a default getSource(), which says where
the last download URL comes from.

Refs redhat-developer#2142
@lagergren

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lagergren
lagergren merged commit 661b774 into redhat-developer:main Nov 23, 2026
11 checks passed
lagergren added a commit to lagergren/lsp4ij that referenced this pull request Nov 24, 2026
…llation can be diagnosed when no console was open

An installer printed only to the consoles that registered with it: the Traces tab of the language server, once it was
opened, and the console of a DAP run. An installer that ran at the start of a language server whose console was never
opened printed into nothing, and idea.log had only the downloads of redhat-developer#2144.

Each line that an installer prints now also goes to the IDE's log through SLF4J, whatever consoles are registered, as
com.redhat.devtools.lsp4ij.installation.definition.InstallerContext, prefixed with the name of the installer:

- INFO: the start and the result of the installation and of each step. The results are new lines, for the log only.
- WARN: the errors that the console shows in red.
- DEBUG, with #com.redhat.devtools.lsp4ij.installation in Debug Log Settings: the rest of what the console shows, as
  the commands of the exec tasks and their output, also on their standard error.

A value which can be a secret is replaced with <redacted> in the log: an Authorization header, Bearer credentials, the
user and password of a URL, a URL parameter, option or assignment whose name ends with token, secret, password, api-key,
credentials or signature, a GitHub token, and the value of an environment variable whose name says that it holds one, as
GITHUB_TOKEN. The console shows the lines as before.

The errors which redhat-developer#2144 logs as warnings with more context, those of a download and of the GitHub API, are logged once:
their console lines go to DEBUG. The Maven fetcher now logs its errors as the GitHub one does.

InstallerContext gets print(String, ConsoleViewContentType, Level), through which every line is printed; the existing
print(String, ConsoleViewContentType) logs at the level of its content type.

Fixes redhat-developer#2156
lagergren added a commit that referenced this pull request Nov 24, 2026
…llation can be diagnosed when no console was open

An installer printed only to the consoles that registered with it: the Traces tab of the language server, once it was
opened, and the console of a DAP run. An installer that ran at the start of a language server whose console was never
opened printed into nothing, and idea.log had only the downloads of #2144.

Each line that an installer prints now also goes to the IDE's log through SLF4J, whatever consoles are registered, as
com.redhat.devtools.lsp4ij.installation.definition.InstallerContext, prefixed with the name of the installer:

- INFO: the start and the result of the installation and of each step. The results are new lines, for the log only.
- WARN: the errors that the console shows in red.
- DEBUG, with #com.redhat.devtools.lsp4ij.installation in Debug Log Settings: the rest of what the console shows, as
  the commands of the exec tasks and their output, also on their standard error.

A value which can be a secret is replaced with <redacted> in the log: an Authorization header, Bearer credentials, the
user and password of a URL, a URL parameter, option or assignment whose name ends with token, secret, password, api-key,
credentials or signature, a GitHub token, and the value of an environment variable whose name says that it holds one, as
GITHUB_TOKEN. The console shows the lines as before.

The errors which #2144 logs as warnings with more context, those of a download and of the GitHub API, are logged once:
their console lines go to DEBUG. The Maven fetcher now logs its errors as the GitHub one does.

InstallerContext gets print(String, ConsoleViewContentType, Level), through which every line is printed; the existing
print(String, ConsoleViewContentType) logs at the level of its content type.

Fixes #2156
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request install

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installers: send an optional GitHub token, so that GitHub downloads don't stop at the API's 60 calls an hour

1 participant