Inconsistencies in displaying bucket and file metadata

未关闭
#728 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
22/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
cli, cloud

调研方向

Start by comparing the JSON output of b2 ls --json and b2 get-file-info, then b2 list-buckets --json, b2 get-bucket and b2 update-bucket, to see where fileRetention, legalHold and defaultServerSideEncryption diverge. The issue says b2 ls --json builds FileVersionInfo objects before serialising, so check that conversion. Done would mean one agreed output shape for each field, which needs a maintainer decision on the proposed "mode": "unknown" value first.

由索引模型根据 Issue 内容生成。

描述

As of now there are several inconsistencies when it comes to displaying:

  • bucket default encyrption
  • file retention

in

  • b2 ls --json and b2 get-file-info
  • b2 list-buckets --json, b2 get-bucket and b2 update-bucket

The inconsistencies are:

  1. FILE INCONSISTENCIES
  • b2 get-file-info displays raw data from server, therefore fileRetention and legalHold contain authorization data, and are of the form:
    "fileRetention": {
        "isClientAuthorizedToRead": true,
        "value": {
            "mode": null,
            "retainUntilTimestamp": null
        }
    },
    "legalHold": {
        "isClientAuthorizedToRead": true,
        "value": null
    }

or

    "fileRetention": {
        "isClientAuthorizedToRead": false,
        "value": null
    },
    "legalHold": {
        "isClientAuthorizedToRead": false,
        "value": null
    }
  • b2 ls --json displays data by converting it to FileVersionInfo objects and then serialising it to dicts, therefore fileRetention and legalHold do not explicitly contain isClientAuthorizedToRead. Instead, information about permission to read can be inferred from the displayed value.

For an application key authorized to read these attributes the output looks like:

        "fileRetention": {
            "mode": null,
            "retainUntilTimestamp": null
        },
        "legalHold": "off"

and for an unauthorized one like:

        "fileRetention": {
            "mode": "unknown",
            "retainUntilTimestamp": null
        },
        "legalHold": "unknown",
  1. BUCKET INCONSISTENCIES

A very similar inconsistency is visible in b2 get-bucket and b2 update-bucket. The latter one returns raw data as received from server (with isClientAuthorizedToRead).

  1. BUCKET AMBIGUITY
    displaying default bucket encryption can be vague depending on key capabilities.

For a key that does not have the permissions to read bucket default encryption the output looks like:

    "defaultServerSideEncryption": {
        "mode": null
    }

And for a bucket with no default encryption and a key with reading capabilities it looks like:

        "defaultServerSideEncryption": {
            "mode": "none"
        },

The difference is hard to spot, but it's there.

I suggest treating these inconsistencies as bugs and fix them without releasing a major version of the CLI. The solutions I suggest:

  1. use the b2 ls --json format everywhere
  2. use the b2 get-bucket and b2 list-buckets --json format everywhere
    3.. introduce a possible value of "mode": "unknown" and for buckets with no default encryption use "mode": null.
主要语言
Python
星标
638
派生
138
平均合并
8 小时 27 分钟
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Backblaze/B2_Command_Line_Tool 的其他 Issue

查看 Backblaze/B2_Command_Line_Tool 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。