@xyne/workflow-sdk 3.2.29 → 3.2.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/agents/agent-step.d.ts +9 -3
  2. package/dist/agents/agent-step.d.ts.map +1 -1
  3. package/dist/agents/agent-step.js +11 -9
  4. package/dist/agents/agent-step.js.map +1 -1
  5. package/dist/agents/citation-resolve.d.ts.map +1 -1
  6. package/dist/agents/citation-resolve.js +2 -2
  7. package/dist/agents/citation-resolve.js.map +1 -1
  8. package/dist/client/index.d.ts +1 -1
  9. package/dist/client/index.d.ts.map +1 -1
  10. package/dist/client/types.d.ts +35 -17
  11. package/dist/client/types.d.ts.map +1 -1
  12. package/dist/client/workflow-client.d.ts.map +1 -1
  13. package/dist/client/workflow-client.js +24 -13
  14. package/dist/client/workflow-client.js.map +1 -1
  15. package/dist/common/citation-ref.d.ts +32 -21
  16. package/dist/common/citation-ref.d.ts.map +1 -1
  17. package/dist/common/citation-ref.js +40 -27
  18. package/dist/common/citation-ref.js.map +1 -1
  19. package/dist/common/credentials.d.ts +258 -0
  20. package/dist/common/credentials.d.ts.map +1 -0
  21. package/dist/common/credentials.js +176 -0
  22. package/dist/common/credentials.js.map +1 -0
  23. package/dist/common/expression-eval.d.ts +35 -0
  24. package/dist/common/expression-eval.d.ts.map +1 -0
  25. package/dist/common/expression-eval.js +214 -0
  26. package/dist/common/expression-eval.js.map +1 -0
  27. package/dist/common/index.d.ts +7 -1
  28. package/dist/common/index.d.ts.map +1 -1
  29. package/dist/common/index.js +19 -1
  30. package/dist/common/index.js.map +1 -1
  31. package/dist/common/principal.d.ts +45 -0
  32. package/dist/common/principal.d.ts.map +1 -0
  33. package/dist/common/principal.js +9 -0
  34. package/dist/common/principal.js.map +1 -0
  35. package/dist/engine/workflow-executor.d.ts.map +1 -1
  36. package/dist/engine/workflow-executor.js +24 -9
  37. package/dist/engine/workflow-executor.js.map +1 -1
  38. package/dist/index.d.ts +4 -2
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/persistence/in-memory-adapter.d.ts +93 -29
  43. package/dist/persistence/in-memory-adapter.d.ts.map +1 -1
  44. package/dist/persistence/in-memory-adapter.js +171 -52
  45. package/dist/persistence/in-memory-adapter.js.map +1 -1
  46. package/dist/persistence/types.d.ts +84 -26
  47. package/dist/persistence/types.d.ts.map +1 -1
  48. package/dist/router/workflow-router.d.ts +3 -1
  49. package/dist/router/workflow-router.d.ts.map +1 -1
  50. package/dist/router/workflow-router.js +218 -40
  51. package/dist/router/workflow-router.js.map +1 -1
  52. package/dist/runtime/workflow-runtime.d.ts +22 -30
  53. package/dist/runtime/workflow-runtime.d.ts.map +1 -1
  54. package/dist/runtime/workflow-runtime.js +46 -54
  55. package/dist/runtime/workflow-runtime.js.map +1 -1
  56. package/dist/steps/base-step.d.ts +12 -26
  57. package/dist/steps/base-step.d.ts.map +1 -1
  58. package/dist/steps/base-step.js +2 -4
  59. package/dist/steps/base-step.js.map +1 -1
  60. package/dist/steps/builtin/code.step.d.ts +7 -3
  61. package/dist/steps/builtin/code.step.d.ts.map +1 -1
  62. package/dist/steps/builtin/code.step.js +77 -47
  63. package/dist/steps/builtin/code.step.js.map +1 -1
  64. package/dist/steps/builtin/http-request.step.d.ts +18 -264
  65. package/dist/steps/builtin/http-request.step.d.ts.map +1 -1
  66. package/dist/steps/builtin/http-request.step.js +48 -157
  67. package/dist/steps/builtin/http-request.step.js.map +1 -1
  68. package/dist/steps/builtin/ssrf-guard.d.ts +9 -0
  69. package/dist/steps/builtin/ssrf-guard.d.ts.map +1 -0
  70. package/dist/steps/builtin/ssrf-guard.js +115 -0
  71. package/dist/steps/builtin/ssrf-guard.js.map +1 -0
  72. package/dist/steps/builtin/switch.step.d.ts +14 -14
  73. package/dist/steps/builtin/transform.step.d.ts +247 -0
  74. package/dist/steps/builtin/transform.step.d.ts.map +1 -0
  75. package/dist/steps/builtin/transform.step.js +135 -0
  76. package/dist/steps/builtin/transform.step.js.map +1 -0
  77. package/dist/steps/builtin/wait.step.d.ts +56 -56
  78. package/dist/steps/step-registry.d.ts +1 -3
  79. package/dist/steps/step-registry.d.ts.map +1 -1
  80. package/dist/steps/step-registry.js +0 -1
  81. package/dist/steps/step-registry.js.map +1 -1
  82. package/dist/testing/index.d.ts +1 -1
  83. package/dist/testing/index.d.ts.map +1 -1
  84. package/dist/testing/index.js +1 -1
  85. package/dist/testing/index.js.map +1 -1
  86. package/dist/testing/mock-step-context.d.ts +7 -2
  87. package/dist/testing/mock-step-context.d.ts.map +1 -1
  88. package/dist/testing/mock-step-context.js +9 -1
  89. package/dist/testing/mock-step-context.js.map +1 -1
  90. package/dist/triggers/webhook-trigger.d.ts +1 -5
  91. package/dist/triggers/webhook-trigger.d.ts.map +1 -1
  92. package/dist/triggers/webhook-trigger.js.map +1 -1
  93. package/dist/types/attachment.d.ts +23 -0
  94. package/dist/types/attachment.d.ts.map +1 -0
  95. package/dist/types/attachment.js +2 -0
  96. package/dist/types/attachment.js.map +1 -0
  97. package/dist/types/resume-payload.d.ts +34 -0
  98. package/dist/types/resume-payload.d.ts.map +1 -0
  99. package/dist/types/resume-payload.js +12 -0
  100. package/dist/types/resume-payload.js.map +1 -0
  101. package/dist/util/executable-check.d.ts +42 -0
  102. package/dist/util/executable-check.d.ts.map +1 -0
  103. package/dist/util/executable-check.js +115 -0
  104. package/dist/util/executable-check.js.map +1 -0
  105. package/package.json +2 -2
  106. package/dist/authz/principal-field.d.ts +0 -23
  107. package/dist/authz/principal-field.d.ts.map +0 -1
  108. package/dist/authz/principal-field.js +0 -34
  109. package/dist/authz/principal-field.js.map +0 -1
