mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Bugfix/update nodevm sandbox options, sanitize tablename (#3818)
* update nodevm sandbox options, sanitize tablename * sanitize file name when getFileFromStorage
This commit is contained in:
@@ -28,13 +28,25 @@ export abstract class VectorStoreDriver {
|
||||
}
|
||||
|
||||
getTableName() {
|
||||
return getTableName(this.nodeData)
|
||||
return this.sanitizeTableName(getTableName(this.nodeData))
|
||||
}
|
||||
|
||||
getEmbeddings() {
|
||||
return this.nodeData.inputs?.embeddings as Embeddings
|
||||
}
|
||||
|
||||
sanitizeTableName(tableName: string): string {
|
||||
// Trim and normalize case, turn whitespace into underscores
|
||||
tableName = tableName.trim().toLowerCase().replace(/\s+/g, '_')
|
||||
|
||||
// Validate using a regex (alphanumeric and underscores only)
|
||||
if (!/^[a-zA-Z0-9_]+$/.test(tableName)) {
|
||||
throw new Error('Invalid table name')
|
||||
}
|
||||
|
||||
return tableName
|
||||
}
|
||||
|
||||
async getCredentials() {
|
||||
const credentialData = await getCredentialData(this.nodeData.credential ?? '', this.options)
|
||||
const user = getCredentialParam('user', credentialData, this.nodeData, process.env.POSTGRES_VECTORSTORE_USER)
|
||||
|
||||
Reference in New Issue
Block a user