Bezpieczeństwo
Odbiornik zgłoszeń wycieków kluczy (GitHub secret scanning).
Zgłoszenie wycieku kluczy (GitHub secret scanning)
POST /security/leak-report
tylko alleelimit: write
Wywołuje GitHub, gdy w publicznym repozytorium znajdzie klucz allee (allee_sk_live_…, allee_sk_test_…, allee_at_…, allee_rt_…, allee_cs_…). Podpis ECDSA w nagłówkach Github-Public-Key-Identifier i Github-Public-Key-Signature.
Znaleziony klucz unieważniamy natychmiast, token OAuth — razem z kwarantanną pary, a sprzedawca dostaje powiadomienie. Odpowiedź zawiera skrót SHA-256 zamiast jawnego tokenu. Integratorzy nie wołają tej trasy.
Zgodność: tylko allee — GitHub secret scanning partner program.
Uwierzytelnienie: brak.
Nagłówki
Github-Public-Key-Identifier string wymaganyIdentyfikator klucza GitHuba.
Github-Public-Key-Signature string wymaganyPodpis ECDSA treści (base64).
Treść żądania application/json
token string wymaganeWykryty sekret.
type stringTyp wzorca u GitHuba.
url stringGdzie znaleziono.
source stringOdpowiedzi
200 Wynik dla każdego tokenu. · LeakReportResult
token_hash string zawszeSHA-256 tokenu (zamiast jawnego).
token_type string zawszelabel string zawszetrue_positive, false_positiveBłędy
| HTTP | Kod | Znaczenie |
|---|---|---|
| 401 | INVALID_SIGNATURE | Zły podpis zgłoszenia GitHuba. |
| 413 | PAYLOAD_TOO_LARGE | Treść żądania za duża (JSON 5 MB, faktura PDF 3 MB). |
| 422 | JsonMappingException | Treść nie jest poprawnym JSON albo ma zły kształt (np. images jako obiekty). |
| 500 | INTERNAL_ERROR | Błąd serwera allee. |
| 503 | NOT_DEPLOYED | Funkcja jeszcze nie uruchomiona (np. sandbox, wsady). |
curl -sS -X POST "${ALLEE_API_URL:-https://api.allee.pl}/security/leak-report" \
-H "Accept: application/json" \
-H "Github-Public-Key-Identifier: dok-test-klucz-1" \
-H "Github-Public-Key-Signature: MEYCIQCDjKriWvn4Qfh5aSJUn2p+zd9eZdn8FnzIqmdC9W+sZQIhAKCVfQ3f55eEx9RN9+RcvOPKH2aEJBDiqQk6hXtC9OwS" \
-H "Content-Type: application/json" \
--data-raw '[{"token":"allee_sk_live_…","type":"allee_personal_api_key","url":"https://github.com/przyklad/repo/blob/main/config.php","source":"content"}]' \
-w '\nHTTP %{http_code}\n'<?php
// allee API: POST /security/leak-report (PHP 8, rozszerzenie curl)
$base = getenv('ALLEE_API_URL') ?: 'https://api.allee.pl';
$body = '[{"token":"allee_sk_live_…","type":"allee_personal_api_key","url":"https://github.com/przyklad/repo/blob/main/config.php","source":"content"}]';
$ch = curl_init($base . '/security/leak-report');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Accept: application/json',
'Github-Public-Key-Identifier: dok-test-klucz-1',
'Github-Public-Key-Signature: MEYCIQCDjKriWvn4Qfh5aSJUn2p+zd9eZdn8FnzIqmdC9W+sZQIhAKCVfQ3f55eEx9RN9+RcvOPKH2aEJBDiqQk6hXtC9OwS',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => $body,
CURLOPT_RETURNTRANSFER => true,
]);
$odp = curl_exec($ch);
echo 'HTTP ', curl_getinfo($ch, CURLINFO_RESPONSE_CODE), "\n", $odp, "\n";# allee API: POST /security/leak-report (Python 3, biblioteka requests)
import os
import requests
BASE = os.environ.get("ALLEE_API_URL", "https://api.allee.pl")
headers = {
"Accept": "application/json",
"Github-Public-Key-Identifier": "dok-test-klucz-1",
"Github-Public-Key-Signature": "MEYCIQCDjKriWvn4Qfh5aSJUn2p+zd9eZdn8FnzIqmdC9W+sZQIhAKCVfQ3f55eEx9RN9+RcvOPKH2aEJBDiqQk6hXtC9OwS",
"Content-Type": "application/json",
}
body = "[{\"token\":\"allee_sk_live_…\",\"type\":\"allee_personal_api_key\",\"url\":\"https://github.com/przyklad/repo/blob/main/config.php\",\"source\":\"content\"}]"
r = requests.request("POST", BASE + "/security/leak-report", headers=headers, data=body.encode("utf-8"), timeout=60, allow_redirects=False)
print("HTTP", r.status_code)
print(r.text)// allee API: POST /security/leak-report (Node.js 18+, wbudowany fetch; plik .mjs)
const BASE = process.env.ALLEE_API_URL ?? "https://api.allee.pl";
const body = "[{\"token\":\"allee_sk_live_…\",\"type\":\"allee_personal_api_key\",\"url\":\"https://github.com/przyklad/repo/blob/main/config.php\",\"source\":\"content\"}]";
const res = await fetch(`${BASE}/security/leak-report`, {
method: "POST",
headers: {
"Accept": "application/json",
"Github-Public-Key-Identifier": "dok-test-klucz-1",
"Github-Public-Key-Signature": "MEYCIQCDjKriWvn4Qfh5aSJUn2p+zd9eZdn8FnzIqmdC9W+sZQIhAKCVfQ3f55eEx9RN9+RcvOPKH2aEJBDiqQk6hXtC9OwS",
"Content-Type": "application/json",
},
body,
redirect: "manual",
});
console.log("HTTP", res.status);
console.log(await res.text());// allee API: POST /security/leak-report (C#, .NET 8+, HttpClient)
using System.Net.Http.Headers;
using System.Text;
var baseUrl = Environment.GetEnvironmentVariable("ALLEE_API_URL") ?? "https://api.allee.pl";
using var http = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false });
using var req = new HttpRequestMessage(new HttpMethod("POST"), baseUrl + "/security/leak-report");
req.Headers.Accept.ParseAdd("application/json");
req.Headers.Add("Github-Public-Key-Identifier", "dok-test-klucz-1");
req.Headers.Add("Github-Public-Key-Signature", "MEYCIQCDjKriWvn4Qfh5aSJUn2p+zd9eZdn8FnzIqmdC9W+sZQIhAKCVfQ3f55eEx9RN9+RcvOPKH2aEJBDiqQk6hXtC9OwS");
var json = "[{\"token\":\"allee_sk_live_…\",\"type\":\"allee_personal_api_key\",\"url\":\"https://github.com/przyklad/repo/blob/main/config.php\",\"source\":\"content\"}]";
req.Content = new StringContent(json, Encoding.UTF8);
req.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
using var res = await http.SendAsync(req);
Console.WriteLine($"HTTP {(int)res.StatusCode}");
Console.WriteLine(await res.Content.ReadAsStringAsync());// allee API: POST /security/leak-report (Java 11+, java.net.http; uruchom: java Main.java)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String base = System.getenv().getOrDefault("ALLEE_API_URL", "https://api.allee.pl");
String body = "[{\"token\":\"allee_sk_live_…\",\"type\":\"allee_personal_api_key\",\"url\":\"https://github.com/przyklad/repo/blob/main/config.php\",\"source\":\"content\"}]";
HttpRequest req = HttpRequest.newBuilder(URI.create(base + "/security/leak-report"))
.header("Accept", "application/json")
.header("Github-Public-Key-Identifier", "dok-test-klucz-1")
.header("Github-Public-Key-Signature", "MEYCIQCDjKriWvn4Qfh5aSJUn2p+zd9eZdn8FnzIqmdC9W+sZQIhAKCVfQ3f55eEx9RN9+RcvOPKH2aEJBDiqQk6hXtC9OwS")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
HttpClient http = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).build();
HttpResponse<String> res = http.send(req, HttpResponse.BodyHandlers.ofString());
System.out.println("HTTP " + res.statusCode());
System.out.println(res.body());
}
}// allee API: POST /security/leak-report (Go 1.20+, net/http; uruchom: go run main.go)
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
base := os.Getenv("ALLEE_API_URL")
if base == "" {
base = "https://api.allee.pl"
}
body := `[{"token":"allee_sk_live_…","type":"allee_personal_api_key","url":"https://github.com/przyklad/repo/blob/main/config.php","source":"content"}]`
req, err := http.NewRequest("POST", base+"/security/leak-report", strings.NewReader(body))
if err != nil {
panic(err)
}
req.Header.Set("Accept", "application/json")
req.Header.Set("Github-Public-Key-Identifier", "dok-test-klucz-1")
req.Header.Set("Github-Public-Key-Signature", "MEYCIQCDjKriWvn4Qfh5aSJUn2p+zd9eZdn8FnzIqmdC9W+sZQIhAKCVfQ3f55eEx9RN9+RcvOPKH2aEJBDiqQk6hXtC9OwS")
req.Header.Set("Content-Type", "application/json")
klient := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
res, err := klient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
dane, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println("HTTP", res.StatusCode)
fmt.Println(string(dane))
}application/json[
{
"token_hash": "2a8052c39d6de83f4f808165c1f2a34edaaf0565c95045b11b528f7f747a69f3",
"token_type": "allee_personal_api_key",
"label": "false_positive"
}
]