Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
msg.updates.forEach(update => {
let source = update.$source
if (!source && update.source) {
source = getSourceId(update.source)
}
if (source) {
update.values.forEach(valuePath => {
if (!pathSources[valuePath.path]) {
pathSources[valuePath.path] = {}
}
if (
!pathSources[valuePath.path][source] ||
pathSources[valuePath.path][source] !== spark
) {
if (pathSources[valuePath.path][source]) {
console.log(
`WARNING: got a new ws client for path ${valuePath.path} source ${source}`
)
}
function addSource(update, tags) {
if ( update['$source'] ) {
tags.source = update['$source']
} else if ( update['source'] ) {
tags.source = getSourceId(update['source'])
}
return tags
}
function ensureHasDollarSource(normalizedDelta) {
let dollarSource = normalizedDelta.$source
if (!dollarSource) {
dollarSource = getSourceId(normalizedDelta.source)
normalizedDelta.$source = dollarSource
}
return dollarSource
}
const notAllowed = delta.updates.find(update => {
let source = update.$source
if (!source) {
source = getSourceId(update.source)
}
return update.values.find(valuePath => {
return (
strategy.checkACL(
req.skPrincipal.identifier,
context,
valuePath.path,
source,
'write'
) === false
)
})
})