@@ -19,14 +19,11 @@
19
19
  *
20
20
  * ## Auth
21
21
  *
22
- * Two auth mechanisms, used together or independently:
23
- *
24
- * 1. **Config-level `auth`** for tokens from variable refs
25
- * `{{ steps.login.output.token }}`. Fully typed discriminated union.
26
- *
27
- * 2. **Credential slots** — for stored secrets from the credential vault.
28
- * Resolved by the executor at runtime, injected via `ctx.credentials`.
29
- * Config-level auth takes precedence when both are present.
22
+ * The optional `credentialName` selects a stored credential from the vault.
23
+ * Before this step runs, the executor resolves that selection and injects the
24
+ * validated value through `ctx.credentials`. The step
25
+ * receives the resolved value and applies it after user-provided headers, so
26
+ * managed authentication cannot be accidentally overridden.
30
27
  *
31
28
  * ## Response shape
32
29
  *
@@ -43,65 +40,9 @@
43
40
  */
44
41
  import { z } from 'zod';
45
42
  import { BaseActionStep } from '../base-step.js';
46
- import type { StepExecutionContext, CredentialSlot, CredentialTypeSchema } from '../base-step.js';
43
+ import type { StepExecutionContext } from '../base-step.js';
47
44
  import { BuiltinStepType } from '../../types/known-types.js';
48
45
  import type { StepCategory } from '../../types/categories.js';
