homed: set "secrets" section to 'sensitive' in more places

We already do this in all placed where we it *really* matters, i.e. for
passwords PINs. But let's do this also at any place where we add the
section at all, regardless whether it is for storing a pw or something
else.

With this we establish the rule that if it's in "secrets", then it
shall be marked "sensitive".
This commit is contained in:
Lennart Poettering
2025-06-23 14:48:37 +02:00
parent fa34fda2eb
commit 5933eb1a71
4 changed files with 14 additions and 2 deletions
+2
View File
@@ -50,6 +50,8 @@ int identity_add_token_pin(sd_json_variant **v, const char *pin) {
if (r < 0)
return log_error_errno(r, "Failed to update PIN field: %m");
sd_json_variant_sensitive(w);
r = sd_json_variant_set_field(v, "secret", w);
if (r < 0)
return log_error_errno(r, "Failed to update secret object: %m");
+2
View File
@@ -94,6 +94,8 @@ static int add_secret(sd_json_variant **v, const char *password) {
if (r < 0)
return log_error_errno(r, "Failed to update password field: %m");
sd_json_variant_sensitive(w);
r = sd_json_variant_set_field(v, "secret", w);
if (r < 0)
return log_error_errno(r, "Failed to update secret object: %m");
+2
View File
@@ -1256,6 +1256,8 @@ static int home_start_work(
if (!sub)
return -ENOKEY;
sd_json_variant_sensitive(sub);
r = sd_json_variant_set_field(&v, "secret", sub);
if (r < 0)
return r;
+8 -2
View File
@@ -1022,8 +1022,11 @@ int user_record_set_fido2_user_presence_permitted(UserRecord *h, int b) {
if (sd_json_variant_is_blank_object(w))
r = sd_json_variant_filter(&h->json, STRV_MAKE("secret"));
else
else {
sd_json_variant_sensitive(w);
r = sd_json_variant_set_field(&h->json, "secret", w);
}
if (r < 0)
return r;
@@ -1050,8 +1053,11 @@ int user_record_set_fido2_user_verification_permitted(UserRecord *h, int b) {
if (sd_json_variant_is_blank_object(w))
r = sd_json_variant_filter(&h->json, STRV_MAKE("secret"));
else
else {
sd_json_variant_sensitive(w);
r = sd_json_variant_set_field(&h->json, "secret", w);
}
if (r < 0)
return r;