fix(core): Validate customData keys and values (#5920) (no-changelog)

* fix(core): Validate customData keys and values

Throws errors in manual mode and ignores and logs values in production

* fix: validate customData key characters

* refactor: review changes

* fix: logger not initialised for metadata tests

* fix: allow numbers for values
This commit is contained in:
Val
2023-04-12 09:18:26 +01:00
committed by GitHub
parent 725393dae6
commit 323e26acfd
3 changed files with 129 additions and 9 deletions

View File

@@ -1653,10 +1653,24 @@ export function getAdditionalKeys(
customData: runExecutionData
? {
set(key: string, value: string): void {
setWorkflowExecutionMetadata(runExecutionData, key, value);
try {
setWorkflowExecutionMetadata(runExecutionData, key, value);
} catch (e) {
if (mode === 'manual') {
throw e;
}
Logger.verbose(e.message);
}
},
setAll(obj: Record<string, string>): void {
setAllWorkflowExecutionMetadata(runExecutionData, obj);
try {
setAllWorkflowExecutionMetadata(runExecutionData, obj);
} catch (e) {
if (mode === 'manual') {
throw e;
}
Logger.verbose(e.message);
}
},
get(key: string): string {
return getWorkflowExecutionMetadata(runExecutionData, key);