-
Notifications
You must be signed in to change notification settings - Fork 1.8k
out_azure_logs_ingestion: implement Managed Identity support #10867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
set(src | ||
azure_logs_ingestion.c | ||
azure_logs_ingestion_conf.c | ||
azure_logs_ingestion_msiauth.c | ||
) | ||
|
||
FLB_PLUGIN(out_azure_logs_ingestion "${src}" "") |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -25,6 +25,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include "azure_logs_ingestion.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include "azure_logs_ingestion_conf.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include "azure_logs_ingestion_msiauth.h" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
struct flb_az_li* flb_az_li_ctx_create(struct flb_output_instance *ins, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
struct flb_config *config) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -54,21 +55,34 @@ struct flb_az_li* flb_az_li_ctx_create(struct flb_output_instance *ins, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* config: 'client_id' */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->client_id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_plg_error(ins, "property 'client_id' is not defined"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* config: 'tenant_id' */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->tenant_id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_plg_error(ins, "property 'tenant_id' is not defined"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* config: 'client_secret' */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->client_secret) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_plg_error(ins, "property 'client_secret' is not defined"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* Auth method validation and setup */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (strcasecmp(ctx->auth_type_str, "service_principal") == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->auth_type = FLB_AZ_LI_AUTH_SERVICE_PRINCIPAL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* Verify required parameters for Service Principal auth */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->tenant_id || !ctx->client_id || !ctx->client_secret) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_plg_error(ins, "When using service_principal auth, tenant_id, client_id, and client_secret are required"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else if (strcasecmp(ctx->auth_type_str, "managed_identity") == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* Check if client_id indicates system-assigned or user-assigned managed identity */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->client_id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_plg_error(ins, "When using managed_identity auth, client_id must be set to 'system' for system-assigned or the managed identity client ID"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (strcasecmp(ctx->client_id, "system") == 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->auth_type = FLB_AZ_LI_AUTH_MANAGED_IDENTITY_SYSTEM; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->auth_type = FLB_AZ_LI_AUTH_MANAGED_IDENTITY_USER; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_plg_error(ins, "Invalid auth_type '%s'. Valid options are: 'service_principal' or 'managed_identity'", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->auth_type_str); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -91,16 +105,43 @@ struct flb_az_li* flb_az_li_ctx_create(struct flb_output_instance *ins, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* Allocate and set auth url */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->auth_url = flb_sds_create_size(sizeof(FLB_AZ_LI_AUTH_URL_TMPLT) - 1 + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_sds_len(ctx->tenant_id)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->auth_url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_errno(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* Allocate and set auth url based on authentication method */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (ctx->auth_type == FLB_AZ_LI_AUTH_MANAGED_IDENTITY_SYSTEM) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* System-assigned managed identity */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->auth_url = flb_sds_create_size(sizeof(FLB_AZ_LI_MSIAUTH_URL_TEMPLATE) - 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->auth_url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_errno(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FLB_AZ_LI_MSIAUTH_URL_TEMPLATE, "", ""); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+108
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Check flb_sds_snprintf return; bail out on failure Pre-sizing is fine, but flb_sds_snprintf can fail (returns -1). Handle it to avoid using an uninitialized URL. - flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url),
- FLB_AZ_LI_MSIAUTH_URL_TEMPLATE, "", "");
+ ret = flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url),
+ FLB_AZ_LI_MSIAUTH_URL_TEMPLATE, "", "");
+ if (ret < 0) {
+ flb_plg_error(ins, "failed composing MSI auth_url (system-assigned)");
+ flb_az_li_ctx_destroy(ctx);
+ return NULL;
+ } 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else if (ctx->auth_type == FLB_AZ_LI_AUTH_MANAGED_IDENTITY_USER) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* User-assigned managed identity */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->auth_url = flb_sds_create_size(sizeof(FLB_AZ_LI_MSIAUTH_URL_TEMPLATE) - 1 + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
sizeof("&client_id=") - 1 + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_sds_len(ctx->client_id)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->auth_url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_errno(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FLB_AZ_LI_MSIAUTH_URL_TEMPLATE, "&client_id=", ctx->client_id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+120
to
+132
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainValidate/encode client_id for user-assigned MSI and check snprintf return
- flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url),
- FLB_AZ_LI_MSIAUTH_URL_TEMPLATE, "&client_id=", ctx->client_id);
+ ret = flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url),
+ FLB_AZ_LI_MSIAUTH_URL_TEMPLATE, "&client_id=", ctx->client_id);
+ if (ret < 0) {
+ flb_plg_error(ins, "failed composing MSI auth_url (user-assigned)");
+ flb_az_li_ctx_destroy(ctx);
+ return NULL;
+ } If client_id is not guaranteed to be a bare GUID, confirm and we can add a URL-encode step before formatting it into the URL. 🏁 Script executed: #!/bin/bash
# Search for MSI auth URL template definition
echo "== FLB_AZ_LI_MSIAUTH_URL_TEMPLATE definition =="
rg -n "FLB_AZ_LI_MSIAUTH_URL_TEMPLATE" -C3 plugins/out_azure_logs_ingestion
echo ""
# Locate client_id declaration, assignment, and config mapping
echo "== client_id occurrences in azure_logs_ingestion_conf.c =="
rg -n "client_id" -C5 plugins/out_azure_logs_ingestion/azure_logs_ingestion_conf.c
echo ""
# Inspect flb_sds_snprintf signature to confirm its return semantics
echo "== flb_sds_snprintf signature and context =="
rg -n "flb_sds_snprintf" -C3 . Length of output: 36494 Check snprintf return and validate/URL-encode client_id
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* Service principal authentication */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->auth_url = flb_sds_create_size(sizeof(FLB_AZ_LI_AUTH_URL_TMPLT) - 1 + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_sds_len(ctx->tenant_id)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!ctx->auth_url) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_errno(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_az_li_ctx_destroy(ctx); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return NULL; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FLB_AZ_LI_AUTH_URL_TMPLT, ctx->tenant_id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+133
to
144
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Also check snprintf return for service principal auth_url Same robustness as MSI paths. - flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url),
- FLB_AZ_LI_AUTH_URL_TMPLT, ctx->tenant_id);
+ ret = flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url),
+ FLB_AZ_LI_AUTH_URL_TMPLT, ctx->tenant_id);
+ if (ret < 0) {
+ flb_plg_error(ins, "failed composing SP auth_url");
+ flb_az_li_ctx_destroy(ctx);
+ return NULL;
+ } 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
flb_sds_snprintf(&ctx->auth_url, flb_sds_alloc(ctx->auth_url), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FLB_AZ_LI_AUTH_URL_TMPLT, ctx->tenant_id); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/* Allocate and set dce full url */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ctx->dce_u_url = flb_sds_create_size(sizeof(FLB_AZ_LI_DCE_URL_TMPLT) - 1 + | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
|
||
/* Fluent Bit | ||
* ========== | ||
* Copyright (C) 2015-2024 The Fluent Bit Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <fluent-bit/flb_info.h> | ||
#include <fluent-bit/flb_mem.h> | ||
#include <fluent-bit/flb_log.h> | ||
#include <fluent-bit/flb_utils.h> | ||
#include <fluent-bit/flb_oauth2.h> | ||
#include <fluent-bit/flb_upstream.h> | ||
#include <fluent-bit/flb_http_client.h> | ||
|
||
#include "azure_logs_ingestion_msiauth.h" | ||
|
||
char *flb_azure_li_msiauth_token_get(struct flb_oauth2 *ctx) | ||
{ | ||
int ret; | ||
size_t b_sent; | ||
time_t now; | ||
struct flb_connection *u_conn; | ||
struct flb_http_client *c; | ||
|
||
now = time(NULL); | ||
if (ctx->access_token) { | ||
/* validate unexpired token */ | ||
if (ctx->expires > now && flb_sds_len(ctx->access_token) > 0) { | ||
return ctx->access_token; | ||
} | ||
} | ||
|
||
/* Get Token and store it in the context */ | ||
u_conn = flb_upstream_conn_get(ctx->u); | ||
if (!u_conn) { | ||
flb_error("[azure li msi auth] could not get an upstream connection to %s:%i", | ||
ctx->u->tcp_host, ctx->u->tcp_port); | ||
return NULL; | ||
} | ||
|
||
/* Create HTTP client context */ | ||
c = flb_http_client(u_conn, FLB_HTTP_GET, ctx->uri, | ||
NULL, 0, | ||
ctx->host, atoi(ctx->port), | ||
NULL, 0); | ||
if (!c) { | ||
flb_error("[azure li msi auth] error creating HTTP client context"); | ||
flb_upstream_conn_release(u_conn); | ||
return NULL; | ||
} | ||
|
||
/* Append HTTP Header */ | ||
flb_http_add_header(c, "Metadata", 8, "true", 4); | ||
|
||
/* Issue request */ | ||
ret = flb_http_do(c, &b_sent); | ||
if (ret != 0) { | ||
flb_warn("[azure li msi auth] cannot issue request, http_do=%i", ret); | ||
} | ||
else { | ||
flb_info("[azure li msi auth] HTTP Status=%i", c->resp.status); | ||
if (c->resp.payload_size > 0 && c->resp.status != 200) { | ||
flb_info("[azure li msi auth] payload:\n%s", c->resp.payload); | ||
} | ||
} | ||
|
||
/* Extract token */ | ||
if (c->resp.payload_size > 0 && c->resp.status == 200) { | ||
ret = flb_oauth2_parse_json_response(c->resp.payload, | ||
c->resp.payload_size, ctx); | ||
if (ret == 0) { | ||
flb_info("[azure li msi auth] access token from '%s:%s' retrieved", | ||
ctx->host, ctx->port); | ||
flb_http_client_destroy(c); | ||
flb_upstream_conn_release(u_conn); | ||
ctx->issued = time(NULL); | ||
ctx->expires = ctx->issued + ctx->expires_in; | ||
return ctx->access_token; | ||
} | ||
} | ||
|
||
flb_http_client_destroy(c); | ||
flb_upstream_conn_release(u_conn); | ||
|
||
return NULL; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | ||
|
||
/* Fluent Bit | ||
* ========== | ||
* Copyright (C) 2015-2024 The Fluent Bit Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <fluent-bit/flb_info.h> | ||
|
||
/* MSI authorization URL template */ | ||
#define FLB_AZ_LI_MSIAUTH_URL_TEMPLATE \ | ||
"http://169.254.169.254/metadata/identity/oauth2/token?api-version=2021-02-01%s%s&resource=https://monitor.azure.com" | ||
|
||
char *flb_azure_li_msiauth_token_get(struct flb_oauth2 *ctx); | ||
int flb_azure_kusto_conf_destroy(struct flb_az_li *ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Defensive default for auth_type_str and avoid stale ins->context on early returns
Apply this minimal guard:
Outside this hunk, move the context assignment to the end (right before returning ctx) instead of early:
🤖 Prompt for AI Agents