Pryaxis / TShock

☕️⚡️TShock provides Terraria servers with server-side characters, anti-cheat, and community management tools.
GNU General Public License v3.0
2.41k stars 377 forks source link

RestApi执行命令接口非superadmin组token提示无权限 #2859

Closed IamRuaRua closed 1 year ago

IamRuaRua commented 1 year ago

根据https://tshock.readme.io/reference/rest-api-endpoints#description 提供的方法 我在config.json添加一个非superadmin组的token 使用此token请求/v3/server/rawcmd执行任何命令都,接口都返回 { "status": "403", "error": "Not authorized. User \"default\" has no access to use the specified API endpoint." } 请求:不同用户组的token请求/v3/server/rawcmd接口 可以像游戏里面执行命令一样,不同组可以执行不同命令,返回不同结果

sgkoishi commented 1 year ago

As the error message, you need permission for rawcmd: https://github.com/Pryaxis/TShock/blob/4e59087e7c826bb9f327d1d08ded2d70f72e8af8/TShockAPI/Rest/RestPermissions.cs#L91-L92