49
- declare const HttpAuthSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
50
- type: z.ZodLiteral<"none">;
51
- }, "strip", z.ZodTypeAny, {
52
- type: "none";
53
- }, {
54
- type: "none";
55
- }>, z.ZodObject<{
56
- type: z.ZodLiteral<"bearer">;
57
- token: z.ZodString;
58
- }, "strip", z.ZodTypeAny, {
59
- type: "bearer";
60
- token: string;
61
- }, {
62
- type: "bearer";
63
- token: string;
64
- }>, z.ZodObject<{
65
- type: z.ZodLiteral<"basic">;
66
- username: z.ZodString;
67
- password: z.ZodString;
68
- }, "strip", z.ZodTypeAny, {
69
- type: "basic";
70
- password: string;
71
- username: string;
72
- }, {
73
- type: "basic";
74
- password: string;
75
- username: string;
76
- }>, z.ZodObject<{
77
- type: z.ZodLiteral<"apiKey">;
78
- key: z.ZodString;
79
- name: z.ZodDefault<z.ZodString>;
80
- in: z.ZodDefault<z.ZodEnum<["header", "query"]>>;
81
- }, "strip", z.ZodTypeAny, {
82
- type: "apiKey";
83
- name: string;
84
- key: string;
85
- in: "header" | "query";
86
- }, {
87
- type: "apiKey";
88
- key: string;
89
- name?: string | undefined;
90
- in?: "header" | "query" | undefined;
91
- }>, z.ZodObject<{
92
- type: z.ZodLiteral<"customHeader">;
93
- name: z.ZodString;
94
- value: z.ZodString;
95
- }, "strip", z.ZodTypeAny, {
96
- value: string;
97
- type: "customHeader";
98
- name: string;
99
- }, {
100
- value: string;
101
- type: "customHeader";
102
- name: string;
103
- }>]>;
104
- export type HttpAuth = z.infer<typeof HttpAuthSchema>;
105
46
  export declare const HttpRawContentTypeSchema: z.ZodEnum<["json", "xml", "html", "text", "javascript", "custom"]>;
106
47
  export type HttpRawContentType = z.infer<typeof HttpRawContentTypeSchema>;
107
48
  export declare const HttpBodySchema: z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
@@ -322,61 +263,7 @@ export type HttpMethod = z.infer<typeof HttpMethodSchema>;
322
263
  export declare const HttpRequestStepConfigSchema: z.ZodObject<{
323
264
  url: z.ZodString;
324
265
  method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>>;
325
- auth: z.ZodDefault<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
326
- type: z.ZodLiteral<"none">;
327
- }, "strip", z.ZodTypeAny, {
328
- type: "none";
329
- }, {
330
- type: "none";
331
- }>, z.ZodObject<{
332
- type: z.ZodLiteral<"bearer">;
333
- token: z.ZodString;
334
- }, "strip", z.ZodTypeAny, {
335
- type: "bearer";
336
- token: string;
337
- }, {
338
- type: "bearer";
339
- token: string;
340
- }>, z.ZodObject<{
341
- type: z.ZodLiteral<"basic">;
342
- username: z.ZodString;
343
- password: z.ZodString;
344
- }, "strip", z.ZodTypeAny, {
345
- type: "basic";
346
- password: string;
347
- username: string;
348
- }, {
349
- type: "basic";
350
- password: string;
351
- username: string;
352
- }>, z.ZodObject<{
353
- type: z.ZodLiteral<"apiKey">;
354
- key: z.ZodString;
355
- name: z.ZodDefault<z.ZodString>;
356
- in: z.ZodDefault<z.ZodEnum<["header", "query"]>>;
357
- }, "strip", z.ZodTypeAny, {
358
- type: "apiKey";
359
- name: string;
360
- key: string;
361
- in: "header" | "query";
362
- }, {
363
- type: "apiKey";
364
- key: string;
365
- name?: string | undefined;
366
- in?: "header" | "query" | undefined;
367
- }>, z.ZodObject<{
368
- type: z.ZodLiteral<"customHeader">;
369
- name: z.ZodString;
370
- value: z.ZodString;
371
- }, "strip", z.ZodTypeAny, {
372
- value: string;
373
- type: "customHeader";
374
- name: string;
375
- }, {
376
- value: string;
377
- type: "customHeader";
378
- name: string;
379
- }>]>>;
266
+ credentialName: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodString]>>;
380
267
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
381
268
  queryParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
