Ptt-official-app / Ptt-backend

PTT APP 的後端
BSD 3-Clause "New" or "Revised" License
208 stars 68 forks source link

[BUG] 在沒有登入時不應該取得看板設定 #238

Closed PichuChen closed 3 years ago

PichuChen commented 3 years ago

發生了什麼事? / The Problem

在沒有 Access Token 的前提下, GET /v1/boards/SYSOP/information 不應該看到看板資訊,要回傳 Error

如何重現 / To Reproduce

  1. 呼叫 curl 'http://localhost:8081/v1/boards/SYSOP/information'
  2. 然後就看到了

預期的行為 / Expected behavior

應該要出現沒有權限錯誤

螢幕截圖 / Screenshots

截圖 2021-06-26 下午3 55 27

開發環境 / Environment

OS: macOS 11.4 測試集:bbs_backup_1624243644.tar.xz Golang Version: go version go1.16.2 darwin/amd64

請參見 PTTAPP go-BBS 後端測試表 2021060401 C3-2-2

whitefloor commented 3 years ago

我發現 v1/boards/{{board_id}}/information v1/boards/{{board_id}}/settings 這兩隻api在CheckPermission裡都用PermissionReadBoardInformation裡的方法做權限檢查

截圖 2021-06-27 下午6 00 53

243 有實作檢查,會一起用到同一個方法。

這樣需要在實作新的檢查方法嗎?

whitefloor commented 3 years ago

附上測試結果

截圖 2021-06-29 下午11 05 59

這是我目前的執行結果,沒有token會回傳401 在 #243 實作權限檢查的時候一起被修正了

y2468101216 commented 3 years ago

close issue 因為我修過了

PichuChen commented 3 years ago

@y2468101216 要Close 之前請確認問題有被修復。

目前截圖看起來他什麼都沒有回應

截圖 2021-07-15 下午3 34 48

測試的 commid-id 是 7866d2c0c7fdb7a1af8df54317b86fe70b4d5b83