Skip to content

Commit 3df320f

Browse files
authored
Branch was updated using the 'autoupdate branch' Actions workflow.
2 parents 4d78b35 + a73f450 commit 3df320f

5 files changed

Lines changed: 57 additions & 2 deletions

File tree

content/developers/overview/secret-scanning.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,48 @@ openssl_key = OpenSSL::PKey::EC.new(current_key)
278278
puts openssl_key.verify(OpenSSL::Digest::SHA256.new, Base64.decode64(signature), payload.chomp)
279279
```
280280

281+
**Validation sample in JavaScript**
282+
```js
283+
const crypto = require("crypto");
284+
const axios = require("axios");
285+
286+
const GITHUB_KEYS_URI = "https://api.github.com/meta/public_keys/secret_scanning";
287+
288+
/**
289+
* Verify a payload and signature against a public key
290+
* @param {String} payload the value to verify
291+
* @param {String} signature the expected value
292+
* @param {String} keyID the id of the key used to generated the signature
293+
* @return {void} throws if the signature is invalid
294+
*/
295+
const verify_signature = async (payload, signature, keyID) => {
296+
if (typeof payload !== "string" || payload.length === 0) {
297+
throw new Error("Invalid payload");
298+
}
299+
if (typeof signature !== "string" || signature.length === 0) {
300+
throw new Error("Invalid signature");
301+
}
302+
if (typeof keyID !== "string" || keyID.length === 0) {
303+
throw new Error("Invalid keyID");
304+
}
305+
306+
const keys = (await axios.get(GITHUB_KEYS_URI)).data;
307+
if (!(keys?.public_keys instanceof Array) || keys.length === 0) {
308+
throw new Error("No public keys found");
309+
}
310+
311+
const publicKey = keys.public_keys.find((k) => k.key_identifier === keyID) ?? null;
312+
if (publicKey === null) {
313+
throw new Error("No public key found matching key identifier");
314+
}
315+
316+
const verify = crypto.createVerify("SHA256").update(payload);
317+
if (!verify.verify(publicKey.key, Buffer.from(signature, "base64"), "base64")) {
318+
throw new Error("Signature does not match payload");
319+
}
320+
};
321+
```
322+
281323
#### Implement secret revocation and user notification in your secret alert service
282324
283325
For {% data variables.product.prodname_secret_scanning %} in public repositories, you can enhance your secret alert service to revoke the exposed secrets and notify the affected users. How you implement this in your secret alert service is up to you, but we recommend considering any secrets that {% data variables.product.prodname_dotcom %} sends you messages about as public and compromised.

content/github/developing-online-with-codespaces/managing-encrypted-secrets-for-codespaces.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ versions:
1212

1313
{% endnote %}
1414

15+
1516
### About encrypted secrets for {% data variables.product.prodname_codespaces %}
1617

1718
You can add encrypted secrets to your user account that you want to use in your codespaces. For example, you may want to store and access the following sensitive information as encrypted secrets.
@@ -24,6 +25,12 @@ You can choose which repositories should have access to each secret. Then, you c
2425

2526
### Adding a secret
2627

28+
{% note %}
29+
30+
**Note:** Tokens starting with GITHUB_ are reserved
31+
32+
{% endnote %}
33+
2734
{% data reusables.user_settings.access_settings %}
2835
{% data reusables.user_settings.codespaces-tab %}
2936
1. To the right of "Codespaces secrets", click **New secret**.

content/github/searching-for-information-on-github/understanding-the-search-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Query | Example
4848
<code><=<em>YYYY</em>-<em>MM</em>-<em>DD</em></code> | **[cats created:<=2012-07-04](https://github.com/search?utf8=%E2%9C%93&q=cats+created%3A%3C%3D2012-07-04&type=Issues)** matches issues with the word "cats" that were created on or before July 4, 2012.
4949
<code><em>YYYY</em>-<em>MM</em>-<em>DD</em>..<em>YYYY</em>-<em>MM</em>-<em>DD</em></code> | **[cats pushed:2016-04-30..2016-07-04](https://github.com/search?utf8=%E2%9C%93&q=cats+pushed%3A2016-04-30..2016-07-04&type=Repositories)** matches repositories with the word "cats" that were pushed to between the end of April and July of 2016.
5050
<code><em>YYYY</em>-<em>MM</em>-<em>DD</em>..*</code> | **[cats created:2012-04-30..*](https://github.com/search?utf8=%E2%9C%93&q=cats+created%3A2012-04-30..*&type=Issues)** matches issues created after April 30th, 2012 containing the word "cats."
51-
<code>*..<em>YYYY</em>-<em>MM</em>-<em>DD</em></code> | **[cats created:*..2012-04-30](https://github.com/search?utf8=%E2%9C%93&q=cats+created%3A*..2012-07-04&type=Issues)** matches issues created before July 4th, 2012 containing the word "cats."
51+
<code>*..<em>YYYY</em>-<em>MM</em>-<em>DD</em></code> | **[cats created:*..2012-07-04](https://github.com/search?utf8=%E2%9C%93&q=cats+created%3A*..2012-07-04&type=Issues)** matches issues created before July 4th, 2012 containing the word "cats."
5252

5353
{% data reusables.time_date.time_format %}
5454

content/graphql/guides/using-the-graphql-api-for-discussions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ discussionCategories(
8383

8484
### Repository.discussion
8585

86-
Get a discussion. Returns `null` if discussion with the specified ID exists.
86+
Get a discussion. Returns `null` if discussion with the specified ID does not exist.
8787

8888
_Signature:_
8989

content/rest/overview/libraries.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ Library name | Repository
108108
**GitHub bridge for Laravel**|[GrahamCampbell/Laravel-GitHub](https://github.com/GrahamCampbell/Laravel-GitHub)
109109
**PHP7 Client & WebHook wrapper**|[FlexyProject/GitHubAPI](https://github.com/FlexyProject/GitHubAPI)
110110

111+
### PowerShell
112+
113+
Library name | Repository
114+
|---|---|
115+
**PowerShellForGitHub**|[microsoft/PowerShellForGitHub](https://github.com/microsoft/PowerShellForGitHub)
116+
111117
### Python
112118

113119
Library name | Repository

0 commit comments

Comments
 (0)