382
269
  body: z.ZodDefault<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
@@ -629,28 +516,9 @@ export declare const HttpRequestStepConfigSchema: z.ZodObject<{
629
516
  }[] | undefined;
630
517
  }[] | undefined;
631
518
  };
632
- timeoutMs: number;
633
519
  url: string;
520
+ timeoutMs: number;
634
521
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
635
- auth: {
636
- type: "none";
637
- } | {
638
- type: "bearer";
639
- token: string;
640
- } | {
641
- type: "basic";
642
- password: string;
643
- username: string;
644
- } | {
645
- type: "apiKey";
646
- name: string;
647
- key: string;
648
- in: "header" | "query";
649
- } | {
650
- value: string;
651
- type: "customHeader";
652
- name: string;
653
- };
654
522
  response: {
655
523
  type: "json";
656
524
  bodySchema?: Record<string, unknown> | undefined;
@@ -666,6 +534,7 @@ export declare const HttpRequestStepConfigSchema: z.ZodObject<{
666
534
  };
667
535
  followRedirects: boolean;
668
536
  headers?: Record<string, string> | undefined;
537
+ credentialName?: string | undefined;
669
538
  queryParams?: Record<string, string> | undefined;
670
539
  }, {
671
540
  url: string;
@@ -709,25 +578,7 @@ export declare const HttpRequestStepConfigSchema: z.ZodObject<{
709
578
  } | undefined;
710
579
  timeoutMs?: number | undefined;
711
580
  method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | undefined;
712
- auth?: {
713
- type: "none";
714
- } | {
715
- type: "bearer";
716
- token: string;
717
- } | {
718
- type: "basic";
719
- password: string;
720
- username: string;
721
- } | {
722
- type: "apiKey";
723
- key: string;
724
- name?: string | undefined;
725
- in?: "header" | "query" | undefined;
726
- } | {
727
- value: string;
728
- type: "customHeader";
729
- name: string;
730
- } | undefined;
581
+ credentialName?: string | undefined;
731
582
  queryParams?: Record<string, string> | undefined;
732
583
  response?: {
733
584
  type: "json";
@@ -777,61 +628,7 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
777
628
  readonly configSchema: z.ZodObject<{
778
629
  url: z.ZodString;
779
630
  method: z.ZodDefault<z.ZodEnum<["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>>;
780
- auth: z.ZodDefault<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
781
- type: z.ZodLiteral<"none">;
782
- }, "strip", z.ZodTypeAny, {
783
- type: "none";
784
- }, {
785
- type: "none";
786
- }>, z.ZodObject<{
787
- type: z.ZodLiteral<"bearer">;
788
- token: z.ZodString;
789
- }, "strip", z.ZodTypeAny, {
790
- type: "bearer";
791
- token: string;
792
- }, {
793
- type: "bearer";
794
- token: string;
795
- }>, z.ZodObject<{
796
- type: z.ZodLiteral<"basic">;
797
- username: z.ZodString;
798
- password: z.ZodString;
799
- }, "strip", z.ZodTypeAny, {
800
- type: "basic";
801
- password: string;
802
- username: string;
803
- }, {
804
- type: "basic";
805
- password: string;
806
- username: string;
807
- }>, z.ZodObject<{
808
- type: z.ZodLiteral<"apiKey">;
809
- key: z.ZodString;
810
- name: z.ZodDefault<z.ZodString>;
811
- in: z.ZodDefault<z.ZodEnum<["header", "query"]>>;
812
- }, "strip", z.ZodTypeAny, {
813
- type: "apiKey";
814
- name: string;
815
- key: string;
816
- in: "header" | "query";
817
- }, {
818
- type: "apiKey";
819
- key: string;
820
- name?: string | undefined;
821
- in?: "header" | "query" | undefined;
822
- }>, z.ZodObject<{
823
- type: z.ZodLiteral<"customHeader">;
824
- name: z.ZodString;
825
- value: z.ZodString;
826
- }, "strip", z.ZodTypeAny, {
827
- value: string;
828
- type: "customHeader";
829
- name: string;
830
- }, {
831
- value: string;
832
- type: "customHeader";
833
- name: string;
834
- }>]>>;
631
+ credentialName: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodString]>>;
835
632
  headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
836
633
  queryParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
837
634
  body: z.ZodDefault<z.ZodDiscriminatedUnion<"mode", [z.ZodObject<{
@@ -1084,28 +881,9 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
1084
881
  }[] | undefined;
1085
882
  }[] | undefined;
1086
883
  };
