occ config:app:set --value ignores --no-sensitive (and drops --sensitive for boolean values)

Đang mở Phù hợp với người mới
#67,531 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
75/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
backend, cli

Hướng nghiên cứu

Bắt đầu với core/Command/Config/App/SetConfig.php và theo dõi cách xử lý --value cho từng kiểu được hỗ trợ, sau đó đọc lib/private/AppConfig.php và các trường hợp hiện có trong tests/Core/Command/Config/App/SetConfigTest.php. Bổ sung kiểm thử cho việc xóa tính nhạy cảm sau khi xác nhận và cho các giá trị boolean khi dùng --sensitive. Hoàn thành khi cả hai hành vi đều được kiểm thử và bài kiểm thử tập trung chạy thành công.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug feature: occ
Bug description

occ config:app:set <app> <key> --value=… --no-sensitive asks for confirmation to change the sensitive flag, but the flag is never cleared:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/core/Command/Config/App/SetConfig.php#L177-L189

The resulting $sensitive = false is passed to setValueString()/setValueInt()/…, but AppConfig::setTypedValue() keeps an existing sensitive flag (it only ever switches sensitivity from false to true):

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/lib/private/AppConfig.php#L872-L874
https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/lib/private/AppConfig.php#L951-L953

Only the branch without --value calls updateSensitive(). In addition, the boolean case does not pass $sensitive at all, so --sensitive is silently ignored for --type=boolean:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/core/Command/Config/App/SetConfig.php#L213-L214

Steps to reproduce

Found by code reading.

  1. occ config:app:set myapp mykey --value=foo --sensitive
  2. occ config:app:set myapp mykey --value=bar --no-sensitive and confirm the question
  3. occ config:app:get myapp mykey --details still shows the key as sensitive.
Expected behavior

When the admin confirms the change, --no-sensitive clears the flag (e.g. by calling updateSensitive() after setting the value, like the branch without --value does), and --sensitive is honoured for boolean values too. A test in tests/Core/Command/Config/App/SetConfigTest.php should cover both. (The wrong "Config value was not updated" output for type-only changes is tracked separately in #60065.)

Nextcloud version

master

Ngôn ngữ chính
PHP
Star
37.6k
Fork
5.4k
Merge trung bình
1 ngày 20 giờ
Pull request đã merge (30 ngày)
605

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nextcloud/server

Tất cả issue của nextcloud/server

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.