Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Proxyアカウントをシステムアカウントにしてわかりやすくした #15026

Closed

Conversation

sakuhanight
Copy link
Contributor

What

  • ProxyAccountシステムアカウントとして作成するようにした
  • システムアカウントのプロフィールページにシステムアカウントであることを明示
  • ProxyAccountの編集用にadmin/update-proxy-accountエンドポイントを追加
  • ProxyAccountの設定画面でアバター、バナー、名前、概要を編集可能にした

Why

#14857

  • Proxyアカウントがシステムアカウント的立場でありながら、ログインすることが必要となっており、フォロワー限定投稿を見れてしまう問題があった。
  • Proxyアカウントを示すフラグはない(metaにはidが乗っているが、一般人は見ない)ため、成りすましが可能だった。

Additional info (optional)

Checklist

  • Read the contribution guide
  • Test working in a local environment
  • (If needed) Add story of storybook
  • (If needed) Update CHANGELOG.md
  • (If possible) Add tests

@github-actions github-actions bot added packages/frontend Client side specific issue/PR packages/backend Server side specific issue/PR packages/misskey-js labels Nov 22, 2024
Copy link

codecov bot commented Nov 22, 2024

Codecov Report

Attention: Patch coverage is 41.86047% with 25 lines in your changes missing coverage. Please review.

Project coverage is 21.24%. Comparing base (7c87dec) to head (030b99a).

Files with missing lines Patch % Lines
packages/frontend/src/pages/admin/settings.vue 0.00% 24 Missing ⚠️
packages/frontend/src/pages/admin-user.vue 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #15026       +/-   ##
============================================
- Coverage    40.86%   21.24%   -19.62%     
============================================
  Files         1609      774      -835     
  Lines       161806    74353    -87453     
  Branches      3786     1375     -2411     
============================================
- Hits         66119    15797    -50322     
+ Misses       95239    58127    -37112     
+ Partials       448      429       -19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Nov 22, 2024

このPRによるapi.jsonの差分

差分はこちら
--- base
+++ head
@@ -17838,6 +17838,194 @@
         }
       }
     },