1087
- timeoutMs: number;
1088
884
  url: string;
885
+ timeoutMs: number;
1089
886
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
1090
- auth: {
1091
- type: "none";
1092
- } | {
1093
- type: "bearer";
1094
- token: string;
1095
- } | {
1096
- type: "basic";
1097
- password: string;
1098
- username: string;
1099
- } | {
1100
- type: "apiKey";
1101
- name: string;
1102
- key: string;
1103
- in: "header" | "query";
1104
- } | {
1105
- value: string;
1106
- type: "customHeader";
1107
- name: string;
1108
- };
1109
887
  response: {
1110
888
  type: "json";
1111
889
  bodySchema?: Record<string, unknown> | undefined;
@@ -1121,6 +899,7 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
1121
899
  };
1122
900
  followRedirects: boolean;
1123
901
  headers?: Record<string, string> | undefined;
902
+ credentialName?: string | undefined;
1124
903
  queryParams?: Record<string, string> | undefined;
1125
904
  }, {
1126
905
  url: string;
@@ -1164,25 +943,7 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
1164
943
  } | undefined;
1165
944
  timeoutMs?: number | undefined;
1166
945
  method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | undefined;
1167
- auth?: {
1168
- type: "none";
1169
- } | {
1170
- type: "bearer";
1171
- token: string;
1172
- } | {
1173
- type: "basic";
1174
- password: string;
1175
- username: string;
1176
- } | {
1177
- type: "apiKey";
1178
- key: string;
1179
- name?: string | undefined;
1180
- in?: "header" | "query" | undefined;
1181
- } | {
1182
- value: string;
1183
- type: "customHeader";
1184
- name: string;
1185
- } | undefined;
946
+ credentialName?: string | undefined;
1186
947
  queryParams?: Record<string, string> | undefined;
1187
948
  response?: {
1188
949
  type: "json";
@@ -1229,13 +990,10 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
1229
990
  }>;
1230
991
  readonly category: StepCategory;
1231
992
  readonly icon = "globe";
1232
- /**
1233
- * Credential slots — fallback auth when config.auth is 'none'.
1234
- * Resolved by the executor from the credential vault.
1235
- */
1236
- readonly credentialSlots: readonly CredentialSlot[];
1237
- /** Credential type schemas — defines what fields each credential type needs for UI forms. */
1238
- readonly credentialTypeSchemas: readonly CredentialTypeSchema[];
993
+ readonly credentialSlots: readonly [{
994
+ readonly name: "credentialName";
995
+ readonly required: false;
996
+ }];
1239
997
  decorateConfigSchema(jsonSchema: Record<string, unknown>): Record<string, unknown>;
