mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(Wait Node): Authentication fix (#10236)
This commit is contained in:
@@ -140,8 +140,11 @@ const checkResponseModeConfiguration = (context: IWebhookFunctions) => {
|
||||
}
|
||||
};
|
||||
|
||||
export async function formWebhook(context: IWebhookFunctions) {
|
||||
const nodeVersion = context.getNode().typeVersion;
|
||||
export async function formWebhook(
|
||||
context: IWebhookFunctions,
|
||||
authProperty = FORM_TRIGGER_AUTHENTICATION_PROPERTY,
|
||||
) {
|
||||
const node = context.getNode();
|
||||
const options = context.getNodeParameter('options', {}) as {
|
||||
ignoreBots?: boolean;
|
||||
respondWithOptions?: {
|
||||
@@ -159,9 +162,10 @@ export async function formWebhook(context: IWebhookFunctions) {
|
||||
const req = context.getRequestObject();
|
||||
|
||||
try {
|
||||
if (options.ignoreBots && isbot(req.headers['user-agent']))
|
||||
if (options.ignoreBots && isbot(req.headers['user-agent'])) {
|
||||
throw new WebhookAuthorizationError(403);
|
||||
await validateWebhookAuthentication(context, FORM_TRIGGER_AUTHENTICATION_PROPERTY);
|
||||
}
|
||||
await validateWebhookAuthentication(context, authProperty);
|
||||
} catch (error) {
|
||||
if (error instanceof WebhookAuthorizationError) {
|
||||
res.writeHead(error.responseCode, { 'WWW-Authenticate': 'Basic realm="Webhook"' });
|
||||
@@ -310,7 +314,7 @@ export async function formWebhook(context: IWebhookFunctions) {
|
||||
|
||||
let { useWorkflowTimezone } = options;
|
||||
|
||||
if (useWorkflowTimezone === undefined && nodeVersion > 2) {
|
||||
if (useWorkflowTimezone === undefined && node.typeVersion > 2) {
|
||||
useWorkflowTimezone = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user