oidc_child: add new option return-tokens#8617
Conversation
|
Hi @eisenmann-b1 , can you check if this patch breaks any of your use-cases? Thanks. bye, |
There was a problem hiding this comment.
Code Review
This pull request introduces a --return-tokens command-line option to the OIDC child process, allowing token data to be returned conditionally. It also updates the IDP provider to pass this flag during PAM authentication. A review comment identified an issue in src/providers/idp/idp_auth.c where an incorrect debug level constant was used in a DEBUG macro.
660868f to
a67b116
Compare
@sumit-bose, @abbra, wouldn't it make sense to make |
a67b116 to
6cdc0ad
Compare
Hi, no, bye, |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a --return-tokens flag to the OIDC child process to control whether token data is returned in JSON format. A bug was identified in the SSS_CMD_RENEW case within src/providers/idp/idp_auth.c where the index c is not incremented after adding the new flag, causing it to be overwritten by the subsequent argument.
sssd-bot
left a comment
There was a problem hiding this comment.
Review done using Claude Code / claude-opus-4-6
Functional Issues
-
Missing
c++inSSS_CMD_RENEWcase —--return-tokensis silently droppedsrc/providers/idp/idp_auth.c:74: After storing"--return-tokens"inextra_args[c]at line 68 and null-checking it, the indexcis not incremented before assigning"--refresh-access-token"at line 74. This overwrites--return-tokenswith--refresh-access-token, so oidc_child never receives the--return-tokensflag during token renewal.As a result, oidc_child will output
\nuser_identifier(no JSON token data) buteval_access_token_buf()insrc/providers/idp/idp_auth_eval.c:255unconditionally callsjson_loadb()on the (empty) content before the first newline, producing the exact error seen in issue #8616:"Failed to parse token data on line [1]: [No error]."This breaks all automatic token refresh.The
SSS_PAM_AUTHENTICATEcase (lines 58–65) correctly hasc++;between the two assignments. TheSSS_CMD_RENEWcase needs the same fix:case SSS_CMD_RENEW: extra_args[c] = talloc_strdup(extra_args, "--return-tokens"); if (extra_args[c] == NULL) { DEBUG(SSSDBG_OP_FAILURE, "Failed to add option.\n"); ret = ENOMEM; goto done; } c++; /* <-- missing */ extra_args[c] = talloc_strdup(extra_args, "--refresh-access-token"); break;
Nits & Non-functional Issues
-
No resilience in
eval_access_token_buffor missing token datasrc/providers/idp/idp_auth_eval.c:248–260: When--return-tokensis not passed (or oidc_child is invoked outside the idp provider), the output format changes from{json}\nuser_identifierto\nuser_identifier. The function will attemptjson_loadb("", 0, ...)which fails with a confusing"No error"message. Consider either: (a) detectingtoken_buflen == 0and skipping token storage with a debug message, or (b) documenting thateval_access_token_bufrequires--return-tokensto have been passed. This would make debugging easier if a similar issue recurs. -
Test coverage: There are no unit or integration tests verifying the
--return-tokensflag behavior — both the conditional output in oidc_child and the correct argument construction inset_oidc_auth_extra_args. A test for theSSS_CMD_RENEWargument building would have caught thec++bug.
Confirmed Issues from Existing Review Comments
-
gemini-code-assist — missing
c++inSSS_CMD_RENEW: Confirmed. The index is not incremented after appending--return-tokens, causing--refresh-access-tokento overwrite it atsrc/providers/idp/idp_auth.c:74. This is a real bug that will break token refresh (see Functional Issue #1 above). -
gemini-code-assist — wrong debug level constant: This appears to have been fixed in a subsequent force-push. The current revision at
src/providers/idp/idp_auth.c:60andsrc/providers/idp/idp_auth.c:70both correctly useSSSDBG_OP_FAILURE.
|
@sumit-bose |
6cdc0ad to
fb84c3c
Compare
Hi, thank you for the fast feedback. Sorry about the bye, |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new --return-tokens command-line option to the oidc_child utility, allowing it to optionally output OIDC token data in JSON format. The idp_auth provider is updated to utilize this flag during authentication and renewal processes. Additionally, the output formatting of the user identifier in oidc_child has been adjusted. I have no feedback to provide.
|
Note: Covscan is clean. |
oidc_child should only return access and refresh tokens during authentication if the new option '--return-tokens' is given. Resolves: SSSD#8616 Reviewed-by: Alexey Tikhonov <atikhono@redhat.com> Reviewed-by: Pavel Březina <pbrezina@redhat.com>
fb84c3c to
45a6039
Compare
oidc_child should only return access and refresh tokens during authentication if the new option '--return-tokens' is given.
Resolves: #8616