1240
998
  /**
1241
999
  * Per-instance output schema. When the author's `response` config provides
@@ -1248,9 +1006,6 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
1248
1006
  redactInput(input: Record<string, unknown>): Record<string, unknown>;
1249
1007
  execute(config: HttpRequestStepConfig, ctx: StepExecutionContext): Promise<HttpRequestStepOutput>;
1250
1008
  private buildUrl;
1251
- private applyAuth;
1252
- private applyConfigAuth;
1253
- private applyCredentialAuth;
1254
1009
  /**
1255
1010
  * Encode the request body for the given mode. Mutates `headers` to set
1256
1011
  * the appropriate Content-Type unless the user already supplied one.
@@ -1262,5 +1017,4 @@ export declare class HttpRequestStep extends BaseActionStep<typeof HttpRequestSt
1262
1017
  private parseResponseBody;
1263
1018
  private autoParseBody;
1264
1019
  }
1265
- export {};
1266
1020
  //# sourceMappingURL=http-request.step.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-request.step.d.ts","sourceRoot":"","sources":["../../../src/steps/builtin/http-request.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAiC9D,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAMlB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAYtD,eAAO,MAAM,wBAAwB,oEAOnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AA0C1E,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKzB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AA2BtD,eAAO,MAA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;;;OAKG;IACM,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAsB1F,OAAO,CAAC,mBAAmB;IAkBlB,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAkB9D,OAAO,CACpB,MAAM,EAAE,qBAAqB,EAC7B,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,qBAAqB,CAAC;IAuHjC,OAAO,CAAC,QAAQ;IAehB;;;;;OAKG;YACW,UAAU;IA+DxB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,aAAa;CAiBtB"}
@@ -19,14 +19,11 @@
19
19
  *
20
20
  * ## Auth
21
21
  *
22
- * Two auth mechanisms, used together or independently:
23
- *
24
- * 1. **Config-level `auth`** for tokens from variable refs
25
- * `{{ steps.login.output.token }}`. Fully typed discriminated union.
26
- *
27
- * 2. **Credential slots** — for stored secrets from the credential vault.
28
- * Resolved by the executor at runtime, injected via `ctx.credentials`.
29
- * Config-level auth takes precedence when both are present.
22
+ * The optional `credentialName` selects a stored credential from the vault.
23
+ * Before this step runs, the executor resolves that selection and injects the
24
+ * validated value through `ctx.credentials`. The step
25
+ * receives the resolved value and applies it after user-provided headers, so
26
+ * managed authentication cannot be accidentally overridden.
30
27
  *
31
28
  * ## Response shape
32
29
  *
@@ -44,38 +41,10 @@
44
41
  import { z } from 'zod';
45
42
  import { BaseActionStep } from '../base-step.js';
46
43
  import { BuiltinStepType } from '../../types/known-types.js';
44
+ import { applyResolvedCredentialAuth, CredentialNameSchema, } from '../../common/credentials.js';
47
45
  import { AttachmentSchema, markAttachmentFields } from '../../common/attachment.js';
48
46
  import { variableRef } from '../../types/workflow-config.js';
49
- // ─── Auth schemas ───
50
- const HttpAuthNoneSchema = z.object({ type: z.literal('none') });
51
- const HttpAuthBearerSchema = z.object({
52
- type: z.literal('bearer'),
53
- token: z.string().min(1).describe('Bearer token value'),
54
- });
55
- const HttpAuthBasicSchema = z.object({
56
- type: z.literal('basic'),
57
- username: z.string().describe('Basic auth username'),
58
- password: z.string().describe('Basic auth password'),
59
- });
60
- const HttpAuthApiKeySchema = z.object({
61
- type: z.literal('apiKey'),
62
- key: z.string().min(1).describe('API key value'),
63
- name: z.string().default('x-api-key').describe('Header or query parameter name'),
64
- in: z.enum(['header', 'query']).default('header').describe('Where to send the API key'),
65
- });
66
- const HttpAuthCustomHeaderSchema = z.object({
67
- type: z.literal('customHeader'),
68
- name: z.string().min(1).describe('Custom header name'),
69
- value: z.string().min(1).describe('Custom header value'),
70
- });
71
- const HttpAuthSchema = z.discriminatedUnion('type', [
72
- HttpAuthNoneSchema,
73
- HttpAuthBearerSchema,
74
- HttpAuthBasicSchema,
75
- HttpAuthApiKeySchema,
76
- HttpAuthCustomHeaderSchema,
77
- ]);
78
- // ─── Body schemas (Postman-style) ───
47
+ import { assertPublicHttpUrl } from './ssrf-guard.js';
79
48
  const RAW_CONTENT_TYPES = {
80
49
  json: 'application/json',
81
50
  xml: 'application/xml',
@@ -165,7 +134,7 @@ export const HttpMethodSchema = z.enum([
165
134
  export const HttpRequestStepConfigSchema = z.object({
166
135
  url: z.string().min(1).describe('Full URL including protocol (e.g. https://api.example.com/data)'),
167
136
  method: HttpMethodSchema.default('GET').describe('HTTP method'),
168
- auth: HttpAuthSchema.default({ type: 'none' }).describe('Authentication method applied before custom headers'),
137
+ credentialName: variableRef(CredentialNameSchema.describe('Credential from the vault used to authenticate the request. The executor resolves it before this step runs.')).optional(),
169
138
  headers: z.record(z.string(), z.string()).optional().describe('Request headers as key-value pairs'),
170
139
  queryParams: z.record(z.string(), z.string()).optional().describe('Query parameters appended to URL'),
171
140
  body: HttpBodySchema.default({ mode: 'none' }).describe('Request body — ignored for GET/HEAD. Postman-style modes: none/raw/urlencoded/formdata/binary'),
@@ -193,49 +162,20 @@ export class HttpRequestStep extends BaseActionStep {
193
162
  outputSchema = HttpRequestStepOutputSchema;
194
163
  category = 'integration';
195
164
  icon = 'globe';
196
- /**
197
- * Credential slots fallback auth when config.auth is 'none'.
198
- * Resolved by the executor from the credential vault.
199
- */
165
+ // The slot name is also the config field: the executor reads the selected
166
+ // name from `config.credentialName` and injects the resolved, validated value
167
+ // as `ctx.credentials.credentialName` before execute() is called.
200
168
  credentialSlots = [
201
- { name: 'auth', types: ['bearer', 'basic', 'api_key', 'header'], required: false },
202
- ];
203
- /** Credential type schemas — defines what fields each credential type needs for UI forms. */
204
- credentialTypeSchemas = [
205
- {
206
- type: 'bearer',
207
- label: 'Bearer Token',
208
- fields: [
209
- { name: 'token', label: 'Token', type: 'password', required: true },
210
- ],
211
- },
212
- {
213
- type: 'basic',
214
- label: 'Basic Auth',
215
- fields: [
216
- { name: 'username', label: 'Username', type: 'string', required: true },
217
- { name: 'password', label: 'Password', type: 'password', required: true },
218
- ],
219
- },
220
- {
221
- type: 'api_key',
222
- label: 'API Key',
223
- fields: [
224
- { name: 'key', label: 'API Key', type: 'password', required: true },
225
- { name: 'headerName', label: 'Header Name', type: 'string', required: false, default: 'x-api-key' },
226
- { name: 'in', label: 'Send In', type: 'select', required: false, options: ['header', 'query'], default: 'header' },
227
- ],
228
- },
229
- {
230
- type: 'header',
231
- label: 'Custom Header',
232
- fields: [
233
- { name: 'name', label: 'Header Name', type: 'string', required: true },
234
- { name: 'value', label: 'Header Value', type: 'password', required: true },
235
- ],
236
- },
169
+ { name: 'credentialName', required: false },
237
170
  ];
