Bucket DELETE ignores ?force=1: aw-server-rust deletes without it (Python refuses with 401)

オープン 初心者向け
#883 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
api

調査の方向性

aw-server/src/endpoints/bucket.rs の bucket_delete から始めてください。このエンドポイントは force パラメータを受け取りません。Python 版 aw-server のガード(テストモードでない限り、または ?force=1 がない限り 401 を返す)と比較してください。両方のサーバーに対して curl での再現を実行し、差異を確認してください。テストモード以外で ?force=1 なしの DELETE が拒否されること、そして aw-webui と aw-client-js が force=1 を送信していることを確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

DELETE /api/0/buckets/<id> on aw-server-rust deletes the bucket and all its events without ?force=1. The Python aw-server refuses the same request outside testing mode, and the docs say force=1 is required (REST reference, "Delete").

This matters because clients rely on the guard. aw-client's delete_bucket(bucket_id, force=False) sends ?force=1 only when you pass force=True. On aw-server-rust, the default call is irreversible.

Repro (v0.14.3 linux release, normal mode, isolated XDG_* dirs):

aw-server-rust --port 5651 &   # and the bundled Python aw-server on 5652
for p in 5651 5652; do
  curl -s -o /dev/null -X POST -H Content-Type:application/json \
    -d '{"client":"t","type":"t","hostname":"h"}' http://127.0.0.1:$p/api/0/buckets/vb
  curl -s -w " <- DELETE without force: %{http_code}\n" -X DELETE http://127.0.0.1:$p/api/0/buckets/vb
  curl -s -o /dev/null -w "GET after: %{http_code}\n" http://127.0.0.1:$p/api/0/buckets/vb
done
 <- DELETE without force: 200          # aw-server-rust
GET after: 404                         # bucket and events are gone
{"message": "Deleting buckets is only permitted if aw-server is running in testing mode or if ?force=1"}
 <- DELETE without force: 401          # Python aw-server
GET after: 200

?force=0 also deletes on aw-server-rust. bucket_delete in aw-server/src/endpoints/bucket.rs takes no force parameter at all.

Expected: the same guard as Python: refuse without ?force=1 unless the server runs with --testing.

One compatibility point to check first: whether aw-webui and aw-client-js send force=1 when deleting a bucket from the UI. If they don't, they need the parameter in the same change.

Found during a docs-vs-reality pass of the REST API docs (ActivityWatch/docs#224).

主要言語
Rust
スター
322
フォーク
107
平均マージ
2日 16時間
マージ済み PR(30日)
25

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ActivityWatch/aw-server-rust のほかの issue

ActivityWatch/aw-server-rust の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。