+    "/admin/update-proxy-account": {
+      "post": {
+        "operationId": "post___admin___update-proxy-account",
+        "summary": "admin/update-proxy-account",
+        "description": "No description provided.\n\n**Credential required**: *Yes* / **Permission**: *write:admin:update-proxy-account*",
+        "externalDocs": {
+          "description": "Source code",
+          "url": "https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/api/endpoints/admin/update-proxy-account.ts"
+        },
+        "tags": [
+          "admin"
+        ],
+        "security": [
+          {
+            "bearerAuth": []
+          }
+        ],
+        "requestBody": {
+          "required": true,
+          "content": {
+            "application/json": {
+              "schema": {
+                "type": "object",
+                "properties": {
+                  "name": {
+                    "type": [
+                      "string",
+                      "null"
+                    ],
+                    "minLength": 1,
+                    "maxLength": 50
+                  },
+                  "description": {
+                    "type": [
+                      "string",
+                      "null"
+                    ],
+                    "minLength": 1,
+                    "maxLength": 1500
+                  },
+                  "avatarId": {
+                    "type": [
+                      "string",
+                      "null"
+                    ],
+                    "format": "misskey:id"
+                  },
+                  "bannerId": {
+                    "type": [
+                      "string",
+                      "null"
+                    ],
+                    "format": "misskey:id"
+                  }
+                }
+              }
+            }
+          }
+        },
+        "responses": {
+          "200": {
+            "description": "OK (with results)",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "object",
+                  "$ref": "#/components/schemas/UserDetailed"
+                }
+              }
+            }
+          },
+          "400": {
+            "description": "Client error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "ACCESS_DENIED": {
+                    "value": {
+                      "error": {
+                        "message": "Only administrators can edit members of the role.",
+                        "code": "ACCESS_DENIED",
+                        "id": "101f9105-27cb-489c-842a-69b6d2092c03"
+                      }
+                    }
+                  },
+                  "INVALID_PARAM": {
+                    "value": {
+                      "error": {
+                        "message": "Invalid param.",
+                        "code": "INVALID_PARAM",
+                        "id": "3d81ceae-475f-4600-b2a8-2bc116157532"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "401": {
+            "description": "Authentication error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "CREDENTIAL_REQUIRED": {
+                    "value": {
+                      "error": {
+                        "message": "Credential required.",
+                        "code": "CREDENTIAL_REQUIRED",
+                        "id": "1384574d-a912-4b81-8601-c7b1c4085df1"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "403": {
+            "description": "Forbidden error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "AUTHENTICATION_FAILED": {
+                    "value": {
+                      "error": {
+                        "message": "Authentication failed. Please ensure your token is correct.",
+                        "code": "AUTHENTICATION_FAILED",
+                        "id": "b0a7f5f8-dc2f-4171-b91f-de88ad238e14"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "418": {
+            "description": "I'm Ai",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "I_AM_AI": {
+                    "value": {
+                      "error": {
+                        "message": "You sent a request to Ai-chan, Misskey's showgirl, instead of the server.",
+                        "code": "I_AM_AI",
+                        "id": "60c46cd1-f23a-46b1-bebe-5d2b73951a84"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          },
+          "500": {
+            "description": "Internal server error",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/Error"
+                },
+                "examples": {
+                  "INTERNAL_ERROR": {
+                    "value": {
+                      "error": {
+                        "message": "Internal error occurred. Please contact us if the error persists.",
+                        "code": "INTERNAL_ERROR",
+                        "id": "5d37dbcb-891e-41ca-a3d6-e690c97775ac"
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    },
     "/admin/update-user-note": {
       "post": {
         "operationId": "post___admin___update-user-note",

Get diff files from Workflow Page

@tai-cha
Copy link
Contributor

tai-cha commented Dec 15, 2024

現時点でプロキシアカウントが存在する場合にそのフォロー情報を引き継がないからきちんと移行できなさそう(コード斜め読みのため間違っていたらすみません)

@sakuhanight
Copy link
Contributor Author

現時点でプロキシアカウントが存在する場合にそのフォロー情報を引き継がないからきちんと移行できなさそう(コード斜め読みのため間違っていたらすみません)

現時点のプロキシアカウントを削除するわけではないから動くと思っていましたが、有識者のコメントを求めたいです。

@Sayamame-beans
Copy link
Member

システムアカウントとしてProxyが生えたなら、これまで生やしていたProxyアカウントを残す理由はないようにも感じられるので、そこでフォロー情報が引き継がれていないと事故に繋がりそうではあるかもしれません。

@Sayamame-beans
Copy link
Member

システムアカウントになった後も、既存のProxyアカウント同様、リモートの相手はProxyからのフォローを却下可能という理解であっていますか…?

@sakuhanight
Copy link
Contributor Author

システムアカウントはユーザー名の規則しか違わない認識なので、現在と変わらずフォロー却下できるはずです。

@syuilo
Copy link
Member

syuilo commented Feb 21, 2025

設定開こうとすると Cannot read properties of null (reading 'name') になりますね
image

@syuilo
Copy link
Member

syuilo commented Feb 21, 2025

アカウントの名前はサーバー名に、アイコンはサーバーアイコンで固定にしてアカウントのdescriptionだけ編集可能にしても良いかもしれないです

@syuilo
Copy link
Member

syuilo commented Feb 21, 2025

実装のシンプルさ優先してとりあえず↑にします

@syuilo syuilo self-assigned this Feb 21, 2025
@syuilo
Copy link
Member

syuilo commented Feb 21, 2025

実装内容がかなり変わってくるので別でPR作ることにします 🙏🏻

@syuilo syuilo closed this Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages/backend Server side specific issue/PR packages/frontend Client side specific issue/PR packages/misskey-js
Projects
4 participants