Skip to content

Commit efee944

Browse files
IDP: avoid logging value of 'idp_client_secret'
Note that 'ldap_default_authtok' doesn't require special handling because it is of DP_OPT_BLOB type and isn't logged.
1 parent 645ab1f commit efee944

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/confdb/confdb.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@
264264
#define CONFDB_PROXY_FAST_ALIAS "proxy_fast_alias"
265265
#define CONFDB_PROXY_MAX_CHILDREN "proxy_max_children"
266266

267+
/* IdP Provider */
268+
#define CONFDB_IDP_CLIENT_SECRET "idp_client_secret"
269+
267270
/* KCM Service */
268271
#define CONFDB_KCM_CONF_ENTRY "config/kcm"
269272
#define CONFDB_KCM_SOCKET "socket_path"

src/providers/data_provider_opts.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ int dp_get_options(TALLOC_CTX *memctx,
123123
if (ret == EOK) ret = EINVAL;
124124
goto done;
125125
}
126+
127+
if (strcmp(opts[i].opt_name, CONFDB_IDP_CLIENT_SECRET) == 0) {
128+
/* avoid logging value of sensitive option */
129+
DEBUG(SSSDBG_CONF_SETTINGS,
130+
"Option "CONFDB_IDP_CLIENT_SECRET" is%s set\n",
131+
opts[i].val.cstring ? "" : " not");
132+
break;
133+
}
134+
126135
DEBUG(SSSDBG_CONF_SETTINGS, "Option %s has%s value %s\n",
127136
opts[i].opt_name,
128137
opts[i].val.cstring ? "" : " no",

src/providers/idp/idp_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ errno_t sssm_idp_init(TALLOC_CTX *mem_ctx,
111111
IDP_CLIENT_SECRET);
112112
if (init_ctx->client_secret == NULL) {
113113
DEBUG(SSSDBG_CRIT_FAILURE,
114-
"Missing required option 'idp_client_secret'.\n");
114+
"Missing required option '"CONFDB_IDP_CLIENT_SECRET"'.\n");
115115
ret = EINVAL;
116116
goto done;
117117
}

src/providers/idp/idp_opts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct dp_option default_idp_opts[] = {
2828
{ "idp_request_timeout", DP_OPT_NUMBER, { .number = 10 }, NULL_NUMBER },
2929
{ "idp_type", DP_OPT_STRING, NULL_STRING, NULL_STRING },
3030
{ "idp_client_id", DP_OPT_STRING, NULL_STRING, NULL_STRING },
31-
{ "idp_client_secret", DP_OPT_STRING, NULL_STRING, NULL_STRING },
31+
{ CONFDB_IDP_CLIENT_SECRET, DP_OPT_STRING, NULL_STRING, NULL_STRING },
3232
{ "idp_token_endpoint", DP_OPT_STRING, NULL_STRING, NULL_STRING },
3333
{ "idp_device_auth_endpoint", DP_OPT_STRING, NULL_STRING, NULL_STRING },
3434
{ "idp_userinfo_endpoint", DP_OPT_STRING, NULL_STRING, NULL_STRING },

0 commit comments

Comments
 (0)