Skip to content

Commit

Permalink
[backend] Temporary remove marking definition restriction for checking
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelHassine committed Oct 23, 2023
1 parent bcdee54 commit c29a69d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
12 changes: 5 additions & 7 deletions opencti-platform/opencti-graphql/src/database/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ import { schemaRelationsRefDefinition } from '../schema/schema-relationsRef';
import { extractSchemaDefFromPath, validateInputCreation, validateInputUpdate } from '../schema/schema-validator';
import { getMandatoryAttributesForSetting } from '../domain/attribute';
import { telemetry } from '../config/tracing';
import { cleanMarkings, handleMarkingOperations } from '../utils/markingDefinition-utils';
import { cleanMarkings } from '../utils/markingDefinition-utils';
import { generateCreateMessage, generateUpdateMessage } from './generate-message';
import { confidence } from '../schema/attribute-definition';

Expand Down Expand Up @@ -1985,14 +1985,12 @@ export const updateAttribute = async (context, user, id, type, inputs, opts = {}
if (relType === RELATION_GRANTED_TO && !isUserHasCapability(user, KNOWLEDGE_ORGANIZATION_RESTRICT)) {
throw ForbiddenAccess();
}

let { value: refs, operation = UPDATE_OPERATION_REPLACE } = meta[metaIndex];

if (relType === RELATION_OBJECT_MARKING) {
const { value: refs, operation = UPDATE_OPERATION_REPLACE } = meta[metaIndex];
// let { value: refs, operation = UPDATE_OPERATION_REPLACE } = meta[metaIndex];
/* if (relType === RELATION_OBJECT_MARKING) {
const markingsCleaned = await handleMarkingOperations(context, initial.objectMarking, refs, operation);
({ operation, refs } = { operation: markingsCleaned.operation, refs: markingsCleaned.refs });
}

} */
if (operation === UPDATE_OPERATION_REPLACE) {
// Delete all relations
const currentRels = await listAllRelations(context, user, relType, { fromId: id });
Expand Down
17 changes: 9 additions & 8 deletions opencti-worker/src/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,24 +274,24 @@ def data_handler( # pylint: disable=too-many-statements, too-many-locals
else:
# Unknown type, just move on.
return True
except Timeout:
error_msg = traceback.format_exc()
except Timeout as ex:
error = str(ex)
bundles_timeout_error_counter.add(1)
self.api.log(
"warning", "A connection timeout occurred: {{ " + error_msg + " }}"
"warning", "A connection timeout occurred: {{ " + error + " }}"
)
time.sleep(30)
# Platform is under heavy load: wait for unlock & retry almost indefinitely.
sleep_jitter = round(random.uniform(10, 30), 2)
time.sleep(sleep_jitter)
self.data_handler(connection, channel, delivery_tag, data)
return True
except RequestException:
error_msg = traceback.format_exc()
except RequestException as ex:
error = str(ex)
bundles_request_error_counter.add(1, {"origin": "opencti-worker"})
self.api.log(
"error", "A connection error occurred: {{ " + error_msg + " }}"
"error", "A connection error occurred: {{ " + error + " }}"
)
time.sleep(60)
self.api.log(
"info",
"Message (delivery_tag="
Expand Down Expand Up @@ -348,11 +348,12 @@ def data_handler( # pylint: disable=too-many-statements, too-many-locals
},
)
return False
elif "ConnectionError" in error_msg:
elif "Bad Gateway" in error_msg:
bundles_bad_gateway_error_counter.add(1)
self.api.log(
"error", "A connection error occurred: {{ " + error + " }}"
)
time.sleep(30)
self.api.log(
"info",
"Message (delivery_tag="
Expand Down

0 comments on commit c29a69d

Please sign in to comment.