238
171
  decorateConfigSchema(jsonSchema) {
172
+ const rootProps = jsonSchema['properties'];
173
+ if (rootProps?.['credentialName']) {
174
+ rootProps['credentialName'] = {
175
+ ...rootProps['credentialName'],
176
+ format: 'credential-name',
177
+ };
178
+ }
239
179
  // The `bodySchema` field inside the discriminated `response` union should
240
180
  // render with the JSON Schema builder UI. The schema-form renderer walks
241
181
  // discriminator variants, so we tag the field within each variant that
@@ -329,19 +269,26 @@ export class HttpRequestStep extends BaseActionStep {
329
269
  async execute(config, ctx) {
330
270
  // Build URL with query params
331
271
  const url = this.buildUrl(config.url, config.queryParams);
332
- // Build headers: auth first, then custom headers override
272
+ // Build headers: user headers FIRST, then managed credential auth LAST — so
273
+ // a conflicting manually-entered header can't override the selected
274
+ // credential's authentication.
333
275
  const headers = new Headers();
334
- this.applyAuth(headers, url, config.auth, ctx.credentials);
335
276
  if (config.headers) {
336
277
  for (const [k, v] of Object.entries(config.headers)) {
337
278
  headers.set(k, v);
338
279
  }
339
280
  }
340
- // Build request
281
+ const credential = ctx.credentials['credentialName'];
282
+ if (credential) {
283
+ applyResolvedCredentialAuth(headers, credential);
284
+ }
285
+ // Build request. Redirects are followed manually (redirect: 'manual') so the
286
+ // SSRF guard re-checks every hop — native 'follow' would chase a redirect
287
+ // straight to a private / cloud-metadata address.
341
288
  const init = {
342
289
  method: config.method,
343
290
  headers,
344
- redirect: config.followRedirects ? 'follow' : 'manual',
291
+ redirect: 'manual',
345
292
  };
346
293
  // Encode body for methods that support it.
347
294
  // GET/HEAD never carry a body even if the user configured one.
@@ -355,10 +302,27 @@ export class HttpRequestStep extends BaseActionStep {
355
302
  const controller = new AbortController();
356
303
  const timer = setTimeout(() => controller.abort(), config.timeoutMs);
357
304
  init.signal = controller.signal;
305
+ const maxRedirects = config.followRedirects ? 5 : 0;
358
306
  const t0 = Date.now();
359
307
  let response;
360
308
  try {
361
- response = await fetch(url.toString(), init);
309
+ let currentUrl = url.toString();
310
+ let hops = 0;
311
+ for (;;) {
312
+ // SSRF guard runs on the initial URL and on every redirect target.
313
+ await assertPublicHttpUrl(currentUrl);
314
+ response = await fetch(currentUrl, init);
315
+ const location = response.headers.get('location');
316
+ const isRedirectStatus = response.status >= 300 && response.status < 400;
317
+ if (!isRedirectStatus || location === null || hops >= maxRedirects)
318
+ break;
319
+ hops += 1;
320
+ currentUrl = new URL(location, currentUrl).toString();
321
+ // A one-shot body (multipart/stream) can't be replayed on the next hop.
322
+ if (init.body instanceof FormData || init.body instanceof ReadableStream) {
323
+ init.body = null;
324
+ }
325
+ }
362
326
  }
363
327
  catch (err) {
364
328
  clearTimeout(timer);
@@ -412,79 +376,6 @@ export class HttpRequestStep extends BaseActionStep {
412
376
  }
413
377
  return url;
414
378
  }
415
- // ─── Auth ───
416
- applyAuth(headers, url, auth, credentials) {
417
- // Config-level auth takes precedence
418
- if (auth.type !== 'none') {
419
- this.applyConfigAuth(headers, url, auth);
420
- return;
421
- }
422
- // Fall back to credential slot
423
- this.applyCredentialAuth(headers, url, credentials);
424
- }
425
- applyConfigAuth(headers, url, auth) {
426
- switch (auth.type) {
427
- case 'bearer':
428
- headers.set('authorization', `Bearer ${auth.token}`);
429
- break;
430
- case 'basic': {
431
- const encoded = btoa(`${auth.username}:${auth.password}`);
432
- headers.set('authorization', `Basic ${encoded}`);
433
- break;
434
- }
435
- case 'apiKey':
436
- if (auth.in === 'header') {
437
- headers.set(auth.name, auth.key);
438
- }
439
- else {
440
- url.searchParams.set(auth.name, auth.key);
441
- }
442
- break;
443
- case 'customHeader':
444
- headers.set(auth.name, auth.value);
445
- break;
446
- }
447
- }
448
- applyCredentialAuth(headers, url, credentials) {
449
- const cred = credentials['auth'];
450
- if (!cred)
451
- return;
452
- switch (cred.type) {
453
- case 'bearer': {
454
- const token = cred.data['token'];
455
- if (token)
456
- headers.set('authorization', `Bearer ${token}`);
457
- break;
458
- }
459
- case 'basic': {
460
- const user = cred.data['username'] ?? '';
461
- const pass = cred.data['password'] ?? '';
462
- headers.set('authorization', `Basic ${btoa(`${user}:${pass}`)}`);
463
- break;
464
- }
465
- case 'api_key': {
466
- const headerName = cred.data['headerName'] ?? 'x-api-key';
467
- const key = cred.data['key'];
468
- const location = cred.data['in'] ?? 'header';
469
- if (key) {
470
- if (location === 'query') {
471
- url.searchParams.set(headerName, key);
472
- }
473
- else {
474
- headers.set(headerName, key);
475
- }
476
- }
477
- break;
478
- }
479
- case 'header': {
480
- const name = cred.data['name'];
481
- const value = cred.data['value'];
482
- if (name && value)
483
- headers.set(name, value);
484
- break;
485
- }
486
- }
487
- }
488
379
  // ─── Body encoding (Postman-style modes) ───
489
380
  /**
490
381
  * Encode the request body for the given mode. Mutates `headers` to set