@cryptotaxi247 / netdata-1 / commits / 785cf3c7a

Small fixes (#20209)

* do not log null bearer token * do not log as errors empty weights responses

Costa Tsaousis committed Apr 30, 2025 at 13:53 UTC 785cf3c7a7fb68c9ebee764ed5ff6d4529e3afe9
2 files changed +10 -1
src/web/api/http_auth.c
+4
@@ -302,6 +302,10 @@ static void bearer_tokens_load_from_disk(void) {
302 bool web_client_bearer_token_auth(struct web_client *w, const char *v) {
303 bool rc = false;
304
305 + // javascript may send "null" or "undefined"
306 + if(!v || !*v || strcmp(v, "null") == 0 || strcmp(v, "undefined") == 0)
307 + return rc;
308 +
309 if(!uuid_parse_flexi(v, w->auth.bearer_token)) {
310 char uuid_str[UUID_COMPACT_STR_LEN];
311 uuid_unparse_lower_compact(w->auth.bearer_token, uuid_str);
src/web/api/queries/weights.c
+6 -1
@@ -1298,9 +1298,14 @@ NETDATA_DOUBLE *rrd2rrdr_ks2(
1298 for(size_t tr = 0; tr < nd_profile.storage_tiers; tr++)
1299 stats->db_points_per_tier[tr] += r->internal.qt->db.tiers[tr].points;
1300
1301 + if(!r->d || !r->internal.qt->query.used) {
1302 + // the result is empty - no data to query for this metric
1303 + goto cleanup;
1304 + }
1305 +
1306 if(r->d != 1 || r->internal.qt->query.used != 1) {
1307 netdata_log_error("WEIGHTS: on query '%s' expected 1 dimension in RRDR but got %zu r->d and %zu qt->query.used",
1303 - r->internal.qt->id, r->d, (size_t)r->internal.qt->query.used);
1308 + r->internal.qt->id, r->d, (size_t)r->internal.qt->query.used);
1309 goto cleanup;
1310 }
1311