Skip to content

Commit 55264c4

Browse files
committed
Merge public-key-scope-changes
2 parents 030b0cf + 8795ddc commit 55264c4

4 files changed

Lines changed: 60 additions & 22 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
kind: change
3+
title: Finer-grained OAuth scopes for SSH keys
4+
created_at: 2014-02-24
5+
author_name: pengwynn
6+
---
7+
As [we announced][blog], we've made some important changes to the way that API consumers manage SSH keys.
8+
9+
## Finer-grained OAuth scopes
10+
11+
To help third party applications request only permissions that they need, the API now supports three new [scopes][] for working with a user's public SSH keys.
12+
13+
- `read:public_key` provides read access to the user's SSH keys
14+
- `write:public_key` allows an app to read existing keys and create new ones
15+
- `admin:public_key` enables an app to read, write, and delete keys
16+
17+
## Changes to `user` scope
18+
19+
Historically, `user` scope has provided full access to manage a user's SSH keys. Now that we have dedicated scopes for managing a user's SSH keys, we have removed those permissions from the `user` scope. Now `user` scope will no longer provide access to SSH keys. Applications that need this access should request one of the new scopes described above.
20+
21+
## Keys are now immutable
22+
23+
To simplify the security audit trail for SSH keys, we're making keys immutable. API consumers can continue to create keys and delete keys as needed, but keys can no longer be changed. To change an existing key, API consumers should delete the existing key and create a new one with the desired attributes. This change applies both to a [user's SSH keys][user-keys] and a [repository's deploy keys][deploy-keys].
24+
25+
## Deleting keys when revoking a token
26+
27+
Also any keys created via an OAuth token from this point forward will be deleted when that token is revoked.
28+
29+
As always, if you have any questions or feedback, [please get in touch][contact].
30+
31+
[contact]: https://github.com/contact?form[subject]=API+improvements+for+SSH+keys
32+
[scopes]: /v3/oauth/#scopes
33+
[user-keys]: /v3/users/keys/
34+
[deploy-keys]: /v3/repos/keys/
35+
[blog]: https://github.com/blog/1786-enhanced-oauth-security-for-ssh-keys

content/v3/oauth.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ Name | Description
174174
`read:repo_hook`| Grants read and ping access to hooks in public or private repositories.
175175
`write:repo_hook`| Grants read, write, and ping access to hooks in public or private repositories.
176176
`admin:repo_hook`| Grants read, write, ping, and delete access to hooks in public or private repositories.
177+
`read:public_key`| List and view details for public keys.
178+
`write:public_key`| Create, list, and view details for public keys.
179+
`admin:public_key`| Fully manage public keys.
177180

178181
NOTE: Your application can request the scopes in the initial redirection. You
179182
can specify multiple scopes by separating them with a comma:
@@ -299,6 +302,9 @@ You can only send one of these scope keys at a time.
299302

300303
## Delete an authorization
301304

305+
Destroys an OAuth token and any [public keys][] previously created with that
306+
token.
307+
302308
DELETE /authorizations/:id
303309

304310
### Response
@@ -368,3 +374,4 @@ links that might be of help:
368374
[oauth changes blog]: /changes/2013-10-04-oauth-changes-coming/
369375
[basics auth guide]: /guides/basics-of-authentication/
370376
[deployments]: /v3/repos/deployments
377+
[public keys]: /v3/users/keys/

content/v3/repos/keys.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,8 @@ title: Deploy Keys | GitHub API
4040

4141
## Edit a deploy key {#edit}
4242

43-
PATCH /repos/:owner/:repo/keys/:id
44-
45-
### Input
46-
47-
<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA..." %>
48-
49-
### Response
50-
51-
<%= headers 200 %>
52-
<%= json :public_key %>
43+
Deploy keys are immutable. If you need to update a key, [remove the
44+
key](#delete) and [create a new one](#create) instead.
5345

5446
## Remove a deploy key {#delete}
5547

content/v3/users/keys.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ Lists the _verified_ public keys for a user. This is accessible by anyone.
2323

2424
GET /user/keys
2525

26-
Lists the current user's keys. Management of public keys via the API requires
27-
that you are authenticated through basic auth, or OAuth with the 'user' scope.
26+
Lists the current user's keys. Requires that you are authenticated via
27+
Basic Auth or via OAuth with at least `read:public_key`
28+
[scope](/v3/oauth/#scopes).
2829

2930
### Response
3031

@@ -33,6 +34,10 @@ that you are authenticated through basic auth, or OAuth with the 'user' scope.
3334

3435
## Get a single public key
3536

37+
View extended details for a single public key. Requires that you are
38+
authenticated via Basic Auth or via OAuth with at least `read:public_key`
39+
[scope](/v3/oauth/#scopes).
40+
3641
GET /user/keys/:id
3742

3843
### Response
@@ -42,6 +47,9 @@ that you are authenticated through basic auth, or OAuth with the 'user' scope.
4247

4348
## Create a public key
4449

50+
Creates a public key. Requires that you are authenticated via Basic Auth,
51+
or OAuth with at least `write:public_key` [scope](/v3/oauth/#scopes).
52+
4553
POST /user/keys
4654

4755
### Input
@@ -55,19 +63,15 @@ that you are authenticated through basic auth, or OAuth with the 'user' scope.
5563

5664
## Update a public key
5765

58-
PATCH /user/keys/:id
59-
60-
### Input
61-
62-
<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA..." %>
63-
64-
### Response
65-
66-
<%= headers 200 %>
67-
<%= json :public_key %>
66+
Public keys are immutable. If you need to update a public key, [remove the
67+
key](#delete-a-public-key) and [create a new one](#create-a-public-key)
68+
instead.
6869

6970
## Delete a public key
7071

72+
Removes a public key. Requires that you are authenticated via Basic Auth
73+
or via OAuth with at least `admin:public_key` [scope](/v3/oauth/#scopes).
74+
7175
DELETE /user/keys/:id
7276

7377
### Response

0 commit comments

Comments
 (0)