From c22b149921c7f5e93a520429edc818c88a044d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 20 Sep 2024 11:57:59 +0200 Subject: [PATCH 01/17] FIX validation data for oriondb consistency script --- scripts/oriondb_consistency/validation_data.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/scripts/oriondb_consistency/validation_data.js b/scripts/oriondb_consistency/validation_data.js index 0d1e929d44..8e47318947 100644 --- a/scripts/oriondb_consistency/validation_data.js +++ b/scripts/oriondb_consistency/validation_data.js @@ -4454,23 +4454,15 @@ db.getSiblingDB("orion-validation").entities.insertMany([ db.getSiblingDB("orion-validation").csubs.insertMany([ { - "expiration": { - "$numberLong": "9223372036854775807" - }, + "expiration": 9223372036854775807, "reference": "http://notify-receptor:5055/notify", "custom": true, - "timeout": { - "$numberLong": "0" - }, + "timeout": 0, "headers": { "fiware-servicepath": "/SS1" }, - "throttling": { - "$numberLong": "0" - }, - "maxFailsLimit": { - "$numberLong": "-1" - }, + "throttling": 0, + "maxFailsLimit": -1, "servicePath": "/SS2", "status": "active", "statusLastChange": 1682640509.6958137, From 7dfcdda2a27405de20e4ae0c7c2451914fa73e2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Fri, 20 Sep 2024 12:03:06 +0200 Subject: [PATCH 02/17] FIX validation data js --- scripts/oriondb_consistency/validation_data.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/oriondb_consistency/validation_data.js b/scripts/oriondb_consistency/validation_data.js index 8e47318947..954eef6178 100644 --- a/scripts/oriondb_consistency/validation_data.js +++ b/scripts/oriondb_consistency/validation_data.js @@ -4454,15 +4454,15 @@ db.getSiblingDB("orion-validation").entities.insertMany([ db.getSiblingDB("orion-validation").csubs.insertMany([ { - "expiration": 9223372036854775807, + "expiration": NumberLong("9223372036854775807"), "reference": "http://notify-receptor:5055/notify", "custom": true, - "timeout": 0, + "timeout": NumberLong("0"), "headers": { "fiware-servicepath": "/SS1" }, - "throttling": 0, - "maxFailsLimit": -1, + "throttling": NumberLong("0"), + "maxFailsLimit": NumberLong("-1"), "servicePath": "/SS2", "status": "active", "statusLastChange": 1682640509.6958137, From 9e6f270c485fa57c170d0408cb2e63cb827fe93d Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Tue, 8 Oct 2024 11:44:57 +0530 Subject: [PATCH 03/17] corrected the typo in globals.cpp file --- CHANGES_NEXT_RELEASE | 1 + src/lib/common/globals.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29bb2..9a712bdc33 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- Fix: typo in globals.cpp file (#4621) diff --git a/src/lib/common/globals.cpp b/src/lib/common/globals.cpp index ec8be53148..9a3211940f 100644 --- a/src/lib/common/globals.cpp +++ b/src/lib/common/globals.cpp @@ -670,7 +670,7 @@ double parse8601Time(const std::string& ss) const int minMonth = 0; const int maxMonth = 11; const int minDay = 1; - const int maxDay = daysInMonth(y, time.tm_mon);; + const int maxDay = daysInMonth(y, time.tm_mon); const int minHour = 0; const int maxHour = 23; const int minMinute = 0; From 47d2c785ae75721f69c2aebf16051ebbc40d830a Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Tue, 8 Oct 2024 15:33:26 +0530 Subject: [PATCH 04/17] updated as per comment --- CHANGES_NEXT_RELEASE | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 9a712bdc33..e69de29bb2 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +0,0 @@ -- Fix: typo in globals.cpp file (#4621) From d6c4d4c4378d5e01234c7d18b5aeac37813afa57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Tue, 8 Oct 2024 18:34:58 +0200 Subject: [PATCH 05/17] FIX improve attribute and metadata invalid format dates for DateTime types in logs --- CHANGES_NEXT_RELEASE | 1 + src/lib/jsonParseV2/parseContextAttribute.cpp | 24 +-- src/lib/jsonParseV2/parseMetadata.cpp | 4 +- .../basic_dates_support.test | 8 +- .../basic_dates_support_for_iso8601.test | 8 +- ...te_transient_entity_with_invalid_date.test | 4 +- .../null_in_datetime_attr.test | 8 +- .../null_in_datetime_md.test | 8 +- ...atetime_with_min_max_operators_errors.test | 16 +- .../improve_log_invalid_date.test | 149 ++++++++++++++++++ 10 files changed, 193 insertions(+), 37 deletions(-) create mode 100644 test/functionalTest/cases/4616_improve_log_invalid_date/improve_log_invalid_date.test diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29bb2..b5b80eeb36 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- Fix: improve attribute and metadata invalid format dates for DateTime types in logs (#4616) diff --git a/src/lib/jsonParseV2/parseContextAttribute.cpp b/src/lib/jsonParseV2/parseContextAttribute.cpp index 4d4ab692a5..4757a156e1 100644 --- a/src/lib/jsonParseV2/parseContextAttribute.cpp +++ b/src/lib/jsonParseV2/parseContextAttribute.cpp @@ -106,7 +106,8 @@ static std::string parseContextAttributeObject const rapidjson::Value& start, ContextAttribute* caP, bool* compoundVector, - bool checkAttrSpecialTypes + bool checkAttrSpecialTypes, + std::string* extraForLog ) { // This is NGSIv2 parsing and in NGSIv2, no value means implicit null. Note that @@ -229,7 +230,8 @@ static std::string parseContextAttributeObject if (upOp->numberValue == -1) { - return "date has invalid format"; + *extraForLog = ": " + upOp->stringValue; + return "date has invalid format in attribute value"; } // Probably reseting stringValue is not needed, but let's do it for cleanliness @@ -238,7 +240,8 @@ static std::string parseContextAttributeObject } else { - return "date has invalid format"; + *extraForLog = ": must be string or object with max or min operator"; + return "date has invalid format in attribute value"; } } else @@ -247,7 +250,8 @@ static std::string parseContextAttributeObject if (caP->numberValue == -1) { - return "date has invalid format"; + *extraForLog = ": " + caP->stringValue; + return "date has invalid format in attribute value"; } // Probably reseting stringValue is not needed, but let's do it for cleanliness @@ -383,7 +387,8 @@ std::string parseContextAttribute // Attribute has a regular structure, in which 'value' is mandatory (except in v2) if (iter->value.HasMember("value") || ciP->apiVersion == V2) { - std::string r = parseContextAttributeObject(iter->value, caP, &compoundVector, checkAttrSpecialTypes); + std::string extraForLog = ""; + std::string r = parseContextAttributeObject(iter->value, caP, &compoundVector, checkAttrSpecialTypes, &extraForLog); if (r == "max deep reached") { alarmMgr.badInput(clientIp, "max deep reached", "found in ContextAttributeObject::Object"); @@ -392,7 +397,7 @@ std::string parseContextAttribute } else if (r != "OK") // other error cases get a general treatment { - alarmMgr.badInput(clientIp, "JSON Parse Error in ContextAttribute::Object", r); + alarmMgr.badInput(clientIp, "JSON Parse Error in ContextAttribute::Object", r + extraForLog); ciP->httpStatusCode = SccBadRequest; return r; } @@ -455,13 +460,14 @@ std::string parseContextAttribute(ConnectionInfo* ciP, ContextAttribute* caP, bo } bool compoundVector = false; - std::string r = parseContextAttributeObject(document, caP, &compoundVector, checkAttrSpecialTypes); + std::string extraForLog = ""; + std::string r = parseContextAttributeObject(document, caP, &compoundVector, checkAttrSpecialTypes, &extraForLog); if (r == "max deep reached") { OrionError oe(SccBadRequest, ERROR_DESC_PARSE_MAX_JSON_NESTING, ERROR_PARSE); - alarmMgr.badInput(clientIp, "max deep reached", r); + alarmMgr.badInput(clientIp, "max deep reached", "found in ContextAttributeObject::Object"); ciP->httpStatusCode = SccBadRequest; return oe.toJson(); @@ -470,7 +476,7 @@ std::string parseContextAttribute(ConnectionInfo* ciP, ContextAttribute* caP, bo { OrionError oe(SccBadRequest, r, ERROR_BAD_REQUEST); - alarmMgr.badInput(clientIp, "JSON Parse Error", r); + alarmMgr.badInput(clientIp, "JSON Parse Error", r + extraForLog); ciP->httpStatusCode = SccBadRequest; return oe.toJson(); diff --git a/src/lib/jsonParseV2/parseMetadata.cpp b/src/lib/jsonParseV2/parseMetadata.cpp index c76050f2ad..4765cdf0d8 100644 --- a/src/lib/jsonParseV2/parseMetadata.cpp +++ b/src/lib/jsonParseV2/parseMetadata.cpp @@ -133,8 +133,8 @@ static std::string parseMetadataObject(const rapidjson::Value& start, Metadata* if (mdP->numberValue == -1) { - alarmMgr.badInput(clientIp, "date has invalid format", mdP->stringValue); - return "date has invalid format"; + alarmMgr.badInput(clientIp, "date has invalid format in metadata value", mdP->stringValue); + return "date has invalid format in metadata value"; } // Probably reseting stringValue is not needed, but let's do it for cleanliness diff --git a/test/functionalTest/cases/1039_ngsiv2_date_support/basic_dates_support.test b/test/functionalTest/cases/1039_ngsiv2_date_support/basic_dates_support.test index 3f726234f1..94263a06d9 100644 --- a/test/functionalTest/cases/1039_ngsiv2_date_support/basic_dates_support.test +++ b/test/functionalTest/cases/1039_ngsiv2_date_support/basic_dates_support.test @@ -131,10 +131,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } @@ -188,10 +188,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } diff --git a/test/functionalTest/cases/2654_iso8601_as_alias_for_DateTime/basic_dates_support_for_iso8601.test b/test/functionalTest/cases/2654_iso8601_as_alias_for_DateTime/basic_dates_support_for_iso8601.test index d776ab682c..ddc16c2d45 100644 --- a/test/functionalTest/cases/2654_iso8601_as_alias_for_DateTime/basic_dates_support_for_iso8601.test +++ b/test/functionalTest/cases/2654_iso8601_as_alias_for_DateTime/basic_dates_support_for_iso8601.test @@ -131,10 +131,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } @@ -188,10 +188,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } diff --git a/test/functionalTest/cases/3000_allow_creation_transient_entities/failing_create_transient_entity_with_invalid_date.test b/test/functionalTest/cases/3000_allow_creation_transient_entities/failing_create_transient_entity_with_invalid_date.test index 1be2a721d7..a6fc822fcc 100644 --- a/test/functionalTest/cases/3000_allow_creation_transient_entities/failing_create_transient_entity_with_invalid_date.test +++ b/test/functionalTest/cases/3000_allow_creation_transient_entities/failing_create_transient_entity_with_invalid_date.test @@ -55,10 +55,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } diff --git a/test/functionalTest/cases/3533_null_in_datetime_and_geo/null_in_datetime_attr.test b/test/functionalTest/cases/3533_null_in_datetime_and_geo/null_in_datetime_attr.test index 3eaec3ec5e..f3b3212f65 100644 --- a/test/functionalTest/cases/3533_null_in_datetime_and_geo/null_in_datetime_attr.test +++ b/test/functionalTest/cases/3533_null_in_datetime_and_geo/null_in_datetime_attr.test @@ -239,10 +239,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } @@ -253,10 +253,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } diff --git a/test/functionalTest/cases/3533_null_in_datetime_and_geo/null_in_datetime_md.test b/test/functionalTest/cases/3533_null_in_datetime_and_geo/null_in_datetime_md.test index 9ba5ab0f6e..94f2cdd7e8 100644 --- a/test/functionalTest/cases/3533_null_in_datetime_and_geo/null_in_datetime_md.test +++ b/test/functionalTest/cases/3533_null_in_datetime_and_geo/null_in_datetime_md.test @@ -295,10 +295,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 80 { - "description": "date has invalid format", + "description": "date has invalid format in metadata value", "error": "BadRequest" } @@ -309,10 +309,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 80 { - "description": "date has invalid format", + "description": "date has invalid format in metadata value", "error": "BadRequest" } diff --git a/test/functionalTest/cases/4585_datetime_with_min_max_operators/datetime_with_min_max_operators_errors.test b/test/functionalTest/cases/4585_datetime_with_min_max_operators/datetime_with_min_max_operators_errors.test index 05fdd8de7f..d1e3a5cb7c 100644 --- a/test/functionalTest/cases/4585_datetime_with_min_max_operators/datetime_with_min_max_operators_errors.test +++ b/test/functionalTest/cases/4585_datetime_with_min_max_operators/datetime_with_min_max_operators_errors.test @@ -131,10 +131,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } @@ -145,10 +145,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } @@ -159,10 +159,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } @@ -173,10 +173,10 @@ HTTP/1.1 400 Bad Request Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: 62 +Content-Length: 81 { - "description": "date has invalid format", + "description": "date has invalid format in attribute value", "error": "BadRequest" } diff --git a/test/functionalTest/cases/4616_improve_log_invalid_date/improve_log_invalid_date.test b/test/functionalTest/cases/4616_improve_log_invalid_date/improve_log_invalid_date.test new file mode 100644 index 0000000000..42ad637eda --- /dev/null +++ b/test/functionalTest/cases/4616_improve_log_invalid_date/improve_log_invalid_date.test @@ -0,0 +1,149 @@ +# Copyright 2024 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es + +# VALGRIND_READY - to mark the test ready for valgrindTestSuite.sh + +--NAME-- +Improve log for invalid date + +--SHELL-INIT-- +dbInit CB +brokerStart CB 0 IPV4 -relogAlarms + +--SHELL-- + +# +# 01. Create entity with wrong DateTime +# 02. Create entity with wrong DateTime one more time +# 03. Create entity with wrong DateTime in metadata +# 04. Check logs +# + +echo "01. Create entity with wrong DateTime" +echo "=====================================" +payload='{ + "id": "E", + "type": "T", + "A": { + "value": "this is not a date", + "type": "DateTime" + } +}' +orionCurl --url '/v2/entities' --payload "$payload" +echo +echo + + +echo "02. Create entity with wrong DateTime one more time" +echo "===================================================" +payload='{ + "id": "E", + "type": "T", + "A": { + "value": "2022-12-21T17:16:63.00Z", + "type": "DateTime" + } +}' +orionCurl --url '/v2/entities' --payload "$payload" +echo +echo + + +echo "03. Create entity with wrong DateTime in metadata" +echo "=================================================" +payload='{ + "id": "E", + "type": "T", + "A": { + "value": 2, + "type": "Number", + "metadata": { + "md1": { + "value": "2022-12-21T17:16:63.00Z", + "type": "DateTime" + } + } + } +}' +orionCurl --url '/v2/entities' --payload "$payload" +echo +echo + + +echo "04. Check logs" +echo "==============" +cat /tmp/contextBroker.log | grep 'WARN' | awk -F 'msg=' '{print $2}' +echo +echo + + +--REGEXPECT-- +01. Create entity with wrong DateTime +===================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 81 + +{ + "description": "date has invalid format in attribute value", + "error": "BadRequest" +} + + +02. Create entity with wrong DateTime one more time +=================================================== +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 81 + +{ + "description": "date has invalid format in attribute value", + "error": "BadRequest" +} + + +03. Create entity with wrong DateTime in metadata +================================================= +HTTP/1.1 400 Bad Request +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: 80 + +{ + "description": "date has invalid format in metadata value", + "error": "BadRequest" +} + + +04. Check logs +============== +Raising alarm BadInput 127.0.0.1: JSON Parse Error in ContextAttribute::Object (date has invalid format in attribute value: this is not a date) +Repeated BadInput 127.0.0.1: JSON Parse Error in ContextAttribute::Object (date has invalid format in attribute value: 2022-12-21T17:16:63.00Z) +Repeated BadInput 127.0.0.1: date has invalid format in metadata value (2022-12-21T17:16:63.00Z) + + +--TEARDOWN-- +brokerStop CB +dbDrop CB From ace330dde188db5af65ff40f254eec022dfd2b4e Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Mon, 21 Oct 2024 12:33:33 +0530 Subject: [PATCH 06/17] Delete subscriptions in bulk using python script --- scripts/utils/delete_subscriptions.py | 138 ++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100755 scripts/utils/delete_subscriptions.py diff --git a/scripts/utils/delete_subscriptions.py b/scripts/utils/delete_subscriptions.py new file mode 100755 index 0000000000..3daaff98c6 --- /dev/null +++ b/scripts/utils/delete_subscriptions.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python3 +# Copyright 2024 Telefonica Investigacion y Desarrollo, S.A.U +# +# This file is part of Orion Context Broker. +# +# Orion Context Broker is free software: you can redistribute it and/or +# modify it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# Orion Context Broker is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero +# General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Orion Context Broker. If not, see http://www.gnu.org/licenses/. +# +# For those usages not covered by this license please contact with +# iot_support at tid dot es + +import requests +import sys + +requests.packages.urllib3.disable_warnings() + +__author__ = 'Md Arqum Farooqui' + +############################################################## +# BEGIN of the configuration part (don't touch above this line ;) + +cb_endpoint = 'http://localhost:1026/v2/subscriptions' + +headers = { + 'Accept': 'application/json', + 'fiware-service': 'service', + 'fiware-servicepath': '/subservice' +} + +page_size = 500 + +# WARNING! use this filter or you will remove *all* subscriptions +filter = 'offset=0' + +# END of the configuration part (don't touch below this line ;) +############################################################## + +def delete_subscriptions(): + """ + delete subscriptions in current page. + :return: True if removal was ok, False otherwise + """ + try: + # Fetching subscriptions with pagination + response = requests.get(f"{cb_endpoint}?limit={page_size}&{filter}", headers=headers, verify=False) + + if response.status_code == 200: + subscriptions = response.json() + + # Check if subscriptions list is not empty + if not subscriptions: + print("No more subscriptions found.") + return False + + # Delete each subscription + for subscription in subscriptions: + subscription_id = subscription['id'] + delete_url = f"{cb_endpoint}/{subscription_id}" + delete_response = requests.delete(delete_url, headers=headers) + + if delete_response.status_code != 204: + print(f"Failed to delete subscription with ID {subscription_id}. Status code: {delete_response.status_code}") + return False + + else: + print(f"Failed to fetch subscriptions. Status code: {response.status_code}") + return False + + except requests.exceptions.RequestException as e: + print(f"An error occurred: {e}") + + +def get_subscriptions_count(): + """ + Return the total number of subscriptions. + + :return: number of subscriptions (or -1 if there was some error) + """ + + res = requests.get(cb_endpoint + '?limit=1&options=count', headers=headers, verify=False) + if res.status_code != 200: + print('Error getting subscriptions count (%d): %s' % (res.status_code, res.json())) + return -1 + else: + return int(res.headers['fiware-total-count']) + + +def initial_statistics(): + """ + Print some initial data statistics. + """ + total = get_subscriptions_count() + print(f'There are {total} subscriptions in total.') + pages = total // page_size + rest = total % page_size + print(f'This includes {pages} full pages of {page_size} subscriptions and one final page of {rest} subscriptions.') + + +def remove_all_subscriptions(): + """ + Remove all subscriptions, page after page. + """ + i = 1 + while get_subscriptions_count() > 0: + print(f'- Removing page {i}') + delete_subscriptions() + i += 1 + + +### Main program starts here ### + +# Warn user +print(f"WARNING!!!! This script will delete all the subscriptions matching the filter '{filter}'") +print("This action cannot be undone. If you are sure you want to continue type 'yes' and press Enter") + +confirm = input() + +if (confirm != 'yes'): + sys.exit() + + +# Get statistics +initial_statistics() + +# Remove all subscriptions +remove_all_subscriptions() + +print('All subscriptions deleted!') From d0f4c4d8d4f8173c76c48e98afaff25d1753f81b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Wed, 23 Oct 2024 14:20:33 +0200 Subject: [PATCH 07/17] FIX add new push cases in doc and test --- doc/manuals/orion-api.md | 25 +++++ .../push_several_items_to_array.test | 98 ++++++++++++++++++- 2 files changed, 118 insertions(+), 5 deletions(-) diff --git a/doc/manuals/orion-api.md b/doc/manuals/orion-api.md index 42af692801..806e1d734d 100644 --- a/doc/manuals/orion-api.md +++ b/doc/manuals/orion-api.md @@ -1379,6 +1379,31 @@ PUT /v2/entities/E/attrs/A would change the value of attribute A to `[1, 2, 3, 3]` +If after the previous result the following request is done: + +``` +PUT /v2/entities/E/attrs/A +{ + "value": { "$push": { "$each": [4, 5]} }, + "type": "Array" +} +``` + +would change the value of attribute A to `[1, 2, 3, 3, 4, 5]`. + +If after the previous result the following request is done: + +``` +PUT /v2/entities/E/attrs/A +{ + "value": { "$push": { "$each": [ -1, 0 ], "$position": 0} }, + "type": "Array" +} +``` + +would change the value of attribute A to `[-1, 0, 1, 2, 3, 3, 4, 5]` + + #### `$addToSet` Similar to push but avoids duplications. diff --git a/test/functionalTest/cases/0744_push_several_items_to_array/push_several_items_to_array.test b/test/functionalTest/cases/0744_push_several_items_to_array/push_several_items_to_array.test index 34c650db52..f523a7f37e 100644 --- a/test/functionalTest/cases/0744_push_several_items_to_array/push_several_items_to_array.test +++ b/test/functionalTest/cases/0744_push_several_items_to_array/push_several_items_to_array.test @@ -35,7 +35,9 @@ accumulatorStart --pretty-print # 02. Create sub for entity E # 03. Update A with $push: $each: [2, 3, 4] # 04. Get entity, see E-A=[1,2,3,4] -# 05. Dump accumulator, see E-A=[1,2,3,4] +# 05. Update A with $push: $each: [-1, 0], $position: 0 +# 06. Get entity, see E-A=[-1,0,1,2,3,4] +# 07. Dump accumulator, see E-A=[1,2,3,4] and E-A=[-1,0,1,2,3,4] # @@ -96,8 +98,28 @@ echo echo -echo '05. Dump accumulator, see E-A=[1,2,3,4]' -echo '=======================================' +echo '05. Update A with $push: $each: [-1, 0], $position: 0' +echo '=====================================================' +payload='{ + "A": { + "value": { "$push": { "$each": [-1, 0], "$position": 0} }, + "type": "StructuredValue" + } +}' +orionCurl --url /v2/entities/E/attrs --payload "$payload" +echo +echo + + +echo '06. Get entity, see E-A=[-1,0,1,2,3,4]' +echo '======================================' +orionCurl --url /v2/entities/E +echo +echo + + +echo '07. Dump accumulator, see E-A=[1,2,3,4] and E-A=[-1,0,1,2,3,4]' +echo '==============================================================' accumulatorDump echo echo @@ -156,8 +178,42 @@ Content-Length: 84 } -05. Dump accumulator, see E-A=[1,2,3,4] -======================================= +05. Update A with $push: $each: [-1, 0], $position: 0 +===================================================== +HTTP/1.1 204 No Content +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) + + + +06. Get entity, see E-A=[-1,0,1,2,3,4] +====================================== +HTTP/1.1 200 OK +Date: REGEX(.*) +Fiware-Correlator: REGEX([0-9a-f\-]{36}) +Content-Type: application/json +Content-Length: x + +{ + "A": { + "metadata": {}, + "type": "StructuredValue", + "value": [ + -1, + 0, + 1, + 2, + 3, + 4 + ] + }, + "id": "E", + "type": "T" +} + + +07. Dump accumulator, see E-A=[1,2,3,4] and E-A=[-1,0,1,2,3,4] +============================================================== POST http://localhost:REGEX(\d+)/notify Fiware-Servicepath: / Content-Length: 139 @@ -188,6 +244,38 @@ Fiware-Correlator: REGEX([0-9a-f\-]{36}); cbnotif=1 "subscriptionId": "REGEX([0-9a-f\-]{24})" } ======================================= +POST http://localhost:REGEX(\d+)/notify +Fiware-Servicepath: / +Content-Length: x +User-Agent: orion/REGEX(\d+\.\d+\.\d+.*) +Ngsiv2-Attrsformat: normalized +Host: localhost:REGEX(\d+) +Accept: application/json +Content-Type: application/json; charset=utf-8 +Fiware-Correlator: REGEX([0-9a-f\-]{36}); cbnotif=1 + +{ + "data": [ + { + "A": { + "metadata": {}, + "type": "StructuredValue", + "value": [ + -1, + 0 + 1, + 2, + 3, + 4 + ] + }, + "id": "E", + "type": "T" + } + ], + "subscriptionId": "REGEX([0-9a-f\-]{24})" +} +======================================= --TEARDOWN-- From 8096eef7083e81dad736281d71ce0aa0b339c6f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Wed, 23 Oct 2024 16:47:52 +0200 Subject: [PATCH 08/17] FIX test expectation --- .../push_several_items_to_array.test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/functionalTest/cases/0744_push_several_items_to_array/push_several_items_to_array.test b/test/functionalTest/cases/0744_push_several_items_to_array/push_several_items_to_array.test index f523a7f37e..a618d60426 100644 --- a/test/functionalTest/cases/0744_push_several_items_to_array/push_several_items_to_array.test +++ b/test/functionalTest/cases/0744_push_several_items_to_array/push_several_items_to_array.test @@ -192,7 +192,7 @@ HTTP/1.1 200 OK Date: REGEX(.*) Fiware-Correlator: REGEX([0-9a-f\-]{36}) Content-Type: application/json -Content-Length: x +Content-Length: 89 { "A": { @@ -246,7 +246,7 @@ Fiware-Correlator: REGEX([0-9a-f\-]{36}); cbnotif=1 ======================================= POST http://localhost:REGEX(\d+)/notify Fiware-Servicepath: / -Content-Length: x +Content-Length: 144 User-Agent: orion/REGEX(\d+\.\d+\.\d+.*) Ngsiv2-Attrsformat: normalized Host: localhost:REGEX(\d+) @@ -262,7 +262,7 @@ Fiware-Correlator: REGEX([0-9a-f\-]{36}); cbnotif=1 "type": "StructuredValue", "value": [ -1, - 0 + 0, 1, 2, 3, From b996e032d7a187f8a0f2eafe3f78edd1f74b4c92 Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Thu, 24 Oct 2024 16:38:40 +0900 Subject: [PATCH 09/17] (JP) FIX add new push cases in doc (#4627) --- doc/manuals.jp/orion-api.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/manuals.jp/orion-api.md b/doc/manuals.jp/orion-api.md index b282a4a3f7..1898c94e7e 100644 --- a/doc/manuals.jp/orion-api.md +++ b/doc/manuals.jp/orion-api.md @@ -1337,6 +1337,30 @@ PUT /v2/entities/E/attrs/A 属性Aの値を `[1, 2, 3, 3]` に変更します。 +前回の結果の後に次のリクエストが実行される場合: + +``` +PUT /v2/entities/E/attrs/A +{ + "value": { "$push": { "$each": [4, 5]} }, + "type": "Array" +} +``` + +属性 A の値は `[1, 2, 3, 3, 4, 5]` に変更されます。 + +前の結果の後に次のリクエストが実行される場合: + +``` +PUT /v2/entities/E/attrs/A +{ + "value": { "$push": { "$each": [ -1, 0 ], "$position": 0} }, + "type": "Array" +} +``` + +属性 A の値は `[-1, 0, 1, 2, 3, 3, 4, 5]` に変更されます。 + #### `$addToSet` From 01f855348599b3e69c8672ac89e28656b2e51a20 Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Sat, 26 Oct 2024 09:40:33 +0530 Subject: [PATCH 10/17] updated as per comment --- scripts/utils/delete_subscriptions.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/utils/delete_subscriptions.py b/scripts/utils/delete_subscriptions.py index 3daaff98c6..372e0526cb 100755 --- a/scripts/utils/delete_subscriptions.py +++ b/scripts/utils/delete_subscriptions.py @@ -40,7 +40,12 @@ page_size = 500 # WARNING! use this filter or you will remove *all* subscriptions -filter = 'offset=0' +# FIXME: Note that filtering is not supported in the GET /v2/subscriptions. If, at some point it gets +# implemented (https://github.com/telefonicaid/fiware-orion/issues/1145 or additional issues), +# we should adjust this point of the script with a valid example filter +#filter = '&type=device' +# For now we can keep filter variable empty. +filter = '' # END of the configuration part (don't touch below this line ;) ############################################################## @@ -52,7 +57,7 @@ def delete_subscriptions(): """ try: # Fetching subscriptions with pagination - response = requests.get(f"{cb_endpoint}?limit={page_size}&{filter}", headers=headers, verify=False) + response = requests.get(f"{cb_endpoint}?limit={page_size}{filter}", headers=headers, verify=False) if response.status_code == 200: subscriptions = response.json() From 351d954e474b8dfeee12a8672962ad7135e19e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 31 Oct 2024 16:49:50 +0100 Subject: [PATCH 11/17] FIX upgrade debian to 12.7 --- CHANGES_NEXT_RELEASE | 1 + ci/deb/Dockerfile | 2 +- doc/manuals.jp/admin/install.md | 2 +- doc/manuals/admin/install.md | 2 +- docker/Dockerfile | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index b5b80eeb36..dc287a0328 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ - Fix: improve attribute and metadata invalid format dates for DateTime types in logs (#4616) +- Upgrade Debian version from 12.6 to 12.7 in Dockerfile diff --git a/ci/deb/Dockerfile b/ci/deb/Dockerfile index afe1fbe778..0c1c27c4b3 100644 --- a/ci/deb/Dockerfile +++ b/ci/deb/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:12.6-slim +FROM debian:12.7-slim ADD build.sh /opt/bin/ ADD build-dep.sh /opt/bin/ diff --git a/doc/manuals.jp/admin/install.md b/doc/manuals.jp/admin/install.md index 06a4c2a5c7..e39b650349 100644 --- a/doc/manuals.jp/admin/install.md +++ b/doc/manuals.jp/admin/install.md @@ -26,7 +26,7 @@ Docker hub で公式の Orion docker コンテナを使用してインストー 必要なソースから ビルドした Orion をインストールする場合: -* オペレーティングシステム: Debian。リファレンス・オペレーティングシステムは Debian 12.6 ですが、それ以降の +* オペレーティングシステム: Debian。リファレンス・オペレーティングシステムは Debian 12.7 ですが、それ以降の Debian 12 バージョンでも動作するはずです * データベース: MongoDB は、Orion Context Broker がインストールされるのと同じホストで実行するか、ネットワーク経由で アクセスできる別のホストで実行する必要があります。推奨される MongoDB バージョンは 6.0 です (Orion は古いバージョンで diff --git a/doc/manuals/admin/install.md b/doc/manuals/admin/install.md index f8ef9489f5..297807a0a1 100644 --- a/doc/manuals/admin/install.md +++ b/doc/manuals/admin/install.md @@ -23,7 +23,7 @@ In the case you install using the official Orion docker container at Dockerhub, In the case you are installing Orion building from sources you need: -* Operating system: Debian. The reference operating system is Debian 12.6 +* Operating system: Debian. The reference operating system is Debian 12.7 but it should work also in any later Debian 12 version. * Database: MongoDB is required to run either in the same host where Orion Context Broker is to be installed or in a different host accessible through the network. The recommended MongoDB version is 6.0 (Orion may work with older versions but we don't recommend it at all!). diff --git a/docker/Dockerfile b/docker/Dockerfile index aac4d0b52f..63ea06b81b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -20,7 +20,7 @@ # ARG IMAGE_NAME=debian -ARG IMAGE_TAG=12.6-slim +ARG IMAGE_TAG=12.7-slim FROM ${IMAGE_NAME}:${IMAGE_TAG} ARG GITHUB_ACCOUNT=telefonicaid From ac5739c48802223b59dd40f9d60bc3a0f37ce69d Mon Sep 17 00:00:00 2001 From: Pelayo <93575721+pelayogb@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:01:47 +0100 Subject: [PATCH 12/17] Update orion-api.md --- doc/manuals/orion-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manuals/orion-api.md b/doc/manuals/orion-api.md index 806e1d734d..8dbb482647 100644 --- a/doc/manuals/orion-api.md +++ b/doc/manuals/orion-api.md @@ -3255,7 +3255,7 @@ It can be checked at https://www.epochconverter.com that 1720606949 corresponds As failsafe behaviour, evaluation returns `null` in the following cases: * Some of the transformation used in the expression is unknown (e.g. `A|undefinedExpression`) -* Operations with identifiers that are not defined in the context are used. For instance, `(A==null)?0:A` will result in `null` (and not `0`) if `A` is not in the context, due to `==` is an operation that cannot be done on undefined identifiers. However, `A||0` will work (i.e. `0` will result if `A` is not in the context), as `||` is not considered an operation on `A`. +* Operations with identifiers that are not defined in the context are used. For instance, `(A==null)?0:A` will result in `null` (and not `0`) if `A` is not in the context, due to `==` is an operation that cannot be done on undefined identifiers. However, `A||0` will work (i.e. `0` will result if `A` is not in the context), as `||` is not considered an operation on `A`. Another possibility is to use the != operator which behaves differently than == . In this case A != null ? 1: 0 if A is not in the context it will be assigned the value 0. * Syntax error in the JEXL expression (e.g. `A[0|uppercase`) ### Known limitations From 17fb132f4dc8dabae07cd13e800f822062810e7f Mon Sep 17 00:00:00 2001 From: Pelayo <93575721+pelayogb@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:30:16 +0100 Subject: [PATCH 13/17] Update doc/manuals/orion-api.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fermín Galán Márquez --- doc/manuals/orion-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manuals/orion-api.md b/doc/manuals/orion-api.md index 8dbb482647..9758f45071 100644 --- a/doc/manuals/orion-api.md +++ b/doc/manuals/orion-api.md @@ -3255,7 +3255,7 @@ It can be checked at https://www.epochconverter.com that 1720606949 corresponds As failsafe behaviour, evaluation returns `null` in the following cases: * Some of the transformation used in the expression is unknown (e.g. `A|undefinedExpression`) -* Operations with identifiers that are not defined in the context are used. For instance, `(A==null)?0:A` will result in `null` (and not `0`) if `A` is not in the context, due to `==` is an operation that cannot be done on undefined identifiers. However, `A||0` will work (i.e. `0` will result if `A` is not in the context), as `||` is not considered an operation on `A`. Another possibility is to use the != operator which behaves differently than == . In this case A != null ? 1: 0 if A is not in the context it will be assigned the value 0. +* Operations with identifiers that are not defined in the context are used. For instance, `(A==null)?0:A` will result in `null` (and not `0`) if `A` is not in the context, due to `==` is an operation that cannot be done on undefined identifiers. However, `A||0` will work (i.e. `0` will result if `A` is not in the context), as `||` is not considered an operation on `A`. Another possibility is to use the `!=` operator which behaves differently than `==`. In this case `A != null ? 1: 0`, if `A` is not in the context it will be assigned the value `0`. * Syntax error in the JEXL expression (e.g. `A[0|uppercase`) ### Known limitations From a64d422dbfefc6396b2fe819be173fbbfa15da7a Mon Sep 17 00:00:00 2001 From: Kazuhito Suda Date: Wed, 6 Nov 2024 04:23:10 +0900 Subject: [PATCH 14/17] (JP) Update orion-api.md (#4631) --- doc/manuals.jp/orion-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/manuals.jp/orion-api.md b/doc/manuals.jp/orion-api.md index 1898c94e7e..15d8138292 100644 --- a/doc/manuals.jp/orion-api.md +++ b/doc/manuals.jp/orion-api.md @@ -3333,7 +3333,7 @@ https://www.epochconverter.com で、1720606949 が 2024-07-10T10:22:29+00:00 フェイルセーフ動作として、評価は次の場合に `null` を返します: * 式で使用されている変換の一部が不明です (例: `A|undefinedExpression`) -* コンテキストで定義されていない識別子を使用した演算が使用されています。たとえば、`(A==null)?0:A` は、`A` がコンテキストにない場合、`null` (`0` ではありません) になります。これは、`==` が未定義の識別子では実行できない演算であるためです。ただし、`||` は `A` に対する演算とは見なされないため、`A||0` は機能します (つまり、`A` がコンテキストにない場合は `0` になります) +* コンテキストで定義されていない識別子を使用した演算が使用されています。たとえば、`(A==null)?0:A` は、`A` がコンテキストにない場合、`null` (`0` ではありません) になります。これは、`==` が未定義の識別子では実行できない演算であるためです。ただし、`||` は `A` に対する演算とは見なされないため、`A||0` は機能します (つまり、`A` がコンテキストにない場合は `0` になります)。もう 1 つの可能性は、`==` とは異なる動作をする `!=` 演算子を使用することです。この場合、`A != null ? 1: 0` であり、`A` がコンテキスト内にない場合は値 `0` が割り当てられます。 * JEXL 式の構文エラーです (例: `A[0|uppercase`) From 2d06e717abfb0a0a78357ce47f3c93dfcb74a9aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 7 Nov 2024 10:19:53 +0100 Subject: [PATCH 15/17] ADD fix openssl reference version due to upgrade to Debian 12.7 --- doc/manuals.jp/admin/build_source.md | 2 +- doc/manuals/admin/build_source.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/manuals.jp/admin/build_source.md b/doc/manuals.jp/admin/build_source.md index ca4e113d3d..5943b978e9 100644 --- a/doc/manuals.jp/admin/build_source.md +++ b/doc/manuals.jp/admin/build_source.md @@ -13,7 +13,7 @@ Orion Context Broker は、以下のライブラリをビルドの依存関係 * boost: 1.74 * libmicrohttpd: 0.9.76 (ソースから) * libcurl: 7.88.1 -* openssl: 3.0.13 +* openssl: 3.0.14 * libuuid: 2.38.1 * libmosquitto: 2.0.15 (ソースから) * Mongo C driver: 1.24.3 (ソースから) diff --git a/doc/manuals/admin/build_source.md b/doc/manuals/admin/build_source.md index 8d35154db3..1ccba4365c 100644 --- a/doc/manuals/admin/build_source.md +++ b/doc/manuals/admin/build_source.md @@ -13,7 +13,7 @@ The Orion Context Broker uses the following libraries as build dependencies: * boost: 1.74 * libmicrohttpd: 0.9.76 (from source) * libcurl: 7.88.1 -* openssl: 3.0.13 +* openssl: 3.0.14 * libuuid: 2.38.1 * libmosquitto: 2.0.15 (from source) * Mongo C driver: 1.24.3 (from source) From 1cfa741fdf8a665537a588191f3ce5511f11ec8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 7 Nov 2024 10:33:03 +0100 Subject: [PATCH 16/17] FIX upgrade dependencies --- CHANGES_NEXT_RELEASE | 3 +++ CMakeLists.txt | 4 ++-- ci/deb/build-dep.sh | 18 ++++++++--------- doc/manuals.jp/admin/build_source.md | 26 ++++++++++++------------ doc/manuals/admin/build_source.md | 26 ++++++++++++------------ docker/Dockerfile | 30 ++++++++++++++-------------- docker/Dockerfile.alpine | 30 ++++++++++++++-------------- 7 files changed, 70 insertions(+), 67 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index dc287a0328..6178729c57 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,2 +1,5 @@ - Fix: improve attribute and metadata invalid format dates for DateTime types in logs (#4616) +- Hardening: upgrade microhttpd dependency from 0.9.76 to 1.0.1 +- Hardening: upgrade libmosquitto dependency from 2.0.15 to 2.0.20 +- Hardening: upgrade libmongoc dependency from 1.24.3 to 1.29.0 - Upgrade Debian version from 12.6 to 12.7 in Dockerfile diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c922231cf..3863e95076 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,8 +231,8 @@ SET (BOOST_MT # See http://mongoc.org/libmongoc/current/tutorial.html#cmake # This find_package() command provides the mongo::mongoc_static used in -# SET for common static libs. We use 1.24.3 as reference version. -find_package (mongoc-1.0 1.24.3 EXACT) +# SET for common static libs. We use 1.29.0 as reference version. +find_package (mongoc-1.0 1.29.0 EXACT) # Is cjexl lib available? find_library (HAVE_CJEXL cjexl PATHS /usr/lib /usr/lib64 /usr/local/lib64 /usr/local/lib) diff --git a/ci/deb/build-dep.sh b/ci/deb/build-dep.sh index ea8531172a..da2e06a9ab 100755 --- a/ci/deb/build-dep.sh +++ b/ci/deb/build-dep.sh @@ -68,8 +68,8 @@ echo "INSTALL: python special dependencies" \ # Recommended setting for DENABLE_AUTOMATIC_INIT_AND_CLEANUP, to be removed in 2.0.0 # see http://mongoc.org/libmongoc/current/init-cleanup.html#deprecated-feature-automatic-initialization-and-cleanup echo "INSTALL: mongodb c driver" \ -&& curl -L https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz | tar xzC /opt/ \ -&& cd /opt/mongo-c-driver-1.24.3 \ +&& curl -L https://github.com/mongodb/mongo-c-driver/releases/download/1.29.0/mongo-c-driver-1.29.0.tar.gz | tar xzC /opt/ \ +&& cd /opt/mongo-c-driver-1.29.0 \ && mkdir cmake-build \ && cd cmake-build \ && cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. \ @@ -81,8 +81,8 @@ echo "INSTALL: rapidjson" \ && mv /opt/rapidjson-1.1.0/include/rapidjson/ /usr/local/include echo "INSTALL: libmicrohttpd" \ -&& curl -L https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz | tar xzC /opt/ \ -&& cd /opt/libmicrohttpd-0.9.76 \ +&& curl -L https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz | tar xzC /opt/ \ +&& cd /opt/libmicrohttpd-1.0.1 \ && ./configure --disable-messages --disable-postprocessor --disable-dauth \ && make \ && make install @@ -96,8 +96,8 @@ echo "INSTALL: gmock" \ && make install echo "INSTALL: mosquitto" \ -&& curl -kL https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz | tar xzC /opt/ \ -&& cd /opt/mosquitto-2.0.15 \ +&& curl -kL https://mosquitto.org/files/source/mosquitto-2.0.20.tar.gz | tar xzC /opt/ \ +&& cd /opt/mosquitto-2.0.20 \ && sed -i 's/WITH_CJSON:=yes/WITH_CJSON:=no/g' config.mk \ && sed -i 's/WITH_STATIC_LIBRARIES:=no/WITH_STATIC_LIBRARIES:=yes/g' config.mk \ && sed -i 's/WITH_SHARED_LIBRARIES:=yes/WITH_SHARED_LIBRARIES:=no/g' config.mk \ @@ -107,8 +107,8 @@ echo "INSTALL: mosquitto" \ ldconfig apt-get -y clean \ -&& rm -Rf /opt/mongo-c-driver-1.24.3 \ +&& rm -Rf /opt/mongo-c-driver-1.29.0 \ && rm -Rf /opt/rapidjson-1.1.0 \ -&& rm -Rf /opt/libmicrohttpd-0.9.76 \ -&& rm -Rf /opt/mosquitto-2.0.15 \ +&& rm -Rf /opt/libmicrohttpd-1.0.1 \ +&& rm -Rf /opt/mosquitto-2.0.20 \ && rm -Rf /opt/gmock-1.5.0 diff --git a/doc/manuals.jp/admin/build_source.md b/doc/manuals.jp/admin/build_source.md index 5943b978e9..6d50b64ccd 100644 --- a/doc/manuals.jp/admin/build_source.md +++ b/doc/manuals.jp/admin/build_source.md @@ -11,12 +11,12 @@ Orion Context Broker のリファレンス配布は Debian 12 です。これは Orion Context Broker は、以下のライブラリをビルドの依存関係として使用します : * boost: 1.74 -* libmicrohttpd: 0.9.76 (ソースから) +* libmicrohttpd: 1.0.1 (ソースから) * libcurl: 7.88.1 * openssl: 3.0.14 * libuuid: 2.38.1 -* libmosquitto: 2.0.15 (ソースから) -* Mongo C driver: 1.24.3 (ソースから) +* libmosquitto: 2.0.20 (ソースから) +* Mongo C driver: 1.29.0 (ソースから) * rapidjson: 1.1.0 (ソースから) * gtest (`make unit_test` ビルディング・ターゲットのみ) : 1.5 (ソースから) * gmock (`make unit_test` ビルディング・ターゲットのみ) : 1.5 (ソースから) @@ -33,9 +33,9 @@ Orion Context Broker は、以下のライブラリをビルドの依存関係 * ソースから Mongo Driver をインストールします - wget https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz - tar xfvz mongo-c-driver-1.24.3.tar.gz - cd mongo-c-driver-1.24.3 + wget https://github.com/mongodb/mongo-c-driver/releases/download/1.29.0/mongo-c-driver-1.29.0.tar.gz + tar xfvz mongo-c-driver-1.29.0.tar.gz + cd mongo-c-driver-1.29.0 mkdir cmake-build cd cmake-build cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. @@ -50,19 +50,19 @@ Orion Context Broker は、以下のライブラリをビルドの依存関係 * ソースから libmicrohttpd をインストールします (`./configure` 下のコマンドはライブラリの最小限のフットプリントを得るための推奨ビルド設定を示していますが、上級ユーザの方は好きなように設定できます) - wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz - tar xvf libmicrohttpd-0.9.76.tar.gz - cd libmicrohttpd-0.9.76 + wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz + tar xvf libmicrohttpd-1.0.1.tar.gz + cd libmicrohttpd-1.0.1 ./configure --disable-messages --disable-postprocessor --disable-dauth make sudo make install # installation puts .h files in /usr/local/include and library in /usr/local/lib sudo ldconfig # just in case... it doesn't hurt :) -* ソースから mosquitto をインストールします (WITH_CJSON, WITH_STATIC_LIBRARIES, WITH_SHARED_LIBRARIES の設定を変更することで、mosquitto-2.0.15/ の下の config.mk ファイルを変更してビルドを微調整できます) +* ソースから mosquitto をインストールします (WITH_CJSON, WITH_STATIC_LIBRARIES, WITH_SHARED_LIBRARIES の設定を変更することで、mosquitto-2.0.20/ の下の config.mk ファイルを変更してビルドを微調整できます) - wget https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz - tar xvf mosquitto-2.0.15.tar.gz - cd mosquitto-2.0.15 + wget https://mosquitto.org/files/source/mosquitto-2.0.20.tar.gz + tar xvf mosquitto-2.0.20.tar.gz + cd mosquitto-2.0.20 sed -i 's/WITH_CJSON:=yes/WITH_CJSON:=no/g' config.mk sed -i 's/WITH_STATIC_LIBRARIES:=no/WITH_STATIC_LIBRARIES:=yes/g' config.mk sed -i 's/WITH_SHARED_LIBRARIES:=yes/WITH_SHARED_LIBRARIES:=no/g' config.mk diff --git a/doc/manuals/admin/build_source.md b/doc/manuals/admin/build_source.md index 1ccba4365c..8d675098ca 100644 --- a/doc/manuals/admin/build_source.md +++ b/doc/manuals/admin/build_source.md @@ -11,12 +11,12 @@ You can also have a look to [3.1 Building in not official distributions](../../. The Orion Context Broker uses the following libraries as build dependencies: * boost: 1.74 -* libmicrohttpd: 0.9.76 (from source) +* libmicrohttpd: 1.0.1 (from source) * libcurl: 7.88.1 * openssl: 3.0.14 * libuuid: 2.38.1 -* libmosquitto: 2.0.15 (from source) -* Mongo C driver: 1.24.3 (from source) +* libmosquitto: 2.0.20 (from source) +* Mongo C driver: 1.29.0 (from source) * rapidjson: 1.1.0 (from source) * gtest (only for `make unit_test` building target): 1.5 (from sources) * gmock (only for `make unit_test` building target): 1.5 (from sources) @@ -34,9 +34,9 @@ commands that require root privilege): * Install the Mongo Driver from source. - wget https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz - tar xfvz mongo-c-driver-1.24.3.tar.gz - cd mongo-c-driver-1.24.3 + wget https://github.com/mongodb/mongo-c-driver/releases/download/1.29.0/mongo-c-driver-1.29.0.tar.gz + tar xfvz mongo-c-driver-1.29.0.tar.gz + cd mongo-c-driver-1.29.0 mkdir cmake-build cd cmake-build cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF .. @@ -51,19 +51,19 @@ commands that require root privilege): * Install libmicrohttpd from sources (the `./configure` command below shows the recommended build configuration to get minimum library footprint, but if you are an advanced user, you can configure as you prefer) - wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz - tar xvf libmicrohttpd-0.9.76.tar.gz - cd libmicrohttpd-0.9.76 + wget https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz + tar xvf libmicrohttpd-1.0.1.tar.gz + cd libmicrohttpd-1.0.1 ./configure --disable-messages --disable-postprocessor --disable-dauth make sudo make install # installation puts .h files in /usr/local/include and library in /usr/local/lib sudo ldconfig # just in case... it doesn't hurt :) -* Install mosquitto from sources (appart from changing WITH_CJSON, WITH_STATIC_LIBRARIES and WITH_SHARED_LIBRARIES settings, config.mk file under mosquitto-2.0.15/ can be modified to fine tune the build) +* Install mosquitto from sources (appart from changing WITH_CJSON, WITH_STATIC_LIBRARIES and WITH_SHARED_LIBRARIES settings, config.mk file under mosquitto-2.0.20/ can be modified to fine tune the build) - wget https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz - tar xvf mosquitto-2.0.15.tar.gz - cd mosquitto-2.0.15 + wget https://mosquitto.org/files/source/mosquitto-2.0.20.tar.gz + tar xvf mosquitto-2.0.20.tar.gz + cd mosquitto-2.0.20 sed -i 's/WITH_CJSON:=yes/WITH_CJSON:=no/g' config.mk sed -i 's/WITH_STATIC_LIBRARIES:=no/WITH_STATIC_LIBRARIES:=yes/g' config.mk sed -i 's/WITH_SHARED_LIBRARIES:=yes/WITH_SHARED_LIBRARIES:=no/g' config.mk diff --git a/docker/Dockerfile b/docker/Dockerfile index 63ea06b81b..35a7399d24 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -61,18 +61,18 @@ RUN --mount=type=secret,id=repo_token,dst=/run/secrets/repo_token \ libgcrypt-dev && \ # Install libmicrohttpd from source cd /opt && \ - curl -kOL https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz && \ - tar xvf libmicrohttpd-0.9.76.tar.gz && \ - cd libmicrohttpd-0.9.76 && \ + curl -kOL https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz && \ + tar xvf libmicrohttpd-1.0.1.tar.gz && \ + cd libmicrohttpd-1.0.1 && \ ./configure --disable-messages --disable-postprocessor --disable-dauth && \ make && \ make install && \ ldconfig && \ # Install mosquitto from source cd /opt && \ - curl -kOL https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz && \ - tar xvf mosquitto-2.0.15.tar.gz && \ - cd mosquitto-2.0.15 && \ + curl -kOL https://mosquitto.org/files/source/mosquitto-2.0.20.tar.gz && \ + tar xvf mosquitto-2.0.20.tar.gz && \ + cd mosquitto-2.0.20 && \ sed -i 's/WITH_CJSON:=yes/WITH_CJSON:=no/g' config.mk && \ sed -i 's/WITH_STATIC_LIBRARIES:=no/WITH_STATIC_LIBRARIES:=yes/g' config.mk && \ sed -i 's/WITH_SHARED_LIBRARIES:=yes/WITH_SHARED_LIBRARIES:=no/g' config.mk && \ @@ -81,9 +81,9 @@ RUN --mount=type=secret,id=repo_token,dst=/run/secrets/repo_token \ ldconfig && \ # Install mongodb driver from source cd /opt && \ - curl -kOL https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz && \ - tar xfvz mongo-c-driver-1.24.3.tar.gz && \ - cd mongo-c-driver-1.24.3 && \ + curl -kOL https://github.com/mongodb/mongo-c-driver/releases/download/1.29.0/mongo-c-driver-1.29.0.tar.gz && \ + tar xfvz mongo-c-driver-1.29.0.tar.gz && \ + cd mongo-c-driver-1.29.0 && \ mkdir cmake-build && \ cd cmake-build && \ # Different from ci/deb/build-dep.sh and build from source documentation, we add here also @@ -116,14 +116,14 @@ RUN --mount=type=secret,id=repo_token,dst=/run/secrets/repo_token \ # cleanup sources, dev tools and locales to reduce the final image size # FIXME: this could need more tunning. Have a look to old CentOS Docerkile and try to # reproduce the same steps - rm -rf /opt/libmicrohttpd-0.9.76.tar.gz \ + rm -rf /opt/libmicrohttpd-1.0.1.tar.gz \ /usr/local/include/microhttpd.h \ /usr/local/lib/libmicrohttpd.* \ - /opt/libmicrohttpd-0.9.76 \ - /opt/mosquitto-2.0.15.tar.gz \ - /opt/mosquitto-2.0.15 \ - /opt/mongo-c-driver-1.24.3.tar.gz \ - /opt/mongo-c-driver-1.24.3 \ + /opt/libmicrohttpd-1.0.1 \ + /opt/mosquitto-2.0.20.tar.gz \ + /opt/mosquitto-2.0.20 \ + /opt/mongo-c-driver-1.29.0.tar.gz \ + /opt/mongo-c-driver-1.29.0 \ /usr/local/include/mongo \ /usr/local/lib/libmongoclient.a \ /usr/local/lib/libcjexl.a \ diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine index 884c9cf1ef..7faf1c7f85 100644 --- a/docker/Dockerfile.alpine +++ b/docker/Dockerfile.alpine @@ -62,9 +62,9 @@ RUN --mount=type=secret,id=repo_token,dst=/run/secrets/repo_token \ # Install libmicrohttpd from source echo =====================MARK1 && \ cd /opt && \ - curl -kOL https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.76.tar.gz && \ - tar xvf libmicrohttpd-0.9.76.tar.gz && \ - cd libmicrohttpd-0.9.76 && \ + curl -kOL https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz && \ + tar xvf libmicrohttpd-1.0.1.tar.gz && \ + cd libmicrohttpd-1.0.1 && \ ./configure --disable-messages --disable-postprocessor --disable-dauth && \ make && \ echo =====================MARK2 && \ @@ -74,9 +74,9 @@ RUN --mount=type=secret,id=repo_token,dst=/run/secrets/repo_token \ echo =====================MARK3 && \ # Install mosquitto from source cd /opt && \ - curl -kOL https://mosquitto.org/files/source/mosquitto-2.0.15.tar.gz && \ - tar xvf mosquitto-2.0.15.tar.gz && \ - cd mosquitto-2.0.15 && \ + curl -kOL https://mosquitto.org/files/source/mosquitto-2.0.20.tar.gz && \ + tar xvf mosquitto-2.0.20.tar.gz && \ + cd mosquitto-2.0.20 && \ sed -i 's/WITH_CJSON:=yes/WITH_CJSON:=no/g' config.mk && \ sed -i 's/WITH_STATIC_LIBRARIES:=no/WITH_STATIC_LIBRARIES:=yes/g' config.mk && \ sed -i 's/WITH_SHARED_LIBRARIES:=yes/WITH_SHARED_LIBRARIES:=no/g' config.mk && \ @@ -86,9 +86,9 @@ RUN --mount=type=secret,id=repo_token,dst=/run/secrets/repo_token \ #ldconfig && \ # Install mongodb driver from source cd /opt && \ - curl -kOL https://github.com/mongodb/mongo-c-driver/releases/download/1.24.3/mongo-c-driver-1.24.3.tar.gz && \ - tar xfvz mongo-c-driver-1.24.3.tar.gz && \ - cd mongo-c-driver-1.24.3 && \ + curl -kOL https://github.com/mongodb/mongo-c-driver/releases/download/1.29.0/mongo-c-driver-1.29.0.tar.gz && \ + tar xfvz mongo-c-driver-1.29.0.tar.gz && \ + cd mongo-c-driver-1.29.0 && \ mkdir cmake-build && \ cd cmake-build && \ # Different from ci/deb/build-dep.sh and build from source documentation, we add here also @@ -124,14 +124,14 @@ RUN --mount=type=secret,id=repo_token,dst=/run/secrets/repo_token \ # cleanup sources, dev tools and locales to reduce the final image size # FIXME: this could need more tunning. Have a look to old CentOS Docerkile and try to # reproduce the same steps - rm -rf /opt/libmicrohttpd-0.9.76.tar.gz \ + rm -rf /opt/libmicrohttpd-1.0.1.tar.gz \ /usr/local/include/microhttpd.h \ /usr/local/lib/libmicrohttpd.* \ - /opt/libmicrohttpd-0.9.76 \ - /opt/mosquitto-2.0.15.tar.gz \ - /opt/mosquitto-2.0.15 \ - /opt/mongo-c-driver-1.24.3.tar.gz \ - /opt/mongo-c-driver-1.24.3 \ + /opt/libmicrohttpd-1.0.1 \ + /opt/mosquitto-2.0.20.tar.gz \ + /opt/mosquitto-2.0.20 \ + /opt/mongo-c-driver-1.29.0.tar.gz \ + /opt/mongo-c-driver-1.29.0 \ /usr/local/include/mongo \ /usr/local/lib/libmongoclient.a \ /usr/local/lib/libcjexl.a \ From f3aec72ddd42483d5f41977c7749749eda7ab320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Thu, 7 Nov 2024 19:15:19 +0100 Subject: [PATCH 17/17] ADD codeql.yml GitAction --- .github/workflows/codeql.yml | 135 +++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000000..a0a1f80e32 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,135 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL Advanced" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + schedule: + - cron: '33 5 * * 1' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners (GitHub.com only) + # Consider using larger runners or machines with greater resources for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + permissions: + # required for all workflows + security-events: write + + # required to fetch internal or private CodeQL packs + packages: read + + # only required for workflows in private repositories + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: c-cpp + build-mode: manual + - language: go + build-mode: autobuild + - language: javascript-typescript + build-mode: none + - language: python + build-mode: none + # CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' + # Use `c-cpp` to analyze code written in C, C++ or both + # Use 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both + # To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, + # see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. + # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how + # your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + # If the analyze step fails for one of the languages you are analyzing with + # "We were unable to automatically build your code", modify the matrix above + # to set the build mode to "manual" for that language. Then modify this step + # to build your code. + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - if: matrix.build-mode == 'manual' + shell: bash + run: | + # Ref: https://github.com/telefonicaid/fiware-orion/blob/master/doc/manuals/admin/build_source.md#debian-12-officially-supported + # Ref: https://github.com/telefonicaid/fiware-orion/blob/master/docker/Dockerfile + export ORION_SRC=$(pwd) + # Install dependencies + sudo apt-get install make cmake g++ libssl-dev libcurl4-openssl-dev libboost-dev libboost-regex-dev libboost-filesystem-dev libboost-thread-dev uuid-dev libgnutls28-dev libsasl2-dev libgcrypt-dev + # Install libmicrohttpd from source + cd /opt + curl -kOL https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-1.0.1.tar.gz + tar xvf libmicrohttpd-1.0.1.tar.gz + cd libmicrohttpd-1.0.1 + ./configure --disable-messages --disable-postprocessor --disable-dauth + make + sudo make install + sudo ldconfig + # Install mosquitto from source + cd /opt + curl -kOL https://mosquitto.org/files/source/mosquitto-2.0.20.tar.gz + tar xvf mosquitto-2.0.20.tar.gz + cd mosquitto-2.0.20 + sed -i 's/WITH_CJSON:=yes/WITH_CJSON:=no/g' config.mk + sed -i 's/WITH_STATIC_LIBRARIES:=no/WITH_STATIC_LIBRARIES:=yes/g' config.mk + sed -i 's/WITH_SHARED_LIBRARIES:=yes/WITH_SHARED_LIBRARIES:=no/g' config.mk + make + sudo make install + sudo ldconfig + # Install mongodb driver from source + cd /opt + curl -kOL https://github.com/mongodb/mongo-c-driver/releases/download/1.29.0/mongo-c-driver-1.29.0.tar.gz + tar xfvz mongo-c-driver-1.29.0.tar.gz + cd mongo-c-driver-1.29.0 + mkdir cmake-build + cd cmake-build + cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DMONGOC_TEST_USE_CRYPT_SHARED=FALSE .. + make + sudo make install + # Install rapidjson from source + cd /opt && \ + curl -kOL https://github.com/miloyip/rapidjson/archive/v1.1.0.tar.gz + tar xfz v1.1.0.tar.gz + sudo mv rapidjson-1.1.0/include/rapidjson/ /usr/local/include + # Build orion + cd $ORION_SRC + make + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}"