Skip to content

pam/gdm/extension: Use upstream macros to cleanup the JSON request - #1751

Open
3v1n0 wants to merge 1 commit into
canonical:mainfrom
3v1n0:gdm-free-macros
Open

pam/gdm/extension: Use upstream macros to cleanup the JSON request#1751
3v1n0 wants to merge 1 commit into
canonical:mainfrom
3v1n0:gdm-free-macros

Conversation

@3v1n0

@3v1n0 3v1n0 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

This is what we were doing manually, as the APIs were not exposed.

Use the new upstream code for this

UDENG-11100

This is what we were doing manually, as the APIs were not exposed.

Use the new upstream code for this
@3v1n0
3v1n0 force-pushed the gdm-free-macros branch from 094e6c1 to 0913090 Compare July 23, 2026 12:59
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.04%. Comparing base (72e9eaf) to head (0913090).
⚠️ Report is 5 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@3v1n0 3v1n0 added jira Sync this issue with Jira and removed jira Sync this issue with Jira labels Jul 24, 2026
@3v1n0
3v1n0 requested a review from Copilot July 24, 2026 21:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (using explicit_bzero when available, with a fallback) for securely clearing sensitive buffers.
  • Add an upstream-style GDM_PAM_EXTENSION_CUSTOM_JSON_RESPONSE_FREE macro and a gdm_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); \
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants