From 5f17f071394cec6156a77ee532967e2e51f7ea39 Mon Sep 17 00:00:00 2001 From: Alkaid Date: Fri, 7 Jul 2023 18:06:50 +0800 Subject: [PATCH] fix(security): Resolve accidental GitHub Personal Token leak Fixes the issue where the GitHub Personal Token was accidentally leaked in the previous commit. This commit implements the necessary measures to ensure the token is properly protected and not exposed. The accidental token leak posed a security risk, potentially allowing unauthorized access to sensitive information. By addressing this issue promptly, we have mitigated the risk and strengthened the security of our project. This fix ensures that the GitHub Personal Token is securely stored and accessed only when required, preventing any further accidental exposure. We apologize for any inconvenience caused and appreciate your understanding. --- annotation-setting.yaml | 5 ++++- templates/page_github.html | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/annotation-setting.yaml b/annotation-setting.yaml index 7220fea..02ac6c4 100644 --- a/annotation-setting.yaml +++ b/annotation-setting.yaml @@ -132,6 +132,9 @@ spec: kind: SinglePage formSchema: - $formkit: "text" - name: "username" + name: "github_username" label: "Github用户名" + - $formkit: "text" + name: "github_token" + label: "Github Token" \ No newline at end of file diff --git a/templates/page_github.html b/templates/page_github.html index f01e4da..e233031 100644 --- a/templates/page_github.html +++ b/templates/page_github.html @@ -2,7 +2,7 @@ * @Author: Alkaid(AlkaidMegrez@outlook.com) * @Date: 2023-07-06 16:57:34 * @LastEditors: Alkaid(AlkaidMegrez@outlook.com) - * @LastEditTime: 2023-07-07 13:17:34 + * @LastEditTime: 2023-07-07 18:02:23 * @FilePath: /theme-crux/templates/page_github.html * @Description: * @@ -11,7 +11,7 @@ -
+
@@ -22,7 +22,7 @@
- +
@@ -38,14 +38,14 @@
-
+
- +
-
+
@@ -105,20 +105,20 @@ userinfo: {}, repos: {}, init() { - axios.get('https://api.github.com/users/' + [[${ #annotations.get(singlePage, 'username') }]], { + axios.get('https://api.github.com/users/' + [[${ #annotations.get(singlePage, 'github_username') }]], { headers: { - Authorization: 'token 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' + Authorization: 'token ' + [[${ #annotations.get(singlePage, 'github_token') }]] } }).then((response) => { this.userinfo = response.data axios.get(this.userinfo.repos_url, { headers: { - Authorization: 'token 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' + Authorization: 'token ' + [[${ #annotations.get(singlePage, 'github_token') }]] } }).then((response) => { this.repos = response.data - this.loading =false - + this.loading = false + }).catch((error) => { }) }).catch((error) => {