Response body from github is not properly printed in error messages #794

Closed
opened 2025-04-09 09:48:47 +00:00 by r-vdp · 3 comments

Describe the bug

Some repos disallow classical access tokens to be used, when using lix with access-tokens = github.com=<...>, github returns a 403 and lix shows the following:

error:
       … while updating the lock file of flake 'git+file:///home/ramses/projects/github.com/golem-base/op-geth'

       … while updating the flake input 'rpcplorer'

       … while fetching the input 'github:Golem-Base/rpcplorer/v0.0.3'

       error: unable to download 'https://api.github.com/repos/Golem-Base/rpcplorer/commits/v0.0.3': HTTP error 403 ()

       response body:

      u=�
         �V"    [ѱ�7g��4��JIa� Č##�y
       2�Hs=Z�&ʜ"Օ��\<�-�iv�*r_d�IN3j�)<En��[EAQ��&>RƦ�biU'�Rc
                                                              Vx}�zV/Q)

Whereas cppnix shows this:

error:
       … while updating the lock file of flake 'git+file:///home/ramses/projects/github.com/golem-base/op-geth'

       … while updating the flake input 'rpcplorer'

       … while fetching the input 'github:Golem-Base/rpcplorer/v0.0.3'

       error: unable to download 'https://api.github.com/repos/Golem-Base/rpcplorer/commits/v0.0.3': HTTP error 403

       response body:

       {
         "message": "`Golem-Base` forbids access via a personal access token (classic). Please use a GitHub App, OAuth App, or a personal access token with fine-grained permissions.",
         "documentation_url": "https://docs.github.com/rest/commits/commits#get-a-commit",
         "status": "403"
       }

The former makes it very hard to understand what's going on.

Steps To Reproduce

  1. Configure an access-token for github.com in your nix config and set it to a classical access token
  2. Add a flake input rpcplorer.url = "github:Golem-Base/rpcplorer/v0.0.3";
  3. Try to generate the flake.lock file
  4. See error with binary output

Expected behavior

Properly decode and print the error message that was received in the http reply, like cppnix does.

nix --version output

lix:

nix (Lix, like Nix) 2.93.0-dev
System type: x86_64-linux
Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux, x86_64-v4-linux
Features: gc, signed-caches
System configuration file: /etc/nix/nix.conf
User configuration files: /home/ramses/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/ramses/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/ramses/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/ramses/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf
Store directory: /nix/store
State directory: /nix/var/nix
Data directory: /nix/store/95vqs65cvjmvw566spiavqjp8nhz293a-lix-2.93.0-dev/share

cppnix that I compared with: nix (Nix) 2.24.14

## Describe the bug Some repos disallow classical access tokens to be used, when using lix with `access-tokens = github.com=<...>`, github returns a 403 and lix shows the following: ``` error: … while updating the lock file of flake 'git+file:///home/ramses/projects/github.com/golem-base/op-geth' … while updating the flake input 'rpcplorer' … while fetching the input 'github:Golem-Base/rpcplorer/v0.0.3' error: unable to download 'https://api.github.com/repos/Golem-Base/rpcplorer/commits/v0.0.3': HTTP error 403 () response body: u=� �V" [ѱ�7g��4��JIa� Č##�y 2�Hs=Z�&ʜ"Օ��\<�-�iv�*r_d�IN3j�)<En��[EAQ��&>RƦ�biU'�Rc Vx}�zV/Q) ``` Whereas cppnix shows this: ``` error: … while updating the lock file of flake 'git+file:///home/ramses/projects/github.com/golem-base/op-geth' … while updating the flake input 'rpcplorer' … while fetching the input 'github:Golem-Base/rpcplorer/v0.0.3' error: unable to download 'https://api.github.com/repos/Golem-Base/rpcplorer/commits/v0.0.3': HTTP error 403 response body: { "message": "`Golem-Base` forbids access via a personal access token (classic). Please use a GitHub App, OAuth App, or a personal access token with fine-grained permissions.", "documentation_url": "https://docs.github.com/rest/commits/commits#get-a-commit", "status": "403" } ``` The former makes it very hard to understand what's going on. ## Steps To Reproduce 1. Configure an access-token for github.com in your nix config and set it to a classical access token 2. Add a flake input `rpcplorer.url = "github:Golem-Base/rpcplorer/v0.0.3";` 3. Try to generate the flake.lock file 4. See error with binary output ## Expected behavior Properly decode and print the error message that was received in the http reply, like cppnix does. ## `nix --version` output lix: ``` nix (Lix, like Nix) 2.93.0-dev System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux, x86_64-v4-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: /home/ramses/.config/nix/nix.conf:/etc/xdg/nix/nix.conf:/home/ramses/.nix-profile/etc/xdg/nix/nix.conf:/nix/profile/etc/xdg/nix/nix.conf:/home/ramses/.local/state/nix/profile/etc/xdg/nix/nix.conf:/etc/profiles/per-user/ramses/etc/xdg/nix/nix.conf:/nix/var/nix/profiles/default/etc/xdg/nix/nix.conf:/run/current-system/sw/etc/xdg/nix/nix.conf Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/95vqs65cvjmvw566spiavqjp8nhz293a-lix-2.93.0-dev/share ``` cppnix that I compared with: `nix (Nix) 2.24.14`
pennae added this to the 2.93 milestone 2025-04-09 11:15:16 +00:00
Owner

oh, great. this looks like it's related to the curl fuckery (#662). we should revert the curl decompression changes that didn't actually work, at that point this failure should be fixed as well.

oh, great. this looks like it's related to the curl fuckery (#662). we should revert the curl decompression changes that didn't actually work, at that point this failure should be fixed as well.
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/2968 ("Revert "libstore: don't use curl decompression support"")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2968", "number": 2968, "kind": "commit message"}], "cl_meta": {"2968": {"change_title": "Revert \"libstore: don't use curl decompression support\""}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/2968](https://gerrit.lix.systems/c/lix/+/2968) ("Revert "libstore: don't use curl decompression support"")
Owner

fixed since the revert is merged

fixed since the revert is merged
jade closed this issue 2025-04-11 06:34:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#794
No description provided.