unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: anothersms@gmail.com (Nicolò Balzarotti)
To: Guix-devel <guix-devel@gnu.org>
Subject: [GitHub] [GitHub API] Deprecation notice for authentication via URL query parameters
Date: Wed, 12 Feb 2020 10:36:22 +0100	[thread overview]
Message-ID: <87sgjgi1ux.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: 5e43c323226a8_a853f9f616cd9601987b0@github-lowworker-6313c1a.cp1-iad.github.net.mail

[-- 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


       reply	other threads:[~2020-02-12  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5e43c323226a8_a853f9f616cd9601987b0@github-lowworker-6313c1a.cp1-iad.github.net.mail>
2020-02-12  9:36 ` Nicolò Balzarotti [this message]
2020-02-24 16:52   ` [GitHub] [GitHub API] Deprecation notice for authentication via URL query parameters Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sgjgi1ux.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me \
    --to=anothersms@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).