unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [GitHub] [GitHub API] Deprecation notice for authentication via URL query parameters
       [not found] <5e43c323226a8_a853f9f616cd9601987b0@github-lowworker-6313c1a.cp1-iad.github.net.mail>
@ 2020-02-12  9:36 ` Nicolò Balzarotti
  2020-02-24 16:52   ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolò Balzarotti @ 2020-02-12  9:36 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]

Hello Guix!

Just used `guix refresh enchive` and received this email from github:

> On February 12th, 2020 at 09:19 (UTC) your personal access token (guix refresh) using GNU Guile was used as part of a query parameter to access an endpoint through the GitHub API:

> https://api.github.com/repositories/83831780/releases

> Please use the Authorization HTTP header instead, as using the `access_token` query parameter is deprecated and will be removed July 1st, 2020.

> Depending on your API usage, we'll be sending you this email reminder once every 3 days for each token and User-Agent used in API calls made on your behalf.
> Just one URL that was accessed with a token and User-Agent combination will be listed in the email reminder, not all.

> Visit https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/#authenticating-using-query-parameters for more information.

> Thanks,
> The GitHub Team

I think the code responsible is import/github.scm:159

A tentative fix is attached, but I'm not sure how to test it


Thanks, Nicolò


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-try-fix-github.patch --]
[-- Type: text/x-patch, Size: 1501 bytes --]

From f5f3b4c88dbc18702581e897354ac14a2763c8aa Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Wed, 12 Feb 2020 10:34:11 +0100
Subject: [PATCH] try fix github

---
 guix/import/github.scm | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/guix/import/github.scm b/guix/import/github.scm
index df5f6ff32f..54054cb343 100644
--- a/guix/import/github.scm
+++ b/guix/import/github.scm
@@ -150,22 +150,19 @@ empty list."
                    (github-user-slash-repository url)
                    "/tags"))
 
-  (define headers
+  (define (headers)
     ;; Ask for version 3 of the API as suggested at
     ;; <https://developer.github.com/v3/>.
     `((Accept . "application/vnd.github.v3+json")
-      (user-agent . "GNU Guile")))
+      (user-agent . "GNU Guile")
+      ,(when (%github-token)
+         `(Authorization . ,(string-append "token " (%github-token))))))
 
-  (define (decorate url)
-    (if (%github-token)
-        (string-append url "?access_token=" (%github-token))
-        url))
-
-  (match (json-fetch (decorate release-url) #:headers headers)
+  (match (json-fetch release-url #:headers (headers))
     (#()
      ;; We got the empty list, presumably because the user didn't use GitHub's
      ;; "release" mechanism, but hopefully they did use Git tags.
-     (json-fetch (decorate tag-url) #:headers headers))
+     (json-fetch tag-url #:headers (headers)))
     (x x)))
 
 (define (latest-released-version url package-name)
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [GitHub] [GitHub API] Deprecation notice for authentication via URL query parameters
  2020-02-12  9:36 ` [GitHub] [GitHub API] Deprecation notice for authentication via URL query parameters Nicolò Balzarotti
@ 2020-02-24 16:52   ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2020-02-24 16:52 UTC (permalink / raw)
  To: Nicolò Balzarotti; +Cc: Guix-devel

Hi Nicolò,

anothersms@gmail.com (Nicolò Balzarotti) skribis:

> I think the code responsible is import/github.scm:159
>
> A tentative fix is attached, but I'm not sure how to test it

I pushed something similar contributed by Matt Wette in commit
3d1e42321f091b815835e28b54b37b7e9c79b9bb.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-24 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5e43c323226a8_a853f9f616cd9601987b0@github-lowworker-6313c1a.cp1-iad.github.net.mail>
2020-02-12  9:36 ` [GitHub] [GitHub API] Deprecation notice for authentication via URL query parameters Nicolò Balzarotti
2020-02-24 16:52   ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).