runline 0.35.0 → 0.36.0

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 (473) hide show
  1. package/dist/auth/errors.d.ts +3 -3
  2. package/dist/auth/errors.js +3 -3
  3. package/dist/credentials/aws-plugin.d.ts +79 -0
  4. package/dist/credentials/aws-plugin.js +179 -0
  5. package/dist/credentials/aws.d.ts +41 -0
  6. package/dist/credentials/aws.js +213 -0
  7. package/dist/credentials/broker.d.ts +11 -0
  8. package/dist/{plugins/_shared/credentialAdapter.js → credentials/broker.js} +91 -41
  9. package/dist/credentials/plugin.d.ts +255 -0
  10. package/dist/{plugins/_shared/credentials.js → credentials/plugin.js} +11 -10
  11. package/dist/credentials/policy.d.ts +11 -3
  12. package/dist/credentials/policy.js +22 -3
  13. package/dist/credentials/registry.d.ts +14 -0
  14. package/dist/credentials/registry.js +55 -2
  15. package/dist/credentials/sigv4.d.ts +47 -0
  16. package/dist/credentials/sigv4.js +145 -0
  17. package/dist/credentials/transport.d.ts +9 -0
  18. package/dist/credentials/transport.js +106 -26
  19. package/dist/credentials/types.d.ts +63 -4
  20. package/dist/index.d.ts +8 -2
  21. package/dist/index.js +5 -1
  22. package/dist/plugins/_shared/googleAuth.js +3 -5
  23. package/dist/plugins/_shared/googleCredentials.js +1 -2
  24. package/dist/plugins/_shared/mediaFile.js +4 -1
  25. package/dist/plugins/_shared/microsoftAuth.js +3 -5
  26. package/dist/plugins/_shared/microsoftCredentials.js +1 -2
  27. package/dist/plugins/_shared/shiftCloud.js +1 -2
  28. package/dist/plugins/_shared/shiftCredentials.js +1 -2
  29. package/dist/plugins/actionNetwork/src/credentials.js +1 -1
  30. package/dist/plugins/actionNetwork/src/index.js +1 -1
  31. package/dist/plugins/activeCampaign/src/credentials.js +1 -1
  32. package/dist/plugins/activeCampaign/src/index.js +1 -1
  33. package/dist/plugins/adalo/src/credentials.js +1 -1
  34. package/dist/plugins/adalo/src/index.js +1 -1
  35. package/dist/plugins/affinity/src/credentials.js +1 -1
  36. package/dist/plugins/affinity/src/index.js +1 -1
  37. package/dist/plugins/agentMail/src/credentials.js +1 -1
  38. package/dist/plugins/agentMail/src/shared.js +1 -2
  39. package/dist/plugins/agileCrm/src/credentials.js +1 -1
  40. package/dist/plugins/agileCrm/src/index.js +1 -1
  41. package/dist/plugins/airtable/src/credentials.js +1 -1
  42. package/dist/plugins/airtable/src/index.js +1 -1
  43. package/dist/plugins/airtop/src/credentials.js +1 -1
  44. package/dist/plugins/airtop/src/index.js +1 -1
  45. package/dist/plugins/apiTemplateIo/src/credentials.js +1 -1
  46. package/dist/plugins/apiTemplateIo/src/index.js +1 -1
  47. package/dist/plugins/asana/src/credentials.js +1 -1
  48. package/dist/plugins/asana/src/index.js +1 -1
  49. package/dist/plugins/autopilot/src/credentials.js +1 -1
  50. package/dist/plugins/autopilot/src/index.js +1 -1
  51. package/dist/plugins/bambooHr/src/credentials.js +1 -1
  52. package/dist/plugins/bambooHr/src/index.js +1 -1
  53. package/dist/plugins/bannerbear/src/credentials.js +1 -1
  54. package/dist/plugins/bannerbear/src/index.js +1 -1
  55. package/dist/plugins/baserow/src/credentials.js +1 -1
  56. package/dist/plugins/baserow/src/index.js +1 -1
  57. package/dist/plugins/beeminder/src/credentials.js +1 -1
  58. package/dist/plugins/beeminder/src/index.js +1 -1
  59. package/dist/plugins/bitly/src/credentials.js +1 -1
  60. package/dist/plugins/bitly/src/index.js +1 -1
  61. package/dist/plugins/bitwarden/src/credentials.js +1 -1
  62. package/dist/plugins/bitwarden/src/index.js +1 -1
  63. package/dist/plugins/box/src/credentials.js +1 -1
  64. package/dist/plugins/box/src/index.js +1 -1
  65. package/dist/plugins/brandfetch/src/credentials.js +1 -1
  66. package/dist/plugins/brandfetch/src/index.js +1 -1
  67. package/dist/plugins/brevo/src/credentials.js +1 -1
  68. package/dist/plugins/brevo/src/index.js +1 -1
  69. package/dist/plugins/bubble/src/credentials.js +1 -1
  70. package/dist/plugins/bubble/src/index.js +1 -1
  71. package/dist/plugins/chargebee/src/credentials.js +1 -1
  72. package/dist/plugins/chargebee/src/index.js +1 -1
  73. package/dist/plugins/circleci/src/credentials.js +1 -1
  74. package/dist/plugins/circleci/src/index.js +1 -1
  75. package/dist/plugins/ciscoWebex/src/credentials.js +1 -1
  76. package/dist/plugins/ciscoWebex/src/index.js +1 -1
  77. package/dist/plugins/clearbit/src/credentials.js +1 -1
  78. package/dist/plugins/clearbit/src/index.js +1 -1
  79. package/dist/plugins/clickup/src/credentials.js +1 -1
  80. package/dist/plugins/clickup/src/index.js +1 -1
  81. package/dist/plugins/clockify/src/credentials.js +1 -1
  82. package/dist/plugins/clockify/src/index.js +1 -1
  83. package/dist/plugins/cloudflare/src/credentials.js +1 -1
  84. package/dist/plugins/cloudflare/src/index.js +1 -1
  85. package/dist/plugins/cockpit/src/credentials.js +1 -1
  86. package/dist/plugins/cockpit/src/index.js +1 -1
  87. package/dist/plugins/coda/src/credentials.js +1 -1
  88. package/dist/plugins/coda/src/index.js +1 -1
  89. package/dist/plugins/coingecko/src/credentials.js +1 -1
  90. package/dist/plugins/coingecko/src/index.js +1 -1
  91. package/dist/plugins/contentful/src/credentials.js +1 -1
  92. package/dist/plugins/contentful/src/index.js +1 -1
  93. package/dist/plugins/convertkit/src/credentials.js +1 -1
  94. package/dist/plugins/convertkit/src/index.js +1 -1
  95. package/dist/plugins/copper/src/credentials.js +1 -1
  96. package/dist/plugins/copper/src/index.js +1 -1
  97. package/dist/plugins/cortex/src/credentials.js +1 -1
  98. package/dist/plugins/cortex/src/index.js +1 -1
  99. package/dist/plugins/currents/src/credentials.js +1 -1
  100. package/dist/plugins/currents/src/index.js +1 -1
  101. package/dist/plugins/customerIo/src/credentials.js +1 -1
  102. package/dist/plugins/customerIo/src/index.js +1 -1
  103. package/dist/plugins/databricks/src/credentials.js +1 -1
  104. package/dist/plugins/databricks/src/index.js +1 -1
  105. package/dist/plugins/deepl/src/credentials.js +1 -1
  106. package/dist/plugins/deepl/src/index.js +1 -1
  107. package/dist/plugins/demio/src/credentials.js +1 -1
  108. package/dist/plugins/demio/src/index.js +1 -1
  109. package/dist/plugins/dhl/src/credentials.js +1 -1
  110. package/dist/plugins/dhl/src/index.js +1 -1
  111. package/dist/plugins/discord/src/credentials.js +1 -1
  112. package/dist/plugins/discord/src/index.js +1 -1
  113. package/dist/plugins/discourse/src/credentials.js +1 -1
  114. package/dist/plugins/discourse/src/index.js +1 -1
  115. package/dist/plugins/disqus/src/credentials.js +1 -1
  116. package/dist/plugins/disqus/src/index.js +1 -1
  117. package/dist/plugins/drift/src/credentials.js +1 -1
  118. package/dist/plugins/drift/src/index.js +1 -1
  119. package/dist/plugins/dropbox/src/credentials.js +1 -1
  120. package/dist/plugins/dropbox/src/index.js +1 -1
  121. package/dist/plugins/dropcontact/src/credentials.js +1 -1
  122. package/dist/plugins/dropcontact/src/index.js +1 -1
  123. package/dist/plugins/egoi/src/credentials.js +1 -1
  124. package/dist/plugins/egoi/src/index.js +1 -1
  125. package/dist/plugins/elasticsearch/src/credentials.js +1 -1
  126. package/dist/plugins/elasticsearch/src/index.js +1 -1
  127. package/dist/plugins/elevenlabs/src/credentials.js +1 -1
  128. package/dist/plugins/elevenlabs/src/shared.js +2 -4
  129. package/dist/plugins/elevenlabs/src/workflows.js +1 -1
  130. package/dist/plugins/emelia/src/credentials.js +1 -1
  131. package/dist/plugins/emelia/src/index.js +1 -1
  132. package/dist/plugins/erpnext/src/credentials.js +1 -1
  133. package/dist/plugins/erpnext/src/index.js +1 -1
  134. package/dist/plugins/facebookGraph/src/credentials.js +1 -1
  135. package/dist/plugins/facebookGraph/src/index.js +1 -2
  136. package/dist/plugins/fal/src/credentials.js +1 -1
  137. package/dist/plugins/fal/src/shared.js +1 -1
  138. package/dist/plugins/freshdesk/src/credentials.js +1 -1
  139. package/dist/plugins/freshdesk/src/index.js +1 -1
  140. package/dist/plugins/freshservice/src/credentials.js +1 -1
  141. package/dist/plugins/freshservice/src/index.js +1 -1
  142. package/dist/plugins/freshworksCrm/src/credentials.js +1 -1
  143. package/dist/plugins/freshworksCrm/src/index.js +1 -1
  144. package/dist/plugins/getresponse/src/credentials.js +1 -1
  145. package/dist/plugins/getresponse/src/index.js +1 -1
  146. package/dist/plugins/gett/src/credentials.js +1 -2
  147. package/dist/plugins/gett/src/index.js +1 -1
  148. package/dist/plugins/gett/src/login.js +1 -1
  149. package/dist/plugins/gett/src/session.js +1 -1
  150. package/dist/plugins/gett/src/shared.js +1 -2
  151. package/dist/plugins/ghost/src/credentials.js +1 -1
  152. package/dist/plugins/ghost/src/index.js +1 -1
  153. package/dist/plugins/github/src/credentials.js +1 -1
  154. package/dist/plugins/github/src/index.js +1 -1
  155. package/dist/plugins/gitlab/src/credentials.js +1 -1
  156. package/dist/plugins/gitlab/src/index.js +1 -1
  157. package/dist/plugins/gmail/src/index.js +1 -1
  158. package/dist/plugins/gong/src/credentials.js +1 -1
  159. package/dist/plugins/gong/src/index.js +1 -1
  160. package/dist/plugins/googleAppsScript/src/index.js +12 -1
  161. package/dist/plugins/googleCalendar/src/index.js +1 -1
  162. package/dist/plugins/googleContacts/src/index.js +1 -1
  163. package/dist/plugins/googleDocs/src/shared.js +1 -1
  164. package/dist/plugins/googleDrive/src/index.js +1 -1
  165. package/dist/plugins/googleImage/src/credentials.js +1 -1
  166. package/dist/plugins/googleImage/src/index.js +1 -1
  167. package/dist/plugins/googleSheets/src/index.js +1 -1
  168. package/dist/plugins/googleSlides/src/index.js +1 -1
  169. package/dist/plugins/googleTasks/src/index.js +1 -1
  170. package/dist/plugins/gotify/src/credentials.js +1 -1
  171. package/dist/plugins/gotify/src/index.js +1 -1
  172. package/dist/plugins/gotowebinar/src/credentials.js +1 -1
  173. package/dist/plugins/gotowebinar/src/index.js +1 -1
  174. package/dist/plugins/grafana/src/credentials.js +1 -1
  175. package/dist/plugins/grafana/src/index.js +1 -1
  176. package/dist/plugins/graphql/src/credentials.js +1 -1
  177. package/dist/plugins/graphql/src/index.js +1 -1
  178. package/dist/plugins/grist/src/credentials.js +1 -1
  179. package/dist/plugins/grist/src/index.js +1 -1
  180. package/dist/plugins/halopsa/src/credentials.js +1 -2
  181. package/dist/plugins/halopsa/src/index.js +1 -1
  182. package/dist/plugins/harvest/src/credentials.js +1 -1
  183. package/dist/plugins/harvest/src/index.js +1 -1
  184. package/dist/plugins/helpscout/src/credentials.js +1 -1
  185. package/dist/plugins/helpscout/src/index.js +1 -1
  186. package/dist/plugins/highlevel/src/credentials.js +1 -1
  187. package/dist/plugins/highlevel/src/index.js +1 -1
  188. package/dist/plugins/homeAssistant/src/credentials.js +1 -1
  189. package/dist/plugins/homeAssistant/src/index.js +1 -1
  190. package/dist/plugins/hubspot/src/credentials.js +1 -1
  191. package/dist/plugins/hubspot/src/index.js +1 -1
  192. package/dist/plugins/humanticAi/src/credentials.js +1 -1
  193. package/dist/plugins/humanticAi/src/index.js +1 -1
  194. package/dist/plugins/hunter/src/credentials.js +1 -1
  195. package/dist/plugins/hunter/src/index.js +1 -1
  196. package/dist/plugins/intercom/src/credentials.js +1 -1
  197. package/dist/plugins/intercom/src/index.js +1 -1
  198. package/dist/plugins/iterable/src/credentials.js +1 -1
  199. package/dist/plugins/iterable/src/index.js +1 -1
  200. package/dist/plugins/jenkins/src/credentials.js +1 -1
  201. package/dist/plugins/jenkins/src/index.js +1 -1
  202. package/dist/plugins/jira/src/credentials.js +1 -1
  203. package/dist/plugins/jira/src/index.js +1 -1
  204. package/dist/plugins/keap/src/credentials.js +1 -1
  205. package/dist/plugins/keap/src/index.js +1 -1
  206. package/dist/plugins/kobotoolbox/src/credentials.js +1 -1
  207. package/dist/plugins/kobotoolbox/src/index.js +1 -1
  208. package/dist/plugins/lemlist/src/credentials.js +1 -1
  209. package/dist/plugins/lemlist/src/index.js +1 -1
  210. package/dist/plugins/linear/src/credentials.js +1 -1
  211. package/dist/plugins/linear/src/shared.js +1 -1
  212. package/dist/plugins/lingvanex/src/credentials.js +1 -1
  213. package/dist/plugins/lingvanex/src/index.js +1 -1
  214. package/dist/plugins/linkedin/src/credentials.js +1 -1
  215. package/dist/plugins/linkedin/src/index.js +1 -1
  216. package/dist/plugins/lonescale/src/credentials.js +1 -1
  217. package/dist/plugins/lonescale/src/index.js +1 -1
  218. package/dist/plugins/magento/src/credentials.js +1 -1
  219. package/dist/plugins/magento/src/index.js +1 -1
  220. package/dist/plugins/mailcheck/src/credentials.js +1 -1
  221. package/dist/plugins/mailcheck/src/index.js +1 -1
  222. package/dist/plugins/mailchimp/src/credentials.js +1 -1
  223. package/dist/plugins/mailchimp/src/index.js +1 -1
  224. package/dist/plugins/mailerlite/src/credentials.js +1 -1
  225. package/dist/plugins/mailerlite/src/index.js +1 -1
  226. package/dist/plugins/mailgun/src/credentials.js +1 -1
  227. package/dist/plugins/mailgun/src/index.js +1 -1
  228. package/dist/plugins/mailjet/src/credentials.js +1 -1
  229. package/dist/plugins/mailjet/src/index.js +1 -1
  230. package/dist/plugins/mandrill/src/credentials.js +1 -1
  231. package/dist/plugins/mandrill/src/index.js +1 -1
  232. package/dist/plugins/marketstack/src/credentials.js +1 -1
  233. package/dist/plugins/marketstack/src/index.js +1 -1
  234. package/dist/plugins/matrix/src/credentials.js +1 -1
  235. package/dist/plugins/matrix/src/index.js +1 -1
  236. package/dist/plugins/mattermost/src/credentials.js +1 -1
  237. package/dist/plugins/mattermost/src/index.js +1 -1
  238. package/dist/plugins/mautic/src/credentials.js +1 -1
  239. package/dist/plugins/mautic/src/index.js +1 -1
  240. package/dist/plugins/medium/src/credentials.js +1 -1
  241. package/dist/plugins/medium/src/index.js +1 -1
  242. package/dist/plugins/messagebird/src/credentials.js +1 -1
  243. package/dist/plugins/messagebird/src/index.js +1 -1
  244. package/dist/plugins/metabase/src/credentials.js +1 -1
  245. package/dist/plugins/metabase/src/index.js +1 -1
  246. package/dist/plugins/microsoftFiles/src/index.js +10 -1
  247. package/dist/plugins/misp/src/credentials.js +1 -1
  248. package/dist/plugins/misp/src/index.js +1 -1
  249. package/dist/plugins/mocean/src/credentials.js +1 -1
  250. package/dist/plugins/mocean/src/index.js +1 -1
  251. package/dist/plugins/monday/src/credentials.js +1 -1
  252. package/dist/plugins/monday/src/index.js +1 -1
  253. package/dist/plugins/monicaCrm/src/credentials.js +1 -1
  254. package/dist/plugins/monicaCrm/src/index.js +1 -1
  255. package/dist/plugins/msg91/src/credentials.js +1 -1
  256. package/dist/plugins/msg91/src/index.js +1 -1
  257. package/dist/plugins/nasa/src/credentials.js +1 -1
  258. package/dist/plugins/nasa/src/index.js +1 -1
  259. package/dist/plugins/netlify/src/credentials.js +1 -1
  260. package/dist/plugins/netlify/src/index.js +1 -1
  261. package/dist/plugins/netscalerAdc/src/credentials.js +1 -1
  262. package/dist/plugins/netscalerAdc/src/index.js +1 -1
  263. package/dist/plugins/nextcloud/src/credentials.js +1 -2
  264. package/dist/plugins/nextcloud/src/index.js +1 -1
  265. package/dist/plugins/nocodb/src/credentials.js +1 -1
  266. package/dist/plugins/nocodb/src/index.js +1 -1
  267. package/dist/plugins/notion/src/credentials.js +1 -1
  268. package/dist/plugins/notion/src/index.js +1 -1
  269. package/dist/plugins/npm/src/credentials.js +1 -1
  270. package/dist/plugins/npm/src/index.js +1 -1
  271. package/dist/plugins/odoo/src/credentials.js +1 -1
  272. package/dist/plugins/odoo/src/index.js +1 -2
  273. package/dist/plugins/okta/src/credentials.js +1 -1
  274. package/dist/plugins/okta/src/index.js +1 -2
  275. package/dist/plugins/oneSimpleApi/src/credentials.js +1 -1
  276. package/dist/plugins/oneSimpleApi/src/index.js +1 -1
  277. package/dist/plugins/onfleet/src/credentials.js +1 -1
  278. package/dist/plugins/onfleet/src/index.js +1 -1
  279. package/dist/plugins/openai/src/credentials.js +1 -1
  280. package/dist/plugins/openai/src/index.js +1 -1
  281. package/dist/plugins/openweathermap/src/credentials.js +1 -1
  282. package/dist/plugins/openweathermap/src/index.js +1 -1
  283. package/dist/plugins/oura/src/credentials.js +1 -1
  284. package/dist/plugins/oura/src/index.js +1 -1
  285. package/dist/plugins/paddle/src/credentials.js +1 -1
  286. package/dist/plugins/paddle/src/index.js +1 -1
  287. package/dist/plugins/pagerduty/src/credentials.js +1 -1
  288. package/dist/plugins/pagerduty/src/index.js +1 -1
  289. package/dist/plugins/parallel/src/credentials.js +1 -1
  290. package/dist/plugins/parallel/src/index.js +15 -1
  291. package/dist/plugins/paypal/src/credentials.js +1 -1
  292. package/dist/plugins/paypal/src/index.js +1 -1
  293. package/dist/plugins/peekalink/src/credentials.js +1 -1
  294. package/dist/plugins/peekalink/src/index.js +1 -1
  295. package/dist/plugins/phantombuster/src/credentials.js +1 -1
  296. package/dist/plugins/phantombuster/src/index.js +1 -1
  297. package/dist/plugins/philipsHue/src/credentials.js +1 -1
  298. package/dist/plugins/philipsHue/src/index.js +1 -1
  299. package/dist/plugins/pipedrive/src/credentials.js +1 -1
  300. package/dist/plugins/pipedrive/src/index.js +1 -1
  301. package/dist/plugins/plaud/src/shared.js +1 -2
  302. package/dist/plugins/plivo/src/credentials.js +1 -1
  303. package/dist/plugins/plivo/src/index.js +1 -1
  304. package/dist/plugins/posthog/src/credentials.js +1 -1
  305. package/dist/plugins/posthog/src/index.js +1 -1
  306. package/dist/plugins/profitwell/src/credentials.js +1 -1
  307. package/dist/plugins/profitwell/src/index.js +1 -1
  308. package/dist/plugins/pushbullet/src/credentials.js +1 -1
  309. package/dist/plugins/pushbullet/src/index.js +1 -1
  310. package/dist/plugins/pushcut/src/credentials.js +1 -1
  311. package/dist/plugins/pushcut/src/index.js +1 -1
  312. package/dist/plugins/pushover/src/credentials.js +1 -1
  313. package/dist/plugins/pushover/src/index.js +1 -1
  314. package/dist/plugins/quickbase/src/credentials.js +1 -1
  315. package/dist/plugins/quickbase/src/index.js +1 -1
  316. package/dist/plugins/quickbooks/src/credentials.js +1 -1
  317. package/dist/plugins/quickbooks/src/index.js +1 -1
  318. package/dist/plugins/raindrop/src/credentials.js +1 -1
  319. package/dist/plugins/raindrop/src/index.js +1 -1
  320. package/dist/plugins/recraft/src/credentials.js +1 -1
  321. package/dist/plugins/recraft/src/index.js +1 -1
  322. package/dist/plugins/reddit/src/credentials.js +1 -1
  323. package/dist/plugins/reddit/src/index.js +1 -1
  324. package/dist/plugins/replicate/src/credentials.js +1 -1
  325. package/dist/plugins/replicate/src/index.js +1 -1
  326. package/dist/plugins/rocketchat/src/credentials.js +1 -1
  327. package/dist/plugins/rocketchat/src/index.js +1 -1
  328. package/dist/plugins/rundeck/src/credentials.js +1 -1
  329. package/dist/plugins/rundeck/src/index.js +1 -1
  330. package/dist/plugins/salesforce/src/credentials.js +1 -2
  331. package/dist/plugins/salesforce/src/shared.js +1 -2
  332. package/dist/plugins/salesforce/src/sobjects.js +1 -1
  333. package/dist/plugins/salesmate/src/credentials.js +1 -1
  334. package/dist/plugins/salesmate/src/index.js +1 -1
  335. package/dist/plugins/securityScorecard/src/credentials.js +1 -1
  336. package/dist/plugins/securityScorecard/src/index.js +1 -1
  337. package/dist/plugins/segment/src/credentials.js +1 -1
  338. package/dist/plugins/segment/src/index.js +1 -1
  339. package/dist/plugins/sendgrid/src/credentials.js +1 -1
  340. package/dist/plugins/sendgrid/src/index.js +1 -2
  341. package/dist/plugins/sendy/src/credentials.js +1 -1
  342. package/dist/plugins/sendy/src/index.js +1 -1
  343. package/dist/plugins/sentry/src/credentials.js +1 -1
  344. package/dist/plugins/sentry/src/index.js +1 -1
  345. package/dist/plugins/servicenow/src/credentials.js +1 -1
  346. package/dist/plugins/servicenow/src/index.js +1 -1
  347. package/dist/plugins/shiftAtlas/src/graph.js +2 -1
  348. package/dist/plugins/shiftAtlas/src/shared.js +1 -1
  349. package/dist/plugins/shiftBwm/src/shared.js +2 -4
  350. package/dist/plugins/shiftCrm/src/access.js +2 -1
  351. package/dist/plugins/shiftCrm/src/accounts.js +2 -1
  352. package/dist/plugins/shiftCrm/src/imports.js +2 -1
  353. package/dist/plugins/shiftCrm/src/opportunities.js +2 -1
  354. package/dist/plugins/shiftCrm/src/people.js +2 -1
  355. package/dist/plugins/shiftCrm/src/records.js +2 -1
  356. package/dist/plugins/shiftCrm/src/shared.js +1 -1
  357. package/dist/plugins/shiftCrm/src/tasks.js +2 -1
  358. package/dist/plugins/shiftObjects/src/objects.js +2 -1
  359. package/dist/plugins/shiftOcr/src/index.js +2 -1
  360. package/dist/plugins/shiftPages/src/pages.js +2 -1
  361. package/dist/plugins/shiftPages/src/shared.js +3 -2
  362. package/dist/plugins/shiftTranscription/src/shared.js +1 -1
  363. package/dist/plugins/shiftTranscription/src/transcription.js +2 -1
  364. package/dist/plugins/shiftWork/src/issue-views.js +2 -1
  365. package/dist/plugins/shiftWork/src/issues.js +2 -1
  366. package/dist/plugins/shiftWork/src/projects.js +2 -1
  367. package/dist/plugins/shiftWork/src/shared.js +1 -1
  368. package/dist/plugins/shopify/src/credentials.js +1 -1
  369. package/dist/plugins/shopify/src/index.js +1 -1
  370. package/dist/plugins/signl4/src/credentials.js +1 -1
  371. package/dist/plugins/signl4/src/index.js +1 -1
  372. package/dist/plugins/slack/src/credentials.js +1 -1
  373. package/dist/plugins/slack/src/index.js +1 -1
  374. package/dist/plugins/sms77/src/credentials.js +1 -1
  375. package/dist/plugins/sms77/src/index.js +1 -1
  376. package/dist/plugins/splunk/src/credentials.js +1 -1
  377. package/dist/plugins/splunk/src/index.js +1 -1
  378. package/dist/plugins/spotify/src/credentials.js +1 -1
  379. package/dist/plugins/spotify/src/index.js +1 -1
  380. package/dist/plugins/stackby/src/credentials.js +1 -1
  381. package/dist/plugins/stackby/src/index.js +1 -1
  382. package/dist/plugins/steel/src/auth.js +1 -1
  383. package/dist/plugins/steel/src/browser.js +1 -1
  384. package/dist/plugins/steel/src/captchas.js +1 -1
  385. package/dist/plugins/steel/src/extensions.js +1 -1
  386. package/dist/plugins/steel/src/files.js +1 -1
  387. package/dist/plugins/steel/src/profiles.js +1 -1
  388. package/dist/plugins/steel/src/sessions.js +1 -1
  389. package/dist/plugins/steel/src/shared.js +1 -1
  390. package/dist/plugins/storyblok/src/credentials.js +1 -1
  391. package/dist/plugins/storyblok/src/index.js +1 -1
  392. package/dist/plugins/strapi/src/credentials.js +1 -1
  393. package/dist/plugins/strapi/src/index.js +1 -1
  394. package/dist/plugins/strava/src/credentials.js +1 -1
  395. package/dist/plugins/strava/src/index.js +1 -1
  396. package/dist/plugins/stripe/src/credentials.js +1 -1
  397. package/dist/plugins/stripe/src/index.js +1 -1
  398. package/dist/plugins/supabase/src/credentials.js +1 -1
  399. package/dist/plugins/supabase/src/index.js +1 -1
  400. package/dist/plugins/syncromsp/src/credentials.js +1 -1
  401. package/dist/plugins/syncromsp/src/index.js +1 -1
  402. package/dist/plugins/tapfiliate/src/credentials.js +1 -1
  403. package/dist/plugins/tapfiliate/src/index.js +1 -1
  404. package/dist/plugins/telegram/src/credentials.js +1 -1
  405. package/dist/plugins/telegram/src/index.js +1 -1
  406. package/dist/plugins/thehive/src/credentials.js +1 -1
  407. package/dist/plugins/thehive/src/index.js +1 -1
  408. package/dist/plugins/thehiveProject/src/credentials.js +1 -1
  409. package/dist/plugins/thehiveProject/src/index.js +1 -1
  410. package/dist/plugins/todoist/src/credentials.js +1 -1
  411. package/dist/plugins/todoist/src/index.js +1 -1
  412. package/dist/plugins/together/src/credentials.js +1 -1
  413. package/dist/plugins/together/src/index.js +1 -1
  414. package/dist/plugins/travisci/src/credentials.js +1 -1
  415. package/dist/plugins/travisci/src/index.js +1 -1
  416. package/dist/plugins/trello/src/credentials.js +1 -1
  417. package/dist/plugins/trello/src/index.js +1 -1
  418. package/dist/plugins/twake/src/credentials.js +1 -1
  419. package/dist/plugins/twake/src/index.js +1 -1
  420. package/dist/plugins/twilio/src/credentials.js +1 -1
  421. package/dist/plugins/twilio/src/index.js +1 -1
  422. package/dist/plugins/twist/src/credentials.js +1 -1
  423. package/dist/plugins/twist/src/index.js +1 -1
  424. package/dist/plugins/twitter/src/credentials.js +1 -1
  425. package/dist/plugins/twitter/src/index.js +1 -1
  426. package/dist/plugins/typesafe/src/credentials.js +1 -1
  427. package/dist/plugins/typesafe/src/shared.js +1 -1
  428. package/dist/plugins/unleashedSoftware/src/credentials.js +1 -1
  429. package/dist/plugins/unleashedSoftware/src/index.js +1 -1
  430. package/dist/plugins/uplead/src/credentials.js +1 -1
  431. package/dist/plugins/uplead/src/index.js +1 -1
  432. package/dist/plugins/uproc/src/credentials.js +1 -1
  433. package/dist/plugins/uproc/src/index.js +1 -1
  434. package/dist/plugins/uptimerobot/src/credentials.js +1 -1
  435. package/dist/plugins/uptimerobot/src/index.js +1 -1
  436. package/dist/plugins/urlscanio/src/credentials.js +1 -1
  437. package/dist/plugins/urlscanio/src/index.js +1 -1
  438. package/dist/plugins/vercel/src/credentials.js +1 -1
  439. package/dist/plugins/vercel/src/deployments.js +1 -1
  440. package/dist/plugins/vercel/src/env.js +1 -1
  441. package/dist/plugins/vercel/src/projects.js +1 -1
  442. package/dist/plugins/vercel/src/shared.js +1 -2
  443. package/dist/plugins/vero/src/credentials.js +1 -1
  444. package/dist/plugins/vero/src/index.js +1 -1
  445. package/dist/plugins/vonage/src/credentials.js +1 -1
  446. package/dist/plugins/vonage/src/index.js +1 -1
  447. package/dist/plugins/wekan/src/credentials.js +1 -1
  448. package/dist/plugins/wekan/src/index.js +1 -1
  449. package/dist/plugins/wolt/src/account.js +1 -1
  450. package/dist/plugins/wolt/src/credentials.js +1 -1
  451. package/dist/plugins/wolt/src/index.js +1 -1
  452. package/dist/plugins/wolt/src/shared.js +1 -2
  453. package/dist/plugins/woocommerce/src/credentials.js +1 -1
  454. package/dist/plugins/woocommerce/src/index.js +1 -1
  455. package/dist/plugins/wordpress/src/credentials.js +1 -1
  456. package/dist/plugins/wordpress/src/index.js +1 -1
  457. package/dist/plugins/xai/src/credentials.js +1 -1
  458. package/dist/plugins/xai/src/index.js +1 -1
  459. package/dist/plugins/xero/src/credentials.js +1 -1
  460. package/dist/plugins/xero/src/index.js +1 -1
  461. package/dist/plugins/yourls/src/credentials.js +1 -1
  462. package/dist/plugins/yourls/src/index.js +1 -1
  463. package/dist/plugins/zammad/src/credentials.js +1 -1
  464. package/dist/plugins/zammad/src/index.js +1 -1
  465. package/dist/plugins/zendesk/src/credentials.js +1 -1
  466. package/dist/plugins/zendesk/src/index.js +1 -1
  467. package/dist/plugins/zoho/src/credentials.js +1 -1
  468. package/dist/plugins/zoho/src/index.js +1 -1
  469. package/dist/plugins/zoom/src/credentials.js +1 -1
  470. package/dist/plugins/zoom/src/index.js +1 -1
  471. package/dist/plugins/zulip/src/credentials.js +1 -1
  472. package/dist/plugins/zulip/src/index.js +1 -1
  473. package/package.json +3 -2
