pam/gdm/extension: Use upstream macros to cleanup the JSON request - #1751
Open
3v1n0 wants to merge 1 commit into
Open
pam/gdm/extension: Use upstream macros to cleanup the JSON request#17513v1n0 wants to merge 1 commit into
3v1n0 wants to merge 1 commit into
Conversation
This is what we were doing manually, as the APIs were not exposed. Use the new upstream code for this
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1751 +/- ##
==========================================
+ Coverage 88.01% 88.04% +0.02%
==========================================
Files 96 96
Lines 7016 7016
Branches 112 112
==========================================
+ Hits 6175 6177 +2
+ Misses 785 783 -2
Partials 56 56 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the GDM PAM CustomJSON extension integration to use newly available upstream-style helpers/macros for securely clearing and freeing JSON protocol messages, replacing the prior manual free() calls from the Go side.
Changes:
- Introduce a
gdm_pam_extension_zero_buffer()helper (usingexplicit_bzerowhen available, with a fallback) for securely clearing sensitive buffers. - Add an upstream-style
GDM_PAM_EXTENSION_CUSTOM_JSON_RESPONSE_FREEmacro and agdm_custom_json_request_free()wrapper to centralize cleanup. - Switch Go message cleanup to call the new C helper rather than manually freeing fields.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pam/internal/gdm/extensions/gdm-pam-extensions-common.h | Adds secure buffer-zeroing helper used by extension cleanup code. |
| pam/internal/gdm/extensions/gdm-custom-json-pam-extension.h | Adds macro to zero and free JSON response/message allocations. |
| pam/internal/gdm/extension.h | Adds a gdm_custom_json_request_free() wrapper exposing the new cleanup path to cgo. |
| pam/internal/gdm/extension.go | Switches Go-side finalizer to call the new C cleanup helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
29
to
32
| #include <stdint.h> | ||
| #include <string.h> | ||
| #include <strings.h> | ||
| #include <limits.h> |
Comment on lines
+67
to
+74
| #define GDM_PAM_EXTENSION_CUSTOM_JSON_RESPONSE_FREE(response) \ | ||
| { \ | ||
| if ((response)->json != NULL) { \ | ||
| gdm_pam_extension_zero_buffer ((response)->json, strlen ((response)->json)); \ | ||
| free ((response)->json); \ | ||
| } \ | ||
| free (response); \ | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is what we were doing manually, as the APIs were not exposed.
Use the new upstream code for this
UDENG-11100