@@ -3,6 +3,7 @@ import { Check } from "typebox/value";
3
3
  import { AuthError } from "../auth/errors.js";
4
4
  import { validateOAuth2ExchangePolicy } from "../auth/oauth2.js";
5
5
  import { oauthEndpoint, providerHeaders, providerParameters, } from "../auth/token.js";
6
+ import { isAwsScope } from "./aws.js";
6
7
  import { bounded, HTTP_METHODS, headerName, injectedHeaders, injectedParams, injectedPointers, placementsFor, refuseCredentialParams, resourceUrl, TARGET_RESPONSE_LIMIT_BYTES, TARGET_TIMEOUT_LIMIT_MS, TRANSPORT_HEADERS, targetBase, targetOf, } from "./policy.js";
7
8
  /** Normalized grant storage; application registration remains host-owned. */
8
9
  export const OAuthTokensSchema = t.Object({
@@ -29,6 +30,49 @@ export const OAuthGrantSchema = t.Object({
29
30
  tokens: t.Partial(OAuthTokensSchema),
30
31
  revision: t.String({ minLength: 1 }),
31
32
  }, { additionalProperties: false });
33
+ /** Stored shape of an AWS access key; a session's carries its token. */
34
+ export const AwsAccessKeySchema = t.Object({
35
+ accessKeyId: t.String({ minLength: 1 }),
36
+ secretAccessKey: t.String({ minLength: 1 }),
37
+ sessionToken: t.Optional(t.String({ minLength: 1 })),
38
+ }, { additionalProperties: false });
39
+ /** Stored shape of an assumed role's session. */
40
+ export const AwsSessionSchema = t.Object({
41
+ accessKeyId: t.String({ minLength: 1 }),
42
+ secretAccessKey: t.String({ minLength: 1 }),
43
+ sessionToken: t.String({ minLength: 1 }),
44
+ expiresAt: t.Integer({ minimum: 0, maximum: Number.MAX_SAFE_INTEGER }),
45
+ revision: t.String({ minLength: 1 }),
46
+ }, { additionalProperties: false });
47
+ /** Whether two strict object schemas store the same fields, alike required. */
48
+ function sameShape(actual, expected) {
49
+ const shape = actual;
50
+ const describe = (schema) => JSON.stringify([
51
+ schema.type,
52
+ schema.additionalProperties,
53
+ Object.entries(schema.properties ?? {})
54
+ .map(([name, field]) => [name, field.type])
55
+ .sort(),
56
+ [...(schema.required ?? [])].sort(),
57
+ ]);
58
+ return !!shape && describe(shape) === describe(expected);
59
+ }
60
+ /**
61
+ * A SigV4 method stores exactly an access key in its field and, when it
62
+ * assumes a role, an optional session in a field of its own.
63
+ */
64
+ function validateAwsSigV4(auth, schema) {
65
+ if (!sameShape(schema.properties?.[auth.field], AwsAccessKeySchema))
66
+ throw new AuthError("invalid_definition");
67
+ if (auth.assumeRole === undefined)
68
+ return;
69
+ const session = auth.assumeRole.sessionField;
70
+ identifier(session);
71
+ if (session === auth.field ||
72
+ !sameShape(schema.properties?.[session], AwsSessionSchema) ||
73
+ schema.required?.includes(session))
74
+ throw new AuthError("invalid_definition");
75
+ }
32
76
  function identifier(value) {
33
77
  if (typeof value !== "string" || !/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(value))
34
78
  throw new AuthError("invalid_definition");
@@ -155,6 +199,8 @@ function validateMethod(method) {
155
199
  }
156
200
  if (auth.kind === "static")
157
201
  validateStatic(auth, schema.properties[auth.field], Object.keys(method.targets ?? {}));
202
+ else if (auth.kind === "awsSigV4")
203
+ validateAwsSigV4(auth, schema);
158
204
  else if (auth.kind === "oauth2") {
159
205
  identifier(auth.definition.id);
160
206
  identifier(auth.definition.provider);
@@ -228,6 +274,11 @@ function validateMethod(method) {
228
274
  identifier(name);
229
275
  const injected = injectedHeaders(auth, name);
230
276
  targetBase(target);
277
+ // A SigV4 target names what it is signed for; no other target may.
278
+ if (auth.kind === "awsSigV4"
279
+ ? !isAwsScope(target.aws)
280
+ : target.aws !== undefined)
281
+ throw new AuthError("invalid_definition");
231
282
  if (!Array.isArray(target.methods) ||
232
283
  !target.methods.length ||
233
284
  target.methods.some((m) => !HTTP_METHODS.includes(m)))
@@ -246,11 +297,13 @@ function validateMethod(method) {
246
297
  if (injected.includes(header) || TRANSPORT_HEADERS.includes(header))
247
298
  throw new AuthError("invalid_definition");
248
299
  }
249
- // A socket URL carries only query parameters: no header, body or
250
- // bearer can sign it, and nothing is sent through it by the transport.
300
+ // A socket URL carries only query parameters: no header, body,
301
+ // bearer or request signature can sign it, and nothing is sent
302
+ // through it by the transport.
251
303
  if (target.socket !== undefined &&
252
304
  (target.socket !== true ||
253
305
  auth.kind === "oauth2" ||
306
+ auth.kind === "awsSigV4" ||
254
307
  target.allowedHeaders !== undefined ||
255
308
  target.idempotency !== undefined ||
256
309
  target.resumableUpload !== undefined ||
@@ -0,0 +1,47 @@
1
+ import type { AwsAccessKey, AwsScope } from "./types.js";
2
+ /**
3
+ * AWS Signature Version 4, header form. Pure: no IO, no clock — the
4
+ * caller supplies the signing time, so the canonical request is exactly
5
+ * reproducible and checked against AWS's published test suite.
6
+ */
7
+ export interface SigV4Request {
8
+ method: string;
9
+ host: string;
10
+ /** The path exactly as it goes on the wire. */
11
+ path: string;
12
+ /** The query's parameters, decoded, in any order. */
13
+ query: Iterable<[key: string, value: string]>;
14
+ /**
15
+ * Every header the request carries besides Host, in order. A name may
16
+ * repeat; its values are signed joined by commas, as sent.
17
+ */
18
+ headers: Array<[name: string, value: string]>;
19
+ body?: Uint8Array;
20
+ }
21
+ /** The headers SigV4 adds to a request: each one is the signer's alone. */
22
+ export declare const SIGV4_HEADERS: readonly ["authorization", "x-amz-date", "x-amz-security-token", "x-amz-content-sha256"];
23
+ /** The query parameters of a presigned URL; a signed request carries none. */
24
+ export declare const SIGV4_QUERY_PARAMETERS: readonly ["X-Amz-Algorithm", "X-Amz-Credential", "X-Amz-Date", "X-Amz-Expires", "X-Amz-Security-Token", "X-Amz-SignedHeaders", "X-Amz-Signature"];
25
+ /**
26
+ * Parameters re-encoded and sorted by key, then value: the query SigV4
27
+ * signs, and the unambiguous one to send.
28
+ */
29
+ export declare function canonicalQuery(query: Iterable<[string, string]>): string;
30
+ /** `20150830T123600Z`: the signing time, to the second, in UTC. */
31
+ export declare function amzDate(at: Date): string;
32
+ /**
33
+ * The canonical request SigV4 signs, with the headers the signer adds
34
+ * to it: `x-amz-date`, the session's `x-amz-security-token`, and for S3
35
+ * the payload hash it requires. Host and every header given are signed.
36
+ */
37
+ export declare function canonicalSigV4Request(request: SigV4Request, key: AwsAccessKey, scope: AwsScope, at: Date): {
38
+ canonicalRequest: string;
39
+ signed: string;
40
+ added: Record<string, string>;
41
+ };
42
+ /**
43
+ * The headers that sign `request` with `key` for `scope` at `at`: the
44
+ * added headers of `canonicalSigV4Request` and `authorization`. The
45
+ * request must then go out with exactly the headers it was signed with.
46
+ */
47
+ export declare function signSigV4(request: SigV4Request, key: AwsAccessKey, scope: AwsScope, at: Date): Record<string, string>;
@@ -0,0 +1,145 @@
1
+ import { createHash, createHmac } from "node:crypto";
2
+ /** The headers SigV4 adds to a request: each one is the signer's alone. */
3
+ export const SIGV4_HEADERS = [
4
+ "authorization",
5
+ "x-amz-date",
6
+ "x-amz-security-token",
7
+ "x-amz-content-sha256",
8
+ ];
9
+ /** The query parameters of a presigned URL; a signed request carries none. */
10
+ export const SIGV4_QUERY_PARAMETERS = [
11
+ "X-Amz-Algorithm",
12
+ "X-Amz-Credential",
13
+ "X-Amz-Date",
14
+ "X-Amz-Expires",
15
+ "X-Amz-Security-Token",
16
+ "X-Amz-SignedHeaders",
17
+ "X-Amz-Signature",
18
+ ];
19
+ const ALGORITHM = "AWS4-HMAC-SHA256";
20
+ /** RFC 3986 percent-encoding of UTF-8 bytes; unreserved characters stay. */
21
+ function uriEncode(value, keepSlash) {
22
+ let out = "";
23
+ for (const byte of Buffer.from(value, "utf8")) {
24
+ const char = String.fromCharCode(byte);
25
+ out +=
26
+ /[A-Za-z0-9\-._~]/.test(char) || (keepSlash && char === "/")
27
+ ? char
28
+ : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
29
+ }
30
+ return out;
31
+ }
32
+ /**
33
+ * A path as RFC 3986 normalizes it: dot segments resolved, empty segments
34
+ * dropped, a trailing slash kept.
35
+ */
36
+ function normalizePath(path) {
37
+ const segments = [];
38
+ for (const segment of path.split("/")) {
39
+ if (segment === "..")
40
+ segments.pop();
41
+ else if (segment && segment !== ".")
42
+ segments.push(segment);
43
+ }
44
+ const normalized = `/${segments.join("/")}`;
45
+ return path.endsWith("/") && segments.length ? `${normalized}/` : normalized;
46
+ }
47
+ /**
48
+ * The path as sent, normalized and encoded once more: what every service
49
+ * but S3 signs. S3 signs the path exactly as sent.
50
+ */
51
+ function canonicalUri(path, service) {
52
+ return service === "s3" ? path || "/" : uriEncode(normalizePath(path), true);
53
+ }
54
+ /**
55
+ * Parameters re-encoded and sorted by key, then value: the query SigV4
56
+ * signs, and the unambiguous one to send.
57
+ */
58
+ export function canonicalQuery(query) {
59
+ return [...query]
60
+ .map(([key, value]) => [uriEncode(key, false), uriEncode(value, false)])
61
+ .sort(([ak, av], [bk, bv]) => ak < bk ? -1 : ak > bk ? 1 : av < bv ? -1 : av > bv ? 1 : 0)
62
+ .map(([key, value]) => `${key}=${value}`)
63
+ .join("&");
64
+ }
65
+ /** Header values trimmed, inner whitespace runs collapsed, repeats joined. */
66
+ function canonicalHeaders(headers) {
67
+ const values = new Map();
68
+ for (const [name, value] of headers) {
69
+ const key = name.toLowerCase();
70
+ const list = values.get(key) ?? [];
71
+ list.push(value.trim().replace(/\s+/g, " "));
72
+ values.set(key, list);
73
+ }
74
+ const names = [...values.keys()].sort();
75
+ return {
76
+ canonical: names
77
+ .map((name) => `${name}:${values.get(name)?.join(",")}\n`)
78
+ .join(""),
79
+ signed: names.join(";"),
80
+ };
81
+ }
82
+ function sha256Hex(data) {
83
+ return createHash("sha256").update(data).digest("hex");
84
+ }
85
+ function hmac(key, data) {
86
+ return createHmac("sha256", key).update(data).digest();
87
+ }
88
+ /** `20150830T123600Z`: the signing time, to the second, in UTC. */
89
+ export function amzDate(at) {
90
+ return at
91
+ .toISOString()
92
+ .replace(/[-:]/g, "")
93
+ .replace(/\.\d{3}/, "");
94
+ }
95
+ /**
96
+ * The canonical request SigV4 signs, with the headers the signer adds
97
+ * to it: `x-amz-date`, the session's `x-amz-security-token`, and for S3
98
+ * the payload hash it requires. Host and every header given are signed.
99
+ */
100
+ export function canonicalSigV4Request(request, key, scope, at) {
101
+ const payloadHash = sha256Hex(request.body ?? new Uint8Array());
102
+ const added = {
103
+ "x-amz-date": amzDate(at),
104
+ ...(key.sessionToken ? { "x-amz-security-token": key.sessionToken } : {}),
105
+ ...(scope.service === "s3" ? { "x-amz-content-sha256": payloadHash } : {}),
106
+ };
107
+ const { canonical, signed } = canonicalHeaders([
108
+ ["host", request.host],
109
+ ...request.headers,
110
+ ...Object.entries(added),
111
+ ]);
112
+ const canonicalRequest = [
113
+ request.method,
114
+ canonicalUri(request.path, scope.service),
115
+ canonicalQuery(request.query),
116
+ canonical,
117
+ signed,
118
+ payloadHash,
119
+ ].join("\n");
120
+ return { canonicalRequest, signed, added };
121
+ }
122
+ /**
123
+ * The headers that sign `request` with `key` for `scope` at `at`: the
124
+ * added headers of `canonicalSigV4Request` and `authorization`. The
125
+ * request must then go out with exactly the headers it was signed with.
126
+ */
127
+ export function signSigV4(request, key, scope, at) {
128
+ const { canonicalRequest, signed, added } = canonicalSigV4Request(request, key, scope, at);
129
+ const date = added["x-amz-date"];
130
+ const credentialScope = `${date.slice(0, 8)}/${scope.region}/${scope.service}/aws4_request`;
131
+ const stringToSign = [
132
+ ALGORITHM,
133
+ date,
134
+ credentialScope,
135
+ sha256Hex(canonicalRequest),
136
+ ].join("\n");
137
+ const signingKey = hmac(hmac(hmac(hmac(`AWS4${key.secretAccessKey}`, date.slice(0, 8)), scope.region), scope.service), "aws4_request");
138
+ const signature = createHmac("sha256", signingKey)
139
+ .update(stringToSign)
140
+ .digest("hex");
141
+ return {
142
+ ...added,
143
+ authorization: `${ALGORITHM} Credential=${key.accessKeyId}/${credentialScope}, SignedHeaders=${signed}, Signature=${signature}`,
144
+ };
145
+ }
@@ -69,7 +69,16 @@ export declare class CredentialTransport {
69
69
  private readonly options;
70
70
  constructor(registry: CredentialRegistry, options: CredentialTransportOptions);
71
71
  private read;
72
+ /**
73
+ * Issue a short-lived credential into `field` under the connection's
74
+ * update ownership. A credential another caller committed meanwhile is
75
+ * `usable` and kept; otherwise one is issued, validated as stored, and
76
+ * committed. Answers what the committed connection holds.
77
+ */
78
+ private commitIssued;
72
79
  private renew;
80
+ /** A role session for the binding's `awsRole`, assumed with the stored key. */
81
+ private renewAwsSession;
73
82
  /** New tokens by the method's declared renewal, from what the binding supplies. */
74
83
  private issue;
75
84
  request(selection: CredentialBinding, input: AuthenticatedRequest): Promise<Response>;
@@ -2,9 +2,11 @@ import { createHmac, randomUUID } from "node:crypto";
2
2
  import { Check } from "typebox/value";
3
3
  import { AuthError } from "../auth/errors.js";
4
4
  import { acquireOAuth2ClientToken, acquireOAuth2JwtToken, acquireOAuth2PasswordToken, refreshOAuth2Token, } from "../auth/oauth2.js";
5
+ import { assumeAwsRole, awsAccessKey } from "./aws.js";
5
6
  import { sendResource } from "./http.js";
6
- import { bodyFields, bodyFormat, bounded, headerName, injectedFields, injectedHeaders, injectedParams, injectedPointers, placementsFor, pointerSlot, refuseCredentialParams, resourceUrl, TARGET_RESPONSE_LIMIT_BYTES, TARGET_TIMEOUT_LIMIT_MS, TRANSPORT_HEADERS, targetBase, targetOf, } from "./policy.js";
7
+ import { bodyFields, bodyFormat, bounded, headerName, injectedFields, injectedHeaders, injectedParams, injectedPointers, placementsFor, pointerSlot, refuseCredentialParams, resourceUrl, secret, TARGET_RESPONSE_LIMIT_BYTES, TARGET_TIMEOUT_LIMIT_MS, TRANSPORT_HEADERS, targetBase, targetOf, } from "./policy.js";
7
8
  import { OAuthGrantSchema, validateCredential, } from "./registry.js";
9
+ import { canonicalQuery, signSigV4 } from "./sigv4.js";
8
10
  function boundSnapshot(binding, method, snapshot) {
9
11
  if (snapshot.name !== binding.identity.name ||
10
12
  snapshot.plugin !== binding.identity.plugin)
@@ -34,6 +36,7 @@ function pinBinding(selection) {
34
36
  application: structuredClone(selection.application),
35
37
  jwtIdentity: structuredClone(selection.jwtIdentity),
36
38
  resourceOwner: structuredClone(selection.resourceOwner),
39
+ awsRole: structuredClone(selection.awsRole),
37
40
  connection: {
38
41
  read: selection.connection.read.bind(selection.connection),
39
42
  update: selection.connection.update.bind(selection.connection),
@@ -45,13 +48,6 @@ function fresh(grant) {
45
48
  (grant.tokens.expiresAt === undefined ||
46
49
  grant.tokens.expiresAt > Date.now() + 60_000));
47
50
  }
48
- function secret(value) {
49
- if (typeof value !== "string" ||
50
- !value ||
51
- [...value].some((char) => char.charCodeAt(0) <= 32 || char.charCodeAt(0) > 126))
52
- throw new AuthError("invalid_credentials");
53
- return value;
54
- }
55
51
  /**
56
52
  * A part sent whole as a header value, such as `Bearer <token>`: printable
57
53
  * ASCII whose interior spaces are part of the value, with no control
@@ -76,6 +72,36 @@ function basicCredentials(username, password) {
76
72
  throw new AuthError("invalid_credentials");
77
73
  return Buffer.from(`${username}:${password}`).toString("base64");
78
74
  }
75
+ /** Renewal leaves a role session this long before it expires. */
76
+ const AWS_SESSION_MARGIN_MS = 5 * 60_000;
77
+ function awsSessionFrom(auth, config) {
78
+ const field = auth.assumeRole?.sessionField;
79
+ return field === undefined ? undefined : config[field];
80
+ }
81
+ function awsSessionFresh(session) {
82
+ return !!session && session.expiresAt > Date.now() + AWS_SESSION_MARGIN_MS;
83
+ }
84
+ /**
85
+ * Signs with AWS SigV4 for `scope`, at the moment of sending, with a key
86
+ * checked before any IO. The query goes out in the canonical encoding it
87
+ * was signed in, so AWS decodes exactly the parameters that were signed.
88
+ */
89
+ function sigV4(stored, scope) {
90
+ const key = awsAccessKey(stored);
91
+ return ({ method, headers, url, body }) => {
92
+ url.search = canonicalQuery(url.searchParams);
93
+ const added = signSigV4({
94
+ method,
95
+ host: url.host,
96
+ path: url.pathname,
97
+ query: url.searchParams,
98
+ headers: [...headers],
99
+ body,
100
+ }, key, scope, new Date());
101
+ for (const [name, value] of Object.entries(added))
102
+ headers.set(name, value);
103
+ };
104
+ }
79
105
  /**
80
106
  * A secret as one path segment: `/`, `\`, `?`, `#` and dot segments are
81
107
  * refused rather than encoded; `:` and `@`, which RFC 3986 allows in a
@@ -223,32 +249,28 @@ export class CredentialTransport {
223
249
  }
224
250
  return boundSnapshot(binding, method, snapshot);
225
251
  }
226
- async renew(binding, method, observedRevision, rejected = false) {
227
- const auth = method.authentication;
228
- if (auth.kind !== "oauth2")
229
- throw new AuthError("invalid_definition");
252
+ /**
253
+ * Issue a short-lived credential into `field` under the connection's
254
+ * update ownership. A credential another caller committed meanwhile is
255
+ * `usable` and kept; otherwise one is issued, validated as stored, and
256
+ * committed. Answers what the committed connection holds.
257
+ */
258
+ async commitIssued(binding, method, renewal) {
230
259
  let callbackError;
231
260
  let committed;
232
261
  try {
233
262
  committed = await binding.connection.update(async (current) => {
234
263
  try {
235
264
  validateCredential(method, current);
236
- const previous = grantFrom(method, current);
237
- if ((fresh(previous) && !rejected) ||
238
- (previous &&
239
- previous.revision !== observedRevision &&
240
- previous.tokens.accessToken &&
241
- (previous.tokens.expiresAt === undefined ||
242
- previous.tokens.expiresAt > Date.now())))
265
+ const previous = renewal.read(current);
266
+ if (renewal.usable(previous))
243
267
  return;
244
- const tokens = await this.issue(auth, binding, previous);
245
268
  const patch = {
246
- [auth.field]: { tokens, revision: randomUUID() },
269
+ [renewal.field]: await renewal.issue(previous, current),
247
270
  };
248
271
  const next = { ...current, ...patch };
249
272
  validateCredential(method, next);
250
- grantFrom(method, next);
251
- secret(tokens.accessToken);
273
+ renewal.read(next);
252
274
  return patch;
253
275
  }
254
276
  catch (error) {
@@ -262,10 +284,54 @@ export class CredentialTransport {
262
284
  throw error;
263
285
  throw new AuthError("credential_store_failed");
264
286
  }
265
- const grant = grantFrom(method, boundSnapshot(binding, method, committed));
266
- if (!grant)
287
+ const issued = renewal.read(boundSnapshot(binding, method, committed));
288
+ if (issued === undefined)
289
+ throw new AuthError("invalid_credentials");
290
+ return issued;
291
+ }
292
+ renew(binding, method, observedRevision, rejected = false) {
293
+ const auth = method.authentication;
294
+ if (auth.kind !== "oauth2")
295
+ throw new AuthError("invalid_definition");
296
+ return this.commitIssued(binding, method, {
297
+ field: auth.field,
298
+ read: (config) => grantFrom(method, config),
299
+ usable: (previous) => (fresh(previous) && !rejected) ||
300
+ (!!previous &&
301
+ previous.revision !== observedRevision &&
302
+ !!previous.tokens.accessToken &&
303
+ (previous.tokens.expiresAt === undefined ||
304
+ previous.tokens.expiresAt > Date.now())),
305
+ issue: async (previous) => {
306
+ const tokens = await this.issue(auth, binding, previous);
307
+ secret(tokens.accessToken);
308
+ return { tokens, revision: randomUUID() };
309
+ },
310
+ });
311
+ }
312
+ /** A role session for the binding's `awsRole`, assumed with the stored key. */
313
+ renewAwsSession(binding, method, observedRevision) {
314
+ const auth = method.authentication;
315
+ if (auth.kind !== "awsSigV4" || !auth.assumeRole)
316
+ throw new AuthError("invalid_definition");
317
+ const role = binding.awsRole;
318
+ if (!role)
267
319
  throw new AuthError("invalid_credentials");
268
- return grant;
320
+ return this.commitIssued(binding, method, {
321
+ field: auth.assumeRole.sessionField,
322
+ read: (config) => awsSessionFrom(auth, config),
323
+ usable: (previous) => awsSessionFresh(previous) ||
324
+ (!!previous &&
325
+ previous.revision !== observedRevision &&
326
+ previous.expiresAt > Date.now()),
327
+ issue: async (_previous, config) => ({
328
+ ...(await assumeAwsRole(awsAccessKey(config[auth.field]), role, {
329
+ fetch: this.options.fetch,
330
+ timeoutMs: this.options.timeoutMs,
331
+ })),
332
+ revision: randomUUID(),
333
+ }),
334
+ });
269
335
  }
270
336
  /** New tokens by the method's declared renewal, from what the binding supplies. */
271
337
  issue(auth, binding, previous) {
@@ -376,6 +442,7 @@ export class CredentialTransport {
376
442
  let { sign, grant } = await this.authorize(binding, method, input.target);
377
443
  const send = async (signer) => {
378
444
  const outgoing = {
445
+ method: verb,
379
446
  headers: new Headers(headers),
380
447
  url: new URL(url),
381
448
  body,
@@ -413,6 +480,7 @@ export class CredentialTransport {
413
480
  refuseCredentialParams(url, injectedParams(method.authentication, input.target));
414
481
  const { sign } = await this.authorize(binding, method, input.target);
415
482
  const outgoing = {
483
+ method: "GET",
416
484
  headers: new Headers(),
417
485
  url,
418
486
  base: targetBase(target).pathname,
@@ -449,6 +517,18 @@ export class CredentialTransport {
449
517
  const auth = method.authentication;
450
518
  if (auth.kind === "none")
451
519
  return { sign: () => { } };
520
+ if (auth.kind === "awsSigV4") {
521
+ const scope = targetOf(method, target)?.aws;
522
+ if (!scope)
523
+ throw new AuthError("invalid_definition");
524
+ if (!auth.assumeRole)
525
+ return { sign: sigV4(config[auth.field], scope) };
526
+ const stored = awsSessionFrom(auth, config);
527
+ const session = stored && awsSessionFresh(stored)
528
+ ? stored
529
+ : await this.renewAwsSession(binding, method, stored?.revision);
530
+ return { sign: sigV4(session, scope) };
531
+ }
452
532
  if (auth.kind === "static")
453
533
  return {
454
534
  sign: placeStatic(auth, config[auth.field], target),
@@ -45,6 +45,16 @@ export interface CredentialTarget {
45
45
  * `maxTargetResponseBytes`.
46
46
  */
47
47
  maxResponseBytes?: number;
48
+ /**
49
+ * The AWS service and region a SigV4 method signs this target's requests
50
+ * for. Every target of an `awsSigV4` method has one; no other target may.
51
+ */
52
+ aws?: AwsScope;
53
+ }
54
+ /** The service and region a SigV4 signature is scoped to. */
55
+ export interface AwsScope {
56
+ service: string;
57
+ region: string;
48
58
  }
49
59
  /**
50
60
  * Where the transport puts a static secret's parts. Every name it sets is
@@ -129,9 +139,9 @@ export type SecretPlacement = ({
129
139
  * How a request is signed. `field` names the one top-level config field
130
140
  * holding the secret: for `static`, a record of the named `parts`
131
141
  * (`staticSecretSchema(parts)`), each sent through its placements; for
132
- * `oauth2`, a revisioned OAuthGrant. `none` signs nothing: the method of a
133
- * connection that holds no optional credential, still pinned to its
134
- * targets.
142
+ * `oauth2`, a revisioned OAuthGrant; for `awsSigV4`, an AWS access key.
143
+ * `none` signs nothing: the method of a connection that holds no optional
144
+ * credential, still pinned to its targets.
135
145
  */
136
146
  export type CredentialAuthentication = {
137
147
  kind: "none";
@@ -164,6 +174,22 @@ export type CredentialAuthentication = {
164
174
  grant?: string;
165
175
  /** Defaults to 401. A 403 must be explicitly documented by the provider. */
166
176
  rejectionStatus?: 401 | 403;
177
+ } | {
178
+ /**
179
+ * AWS Signature Version 4 with the access key in `field`
180
+ * (`AwsAccessKeySchema`): a long-lived key, or a session's, with its
181
+ * token.
182
+ */
183
+ kind: "awsSigV4";
184
+ field: string;
185
+ /**
186
+ * Sign with role sessions instead: the key in `field` assumes the
187
+ * binding's `awsRole` through STS, and the session, renewed before it
188
+ * expires, is held in `sessionField` (`AwsSessionSchema`).
189
+ */
190
+ assumeRole?: {
191
+ sessionField: string;
192
+ };
167
193
  };
168
194
  export interface CredentialProbe {
169
195
  target: string;
@@ -187,7 +213,8 @@ export interface CredentialType {
187
213
  }
188
214
  /**
189
215
  * What a connection signs with: the credential type and method, and the
190
- * OAuth application, JWT identity and resource owner its config supplies.
216
+ * OAuth application, JWT identity, resource owner and AWS role its config
217
+ * supplies.
191
218
  * Derived from the connection's config alone — never from action input.
192
219
  */
193
220
  export interface CredentialSelection {
@@ -196,6 +223,8 @@ export interface CredentialSelection {
196
223
  application?: OAuthApplication;
197
224
  jwtIdentity?: OAuthJwtIdentity;
198
225
  resourceOwner?: OAuthResourceOwner;
226
+ /** The role an `assumeRole` method's sessions are issued for. */
227
+ awsRole?: AwsRole;
199
228
  /**
200
229
  * How a process signing with its own flat connection config (the CLI)
201
230
  * assembles a static secret: each of its parts, from a named config
@@ -234,6 +263,36 @@ export interface CredentialBinding {
234
263
  application?: OAuthApplication;
235
264
  jwtIdentity?: OAuthJwtIdentity;
236
265
  resourceOwner?: OAuthResourceOwner;
266
+ awsRole?: AwsRole;
267
+ }
268
+ /**
269
+ * An IAM role and how its sessions are requested: from the connection's
270
+ * public config, never from action input.
271
+ */
272
+ export interface AwsRole {
273
+ roleArn: string;
274
+ /** Names the session in CloudTrail; 2-64 of `[\w+=,.@-]`. */
275
+ sessionName: string;
276
+ /** The role trust policy's `sts:ExternalId`, when it requires one. */
277
+ externalId?: string;
278
+ /** 900 to 43200 seconds, within the role's maximum. STS defaults to 3600. */
279
+ durationSeconds?: number;
280
+ /** The region of the STS endpoint the session is requested from. */
281
+ region: string;
282
+ }
283
+ /** An AWS access key: long-lived, or a session's when it carries a token. */
284
+ export interface AwsAccessKey {
285
+ accessKeyId: string;
286
+ secretAccessKey: string;
287
+ sessionToken?: string;
288
+ }
289
+ /** A role session as stored: its key, when it expires, and its issuance. */
290
+ export interface AwsSession extends AwsAccessKey {
291
+ sessionToken: string;
292
+ /** Milliseconds since epoch. */
293
+ expiresAt: number;
294
+ /** Changes on every issuance. */
295
+ revision: string;
237
296
  }
238
297
  /** Revision changes on every issuance, even when the provider repeats the token value. */
239
298
  export interface OAuthGrant {
package/dist/index.d.ts CHANGED
@@ -12,11 +12,17 @@ export type { ActionInvocation, EngineHooks, EngineOptions, ExecuteResult, } fro
12
12
  export { ExecutionEngine } from "./core/engine.js";
13
13
  export type { BuildAuthUrlOptions, ExchangeCodeOptions, OAuthTokens, PKCEPair, RunOAuthOptions, } from "./core/oauth.js";
14
14
  export { buildAuthUrl, exchangeAuthCode, generatePKCE, OAUTH_CALLBACK_PORT, OAUTH_CALLBACK_URI, oauthCallback, runOAuth, } from "./core/oauth.js";
15
+ export { awsEndpoint, awsRegion, parseAwsXml } from "./credentials/aws.js";
16
+ export type { AwsCredentialSpec } from "./credentials/aws-plugin.js";
17
+ export { awsCredential, awsFailed, awsJson, awsList, awsQuery, awsTarget, } from "./credentials/aws-plugin.js";
18
+ export { brokerFor } from "./credentials/broker.js";
15
19
  export { downloadResource } from "./credentials/http.js";
16
- export { CredentialRegistry, OAuthGrantSchema, OAuthTokensSchema, staticSecretSchema, validateCredential, } from "./credentials/registry.js";
20
+ export type { CredentialCall, EmptyAnswer, ErrorEnvelope, StaticCredentialSpec, } from "./credentials/plugin.js";
21
+ export { answerFailed, configChoice, configFlag, credentialJson, credentialOk, credentialRequest, credentialSocketUrl, errorIdentifier, failureMessage, grantSchema, graphqlFailed, hostLabel, httpsBase, jsonAnswer, jsonOrAcknowledged, multipartBody, pathSegment, pathSegments, pathWithin, refuseUnderHost, requestFailed, responseFailed, slashEncodedSegment, staticCredential, } from "./credentials/plugin.js";
22
+ export { AwsAccessKeySchema, AwsSessionSchema, CredentialRegistry, OAuthGrantSchema, OAuthTokensSchema, staticSecretSchema, validateCredential, } from "./credentials/registry.js";
17
23
  export type { AuthenticatedRequest, CredentialBroker, CredentialBrokerCall, CredentialTransportOptions, SocketRequest, } from "./credentials/transport.js";
18
24
  export { CredentialTransport } from "./credentials/transport.js";
19
- export type { CredentialAuthentication, CredentialBinding, CredentialDeclaration, CredentialMethod, CredentialProbe, CredentialProbeResult, CredentialSelection, CredentialTarget, CredentialType, HttpMethod, LocalSecretPart, LocalSecretSource, OAuthGrant, SecretPlacement, } from "./credentials/types.js";
25
+ export type { AwsAccessKey, AwsRole, AwsScope, AwsSession, CredentialAuthentication, CredentialBinding, CredentialDeclaration, CredentialMethod, CredentialProbe, CredentialProbeResult, CredentialSelection, CredentialTarget, CredentialType, HttpMethod, LocalSecretPart, LocalSecretSource, OAuthGrant, SecretPlacement, } from "./credentials/types.js";
20
26
  export type { ActionDefinition, PluginFunction, RunlinePluginAPI, } from "./plugin/api.js";
21
27
  export { createPluginAPI, isPluginFunction, resolvePluginExport, } from "./plugin/api.js";
22
28
  export type { InstalledPlugin, PluginSource } from "./plugin/installer.js";
package/dist/index.js CHANGED
@@ -7,8 +7,12 @@ export { FileConnectionProvider } from "./connections/file.js";
7
7
  export { MemoryConnectionProvider } from "./connections/memory.js";
8
8
  export { ExecutionEngine } from "./core/engine.js";
9
9
  export { buildAuthUrl, exchangeAuthCode, generatePKCE, OAUTH_CALLBACK_PORT, OAUTH_CALLBACK_URI, oauthCallback, runOAuth, } from "./core/oauth.js";
10
+ export { awsEndpoint, awsRegion, parseAwsXml } from "./credentials/aws.js";
11
+ export { awsCredential, awsFailed, awsJson, awsList, awsQuery, awsTarget, } from "./credentials/aws-plugin.js";
12
+ export { brokerFor } from "./credentials/broker.js";
10
13
  export { downloadResource } from "./credentials/http.js";
11
- export { CredentialRegistry, OAuthGrantSchema, OAuthTokensSchema, staticSecretSchema, validateCredential, } from "./credentials/registry.js";
14
+ export { answerFailed, configChoice, configFlag, credentialJson, credentialOk, credentialRequest, credentialSocketUrl, errorIdentifier, failureMessage, grantSchema, graphqlFailed, hostLabel, httpsBase, jsonAnswer, jsonOrAcknowledged, multipartBody, pathSegment, pathSegments, pathWithin, refuseUnderHost, requestFailed, responseFailed, slashEncodedSegment, staticCredential, } from "./credentials/plugin.js";
15
+ export { AwsAccessKeySchema, AwsSessionSchema, CredentialRegistry, OAuthGrantSchema, OAuthTokensSchema, staticSecretSchema, validateCredential, } from "./credentials/registry.js";
12
16
  export { CredentialTransport } from "./credentials/transport.js";
13
17
  export { createPluginAPI, isPluginFunction, resolvePluginExport, } from "./plugin/api.js";
14
18
  export { installPlugin, listInstalled, parsePluginSource, removePlugin, } from "./plugin/installer.js";