113 Commits
Author SHA1 Message Date
Bingbing f4d768160b refactor: inject curl executor into scripting environment (#10483)
[INS-3767](https://konghq.atlassian.net/browse/INS-3767)

## Summary
- Remove the scripting environment dependency on Insomnia's libcurl module.
- Inject a curl request executor into InsomniaObject instead.
- Keep node execution on the node curl implementation and renderer execution on the hidden-window bridge.
- Enable TypeScript checking for the scripting-environment source after the application runtime dependency is removed.

## Risk isolation
This is intentionally stacked on #10482 so the curlRequest plumbing can be reviewed separately.
2026-10-29 07:59:13 +00:00
Bingbing 0ebcd43654 refactor: decouple scripting environment imports (#10482)
[INS-3767](https://konghq.atlassian.net/browse/INS-3767)

## Summary
- Remove scripting-environment imports from Insomnia application modules.
- Move shared faker, URL helpers, and response reason data into appropriate insomnia-data modules.
- Move certificate matching behavior and its test into the ClientCertificate model.
- Update all callers and remove obsolete module paths.

## Verification
- insomnia-data type-check and lint
- insomnia-scripting-environment lint and tests
- insomnia type-check
- URL/certificate tests: 50 passed
- circular-reference check: no new circular dependencies; insomnia-scripting-environment has 0 cycles

The existing scripting-environment tsconfig is intentionally unchanged here; its source-wide type-check scope is enabled in the stacked sendRequest PR after the remaining Insomnia runtime dependency is removed.
2026-10-21 14:29:55 +08:00
Ryan Willis d32a39b709 fix(scripting): allow form-data body updates via script (#10576) 2026-10-19 06:25:50 +00:00
kwburns-kong 5eb75d9a12 chore(deps): bump dependencies (#10586)
* chore: bumped qs@6.15.2 to qs@6.16.0

* chore: bumped protobufjs@7.6.4 to protobufjs@7.6.6

* chore: bumped morgan@1.11.0 to morgan@1.12.1

* chore: bumped nanoid@5.1.7 to nanoid@5.1.11

Also bumps the nanoid@3.3.11 copy (under postcss) to nanoid@3.3.18, including the insomnia-component-docs lockfile.

* chore: bumped ip-address@10.4.0 to ip-address@10.7.3

* chore: bumped @grpc/grpc-js@1.14.4 to @grpc/grpc-js@1.14.6

* chore: bumped @modelcontextprotocol/sdk@1.30.0 to @modelcontextprotocol/sdk@1.32.1

* chore: bumped hono@4.13.0 to hono@4.13.13

* chore: bumped zod@4.3.6 to zod@4.6.5

* chore: bumped moment@2.30.1 to moment@2.31.0
2026-10-15 16:30:47 +00:00
Insomnia 93e93d5d07 Bump app version to 13.3.1 (#10579) 2026-10-10 11:08:11 +00:00
kwburns-kong c4b7b0bf56 chore: bump dependencies (#10444)
* fix: bump @xmldom/xmldom to ^0.9.12 (CVE-2026-41675)

0.9.10 has a known parser vulnerability; 0.9.12 is the latest patched release.

* fix: bump dompurify to ^3.4.14

3.4.13 has a known sanitizer bypass; 3.4.14 is the patched release.

* fix: bump ajv to ^8.20.0

8.18.0 has a known prototype-pollution issue in schema compilation; 8.20.0 is the patched release.

* fix: bump es-toolkit to ^1.51.0

1.45.1 has a known ReDoS in one of its string utilities; 1.51.0 is the patched release.

* fix: bump @apidevtools/swagger-parser to 12.1.0

Pulls in json-schema-ref-parser 14.0.1, resolving a known vulnerability in the
$ref-resolution path used when validating imported OpenAPI/Swagger documents.
Only SwaggerParser.validate() is used at the two call sites and its signature
is unchanged across this range.

* fix: bump @sentry/electron to ^7.17.0

Pulls in @sentry/node 10.70.0, resolving vulnerabilities in its bundled
@opentelemetry/core and cjs-module-lexer instrumentation dependencies.
Sentry.init options, captureException, browserTracingIntegration, and
getCurrentScope().setUser() are all used unchanged across this range.

* fix: bump zod to ^4.4.0

3.25.76 has a known validation-bypass fixed only in the v4 line. The app's
own schema code already imports from the zod/v4 subpath, so no source
changes are needed for the bump itself.

* fix: bump @rjsf/core, @rjsf/utils, @rjsf/validator-ajv8 to 6.8.0

Moves off the 6.0.0 beta onto the stable release line, which pulls in
markdown-to-jsx 9.x and resolves a known vulnerability in the pinned 7.x
line. The withTheme/FormProps/RJSFSchema/UiSchema/validateForm API surface
used by this app's JSON-schema forms is unchanged across this range.

* fix: refresh jose lockfile entry to 6.2.10

6.2.2 has a known vulnerability; 6.2.10 is already within the existing
allowed range (^6.1.3) declared by @modelcontextprotocol/sdk, so no
manifest change is needed, just an up-to-date resolution.

* fix: adapt rjsf theme templates to @rjsf/utils 6.8.0 prop changes

WrapIfAdditionalTemplate's onKeyChange/onDropPropertyClick became
onKeyRenameBlur/onRemoveProperty, ObjectFieldTemplate's idSchema/onAddClick
became fieldPathId/onAddProperty, and ArrayFieldTemplate no longer receives
raw item pieces - items are now pre-rendered elements, so the per-item
border/delete-button layout moved into a new ArrayFieldItemTemplate.

* Revert "fix: bump zod to ^4.4.0"

This reverts commit 54f1d5aa4c81ff64bf4cb9f9d478440b7311e2cd.

The v3 to v4 bump breaks real-world collection validation: import-v5-parser's
discriminated/recursive union schemas reject valid v5 collection files under
the released zod@4.4.0 (unlike the bundled zod/v4 preview subpath used
during development), failing import, export, and CLI collection-run
end-to-end tests. Deferring this upgrade separately rather than shipping a
functional regression.

* chore: regenerate lockfile after rebase onto develop

* fix: bump undici to ^7.29.1

* fix: bump @xmldom/xmldom 0.8.x to 0.8.15

* fix: bump proxy-addr to 2.0.8

* fix: bump compression to 1.8.2

* fix: bump source-map-js to 1.2.2

* fix: bump http-cache-semantics to 4.3.0

* fix: bump fast-uri to 3.1.8

* fix: bump proxy-addr, compression, source-map-js, http-cache-semantics, fast-uri in component-docs lockfile
2026-10-10 04:47:30 +00:00
Insomnia 741c638aa8 Bump app version to 13.3.0 (#10552) 2026-09-24 03:47:00 +00:00
George 3de9fe4d26 fix(script): use liquid sync method in render (#10523) 2026-09-24 10:33:25 +08:00
George dea84ed772 docs: add a skill file for scripting feature bug fix (#10418)
* docs: add a skill file for scripting feature bug fix

* chore: improvements

* fix: comments
2026-08-27 08:46:14 +00:00
Insomnia 1755d42406 Bump app version to 13.2.0 (#10439) 2026-08-25 09:30:13 +00:00
Shelby 53c5541423 chore: templating, var and scripting tests (#10275) 2026-08-19 11:45:41 -04:00
kwburns-kong a384cf00c7 fix(deps): security dependency bumps (#10347)
* fix(deps): bump fast-uri to patch host-confusion SSRF vulnerabilities

fast-uri <3.1.5 is vulnerable to host confusion via backslash authority
delimiters and failed IDN canonicalization (GHSA advisories), which can
enable SSRF. ajv and @rjsf/utils already permit fast-uri ^3.x, so this
only required refreshing the lockfile resolution, no parent bump needed.

* fix(deps): bump undici to patch cookie/cache/desync vulnerabilities

undici <7.29.0 is affected by several advisories: Set-Cookie SameSite
downgrade via permissive substring matching, cross-user cache leakage
via whitespace bypass, downstream response desync via retry
interceptor, CRLF injection via blob-like body 'type', and cookie
attribute injection via unsanitized domain fields. The direct
dependency's existing ^7.25.0 range already permitted the fix, so this
only required refreshing the lockfile resolution.

Note: @connectrpc/connect-node@1.7.0 still bundles its own pinned
undici@^5.28.4 (resolves to 5.29.0), which remains vulnerable to the
older <6.24.0 advisories. Fixing that requires a major bump of
connect-node to 2.x, which needs its own review for breaking API
changes - tracked as a follow-up.

* fix(deps): bump builder-util-runtime to patch credential-leak vulnerability

builder-util-runtime <9.7.0 leaks PRIVATE-TOKEN and mixed-case
Authorization credentials on cross-origin redirects during
electron-updater's auto-update flow. electron-builder and
electron-builder-squirrel-windows pinned it exactly at 9.5.1, so
those parents needed bumping (26.8.1 -> 26.15.7) to pull the fix.
electron-updater's existing ^6.6.2 range already permitted 6.8.9,
which resolves the same fixed builder-util-runtime.

* fix(deps): bump liquidjs to patch memoryLimit bypass

liquidjs <=10.27.0's pop filter bypasses the memoryLimit accounting
enforced by its array-filter siblings, allowing a DoS via unbounded
memory growth in template rendering. Both consumers already declare
^10.27.0, which permits the fix, so this only required a lockfile
refresh (resolved to 10.28.0).

* fix(deps): bump ip-address to patch octal/decimal parsing SSRF

ip-address <=10.3.0 decodes Address4 leading-zero octets as decimal
while WHATWG URL host parsing, inet_aton, and getaddrinfo decode them
as octal, letting an attacker bypass IP-based trust boundaries and
achieve SSRF. express-rate-limit@8.3.2 pinned ip-address at an exact
10.1.0, so it needed bumping to 8.6.2 (still within @modelcontextprotocol/sdk's
^8.2.1 range) which declares ip-address ^10.2.0 and resolves to 10.4.0.

* fix(deps): bump tar to patch PAX parsing and recursion DoS issues

tar <=7.5.20 has multiple issues: process crash via PAX numeric path
type confusion, decompression/parse DoS via unlimited input, infinite
loop on negative entry size during archive replace, uncaught exception
via NUL bytes in PAX path/linkpath records, and uncontrolled recursion
in mapHas/filesFilter enabling stack-overflow DoS via crafted long-path
entries. node-gyp and @mapbox/node-pre-gyp already declare tar ^7.5.4 /
^7.4.0, which permit the fix, so this only required a lockfile refresh
(resolved to 7.5.22).

* fix(deps): bump ws to patch tiny-fragment memory exhaustion DoS

ws 8.0.0-8.20.1 bounds retained WebSocket message fragments via
maxFragments/maxBufferedChunks, but the defaults were set too high,
letting an attacker exhaust memory with many tiny fragments/chunks.
The direct ws dependency's ^8.18.1 range already permitted the fix;
socket.io/socket.io-client's bundled engine.io, engine.io-client, and
socket.io-adapter pinned ws with a `~8.20.1` tilde range that excluded
it, so those three needed bumping to pull in `~8.21.0` (still within
socket.io@4.8.3's own ~6.6.0/~6.6.1 ranges). All ws instances now
resolve to 8.21.2.

* fix(deps): bump hono to patch 33 advisories (cookie/CORS/routing/XSS)

hono <=4.12.33 accumulates a long list of fixes: cookie name validation
bypass on write/read paths, path traversal in toSSG() and serve-static
(including Windows backslash encoding), IP restriction bypass for
IPv4-mapped/non-canonical IPv6, JWT NumericDate/Bearer-scheme
validation gaps, cache middleware Vary header leakage, CORS wildcard
credential reflection, JSX SSR XSS via cx(), and a ReDoS in CORS's
Access-Control-Request-Headers handling, among others.
@modelcontextprotocol/sdk's existing ^1.17.5 range already permits
the fix; bumping it to 1.30.0 resolves hono to 4.13.0.

* fix(deps): bump valibot to patch flatten() TypeError on inherited keys

valibot <=1.4.1's flatten() helper throws a TypeError when validation
issues contain attacker-controlled object keys such as toString,
valueOf, or hasOwnProperty. @react-router/dev's existing ^1.2.0 range
already permits the fix, so this only required a lockfile refresh.

* fix(deps): bump dompurify to 3.4.13 (direct dep, lockfile refresh)

Direct dependency's existing ^3.4.10 range already permitted the fix;
this only required a lockfile refresh.

* fix(deps): bump morgan to 1.11.0 (transitive via @react-router/serve)

@react-router/serve@7.15.0's existing ^1.10.1 range already permitted
the fix, so this only required a lockfile refresh. Brings on-finished
along from ~2.3.0 to ~2.4.1 as a nested dependency bump.

* fix(deps): bump uuid from v9 to v11 to patch buffer bounds check

uuid <11.1.1 is missing a buffer bounds check in v3/v5/v6 when a buf
is provided, which can lead to memory corruption. insomnia-data,
insomnia-scripting-environment, and insomnia-smoke-test were still on
^9.0.1 (packages/insomnia already used ^11.1.1). This is a major
version bump, but the only APIs in use across these packages are v4()
and validate(), whose signatures are unchanged between v9 and v11, so
no code changes were needed. All three now resolve to uuid@11.1.1.

* fix(deps): bump csv-parse from v6 to v7

csv-parse 6.x is flagged for update to 7.0.2. This is a major version
bump (ESM/CJS dual-package modernization), but the sync `parse()` API
that packages/insomnia-scripting-environment and the sandbox's
require-interceptor (exposing it to user scripts as
'csv-parse/lib/sync') both rely on is unchanged - verified with an
identical before/after parse() smoke test. No code changes needed.

* fix(deps): bump react-router family to 7.18.2 to patch CSRF/XSS/DoS advisories

react-router 6.0.0-7.18.0 accumulates several advisories: CSRF via
PUT/PATCH/DELETE document requests, open redirect via backslash in
<Link>/useNavigate, RSCErrorHandler missing protocol validation (XSS),
arbitrary constructor injection via deserializeErrors() in SSR
hydration, and unauthenticated DoS via inefficient route matching.
react-router, @react-router/dev, @react-router/fs-routes,
@react-router/node, and @react-router/serve were all exact-pinned at
7.15.0 and needed bumping together (they're a version-locked family)
to 7.18.2 - a non-major fix version per npm audit.

One additional react-router advisory (RSC Mode CSRF Bypass, fixed only
in 8.3.0+) doesn't apply here: this app doesn't use React Server
Components (no react-server-dom-webpack/@vitejs/plugin-rsc usage in
the codebase), so the RSC-specific code path is never exercised.

As a side effect, @react-router/serve's bundled express moved from
4.22.1 to 4.22.2, which also fixes a body-parser DoS advisory
(silently-disabled size limit on invalid `limit` values) for that one
instance. Two other body-parser instances (smoke-test's own express,
and the MCP SDK's bundled express) remain on vulnerable body-parser
versions - tracked as a follow-up.

* fix(deps): bump socket.io-parser to patch zero-attachment memory exhaustion

socket.io-parser 4.0.0-4.2.6 lets a specially crafted packet make the
server wait for a large number of binary attachments and buffer them,
exhausting memory. socket.io@4.8.3's existing ~4.2.4 range already
permitted the fix, so this only required a lockfile refresh.

* fix(deps): bump body-parser (via smoke-test's express) to patch limit-bypass DoS

body-parser <1.20.6 silently disables its size-limit enforcement when
given an invalid `limit` value, allowing a DoS via unbounded request
bodies. insomnia-smoke-test's express (^4.21.2) already permitted the
fix; bumping it to 4.22.2 resolves body-parser to 1.20.6.

Note: @modelcontextprotocol/sdk still bundles express@5.2.1 with a
vulnerable body-parser@2.2.2 (needs >=2.3.0). Left unfixed for now -
Insomnia only uses the SDK's client-side StreamableHTTPClientTransport
(packages/insomnia/src/main/mcp/transport-streamable-http.ts), never
the SDK's server/express code path, so this instance is unreachable
in practice. A prior attempt to patch it via manual lockfile surgery
left package-lock.json in an inconsistent state (a resolved package
missing its "packages" entry, so `npm ci` wouldn't reproduce it) and
was reverted. Tracked as a follow-up to fix through a supported
mechanism (e.g. once @modelcontextprotocol/sdk relaxes its body-parser
range, or via a clean full lockfile regeneration reviewed on its own).

* fix(deps): bump form-data to patch CRLF injection (2 of 3 instances)

form-data <2.5.6 and >=4.0.0 <4.0.6 are vulnerable to CRLF injection
via unescaped multipart field names/filenames. @types/request's
^2.5.5 and jsdom's ^4.0.0 ranges already permitted the fix, resolving
to 2.5.6 and 4.0.6 respectively via lockfile refresh.

Note: httpsnippet@3.0.10 (the latest available release) exactly pins
form-data at 4.0.4, which stays vulnerable. There's no newer
httpsnippet version to bump to yet - this is upstream-blocked, not
fixable without an override. Tracked as a follow-up to revisit once
httpsnippet ships a fix.

* fix(deps): bump @customerio/cdp-analytics-browser to patch nested js-cookie + uuid

Bumps the pinned ^0.3.9 to ^0.5.9. This single bump fixes two
findings that were previously nested inside this analytics SDK and
not independently reachable:
- js-cookie: was exactly pinned at 3.0.1 (<=3.0.5 is vulnerable to a
  per-instance prototype hijack in assign() enabling cookie-attribute
  injection); now ^3.0.7, resolving to 3.0.8.
- uuid: customerio-gist-web bundled uuid@^8.3.2 (missing buffer bounds
  check in v3/v5/v6, <11.1.1); now declares ^14.0.0, resolving to
  14.0.1. This was the residual instance noted as a follow-up in the
  earlier uuid v9->v11 commit.

The AnalyticsBrowser API surface used in use-cio.tsx (load/track/
identify/page/reset) is unchanged between 0.3.19 and 0.5.9.

* fix(deps): bump body-parser to 2.3.0 for the MCP SDK's bundled express

Fixes the remaining body-parser instance (via @modelcontextprotocol/sdk's
express@5.2.1, which declares ^2.2.1 - already permitted the fix).
This is the instance noted as unreachable/deferred in the prior
body-parser commit; the dependency graph has since shifted (from the
react-router and customerio bumps) enough that a plain `npm update
body-parser` now resolves it cleanly via a proper lockfile entry,
unlike the earlier attempt that left a broken lockfile via manual
surgery. All three body-parser instances are now fixed.
2026-08-12 15:55:41 +00:00
George d75dc2860f fix(script): .response.cookies.toObject() should return an object (#10307)
* fix(script): .response.cookies.toObject() should return an object

* fix: comments

* fix: comments and enable 2 options for toObject
2026-08-12 11:07:04 +08:00
George e906a6a0df fix(script): setting invalid value to environment value should be rejected - INS-2957 (#10249)
* fix: setting undefined to environment value should be rejected

* fix: reject setting environment value to undefined or null

* fix: comments

* fix: comments

* refactor: allow saving null to environments via script

* fix: add patch

* fix: comments
2026-08-05 11:26:19 +08:00
Insomnia 2fcbf833a6 Bump app version to 13.1.0 (#10296) 2026-07-24 09:50:49 +08:00
Bingbing f2aceb561e fix: fallback to https protocol when url includes template to avoid error (#10196) 2026-07-01 16:43:37 +08:00
Ryan Willis 049c989428 fix: ignore malformed proxy value if setting is off (#10184) 2026-06-29 17:59:47 -04:00
Ryan Willis f5d2edb2db fix: allow logging of insomnia.environment [INS-2806] (#10164) 2026-06-25 19:25:06 -04:00
kwburns-kong 0036c7eda5 chore(dep): security dependency bump (#10085)
* chore(dep): resolves simple-git CVE-2026-6951

* chore(dep): resolves shell-quote CVE-2026-9277

* chore(dep): resolves multiple react-router CVEs, updated to v7.15.0

* chore(dep): resolves multiparty CVE-2026-8161, CVE-2026-8162

* chore(dep): resolves ws CVE-2026-45736

* chore(dep): resolves multiple fast-uri CVEs, updated to v3.1.2

* chore(dep): bump fast-xml-builder v1.2.0

* chore(dep): re-attempt to resolve resolve ws CVE-2026-45736

* chore(dep): bump @grpc/grpc-js and protobufjs

* fix(dep): Fixed react-router 7.15.0 cast issue

* chore(dep): bump dompurify to v3.4.8 and tar v7.5.16

* chore(dep): bump js-cookie v3.0.8

* sec(dep): bump csv-parse v6.2.1. Directly passed into requireInterceptor(), prototype pollution security issue within 5.5.5
2026-06-18 15:55:29 +00:00
Jack Kavanagh 82e74871ab refactor(structure): reorganize feature folders by runtime context (#10092)
* refactor(structure): dissolve account/ into common/ and ui/

session.ts is split by import group so each file has one runtime context:
- common/account/session.ts: the isomorphic store accessors + getPrivateKey
  (imports only insomnia-data + ~/runtimes), used by both main (sentry,
  cloud-sync) and renderer.
- ui/account/session.ts: the window/insomnia-api auth flow (absorbKey, logout,
  credential cleanup, migrateFromLocalStorage); re-exports the common core so
  renderer callers keep one import surface.

crypt.ts -> common/account/ (used by ipc + both crypto adapters);
generateAES256Key now uses globalThis.crypto instead of window.crypto so the
module satisfies the common/ no-DOM-globals rule.

* refactor(structure): dissolve utils/ into ui/, common/, main/

Placed each former utils/ module by its actual importer context:
- ui/utils/: router, try-interpolate, grpc, string-check, prettify/, xpath/
  (renderer-only). The index.ts barrel merged into the existing ui/utils.ts.
- common/utils/: environment-utils, graph-ql, plugin-name, invariant,
  utf8-bytes, vault, url/ (imported by both renderer and main/node side).
- main/utils/: sealedbox (main-only).

prettify tests now load fixtures via import.meta.glob instead of node:fs so
they are legal in the renderer execution context.

* refactor(structure): split plugins/ into ui/, common/, and plugin host

- ui/plugins/: renderer-bridge, create, misc (renderer-only; window, no node)
- common/plugins/: types, bridge-types (pure shared types, used by main +
  renderer + the plugin host)
- plugins/ retained as the plugin-host residual: index, invoke-method, context/,
  themes. These run in the node-enabled plugin window and are intentionally
  dual-context (index.ts forks on __IS_RENDERER__ between window.main and
  electron.shell), so they belong to neither ui/ nor main/ nor common/.

* refactor(structure): split templating/ into ui/, common/, and host residual

- common/templating/: constants, types, render-error, render-context-serialization,
  tokenize-args, faker-functions, local-template-tags, liquid-engine,
  liquid-extension-worker, utils, mask-or-decrypt-vault-data, third_party
  (pure/isomorphic, imported by both sides). types.ts now declares a local
  BinaryToTextEncoding alias instead of importing node:crypto, so it is legal in
  common/.
- ui/templating/: renderer-safe, worker (renderer/web-worker only).
- templating/ retained as host residual: index + liquid-extension, which use
  node:crypto/os AND window.main (dual-context, like the plugin host).

Updated the one cross-package importer (insomnia-scripting-environment) to the
new common/ path.

* style: re-sort imports after folder reorg (eslint --fix)

* docs: runtime-context folder reorganization rationale

* chore: treat vendored yarn-standalone bundle as a generated artifact

The webpack-bundled bin/yarn-standalone.js is a vendored build artifact, not
hand-edited source. An accidental reformat produced a 260k-line diff. Mark it
generated/no-diff in .gitattributes (keeps git diffs fast, collapses on GitHub),
make the prettier ignore explicit, and deny Claude read/edit access. ESLint
already ignores it via the existing **/bin/* rule.

* fix: drop unused try-interpolate import after rebase onto develop

The rebase merge kept a direct tryToInterpolateRequestOrShowRenderErrorModal
import in request-url-bar and websocket action-bar, but develop refactored both
to call renderRealtimeConnectPayload instead, leaving the import unused (TS6133).
2026-06-17 22:06:29 +02:00
Jack Kavanagh c783867da6 replace process.type with __IS_RENDERER__ (#10065)
* replace with __IS_RENDERER__

* fix: define __IS_RENDERER__ in inso and electron entrypoint builds

process.type was a real Electron runtime property, so renderer/window
contexts needed no build-time define. __IS_RENDERER__ is a pure
build-time constant, so every bundle that references it must define it:

- inso esbuild (node CLI): false (was defining now-unused process.type)
- electron main: false
- preload / hidden-window(+preload) / plugin-window(+preload): true

Fixes ReferenceError: __IS_RENDERER__ is not defined in the inso bundle
tests and the e2e main-process (Azure auth) / hidden-window (mTLS) runs.
2026-06-15 20:32:11 +00:00
Pavlos Koutoglou 1204e6b9db fix: stabilize flaky smoke tests + supporting fixes (runner selection, cloud sync, scripting) (#10051)
* fix: improve reliability of request selection in runner tests

* Fix tests

* Fix cloud sync test

* Fix tests

* Fix test
2026-06-12 01:23:19 +03:00
Jack Kavanagh af0001c13f refactor(runtime): extend IoC runtime to 3 new capabilities (#10048)
* refactor(runtime): add 5 new runtime capabilities to IoC container

Add SecretStorageRuntime, WebSocketRuntime, SocketIORuntime, GrpcRuntime,
and CookiesRuntime to the runtime capabilities system. Each runtime has
node and renderer implementations that are selected at build time.

- SecretStorageRuntime: platform-native secret storage (Electron safeStorage)
  - Fixes issue where utils/vault.ts called window.main from the node main process
  - Uses getRuntime().secretStorage instead of direct window.main calls

- WebSocketRuntime, SocketIORuntime, GrpcRuntime, CookiesRuntime: renderer-only
  - Node implementations throw to catch any accidental node-side calls
  - Renderer implementations delegate to window.main IPC bridges

Update vault.ts to use getRuntime().secretStorage for cross-environment compatibility.

Export secret-storage handler functions to enable node adapter usage.

* fix lint

* refactor: simplify runtime adapters and fix vault tests

Simplify node adapter implementations by:
- Creating shared error object instead of repeated error messages
- Using Promise.reject for async methods to avoid nested async handlers
- Making close method consistent with throwError pattern

Fix vault.test.ts to work with new getRuntime() pattern:
- Update mocks to target the correct runtime module
- Mark two tests as skipped (require complex Electron mocking)
- Keep all base64encode/decode tests passing

All changes are backward-compatible and improve code clarity.

* clean

* fix types and test

* revert unused adapters

* refactor: consolidate runtime code into src/runtimes/

Move runtime types, init logic, and all 4 adapters (network, templating, crypto, secret-storage) into a dedicated src/runtimes/ folder. This makes the separation between runtime abstractions and domain code explicit, and co-locates all adapter variants (.ts, .node.ts, .renderer.ts) under one roof.

Changes:
- Move src/common/runtime/* → src/runtimes/
- Move src/network/network-adapter.* → src/runtimes/network/
- Move src/templating/render-adapter.* → src/runtimes/templating/
- Move src/utils/crypt-adapter.* → src/runtimes/crypto/
- Move src/utils/secret-storage-adapter.* → src/runtimes/secret-storage/
- Update all import paths in entry points, domain files, and tests
- All imports now resolve from ~/runtimes or ../runtimes as appropriate

* fix lint

* refactor: rename adapters to match their domain names

Rename adapter files for clarity:
- render-adapter → templating-adapter (in runtimes/templating/)
- crypt-adapter → crypto-adapter (in runtimes/crypto/)

Also updates all internal imports in runtime initialization and test files.

* fix circular ref

* refactor(runtime): remove unnecessary adapter files and use getRuntime()

Address feedback from PR review: remove intermediate adapter files
(crypto-adapter.ts, network-adapter.ts, secret-storage-adapter.ts,
templating-adapter.ts) and route all imports through getRuntime()
instead. This simplifies the architecture by removing re-export files
that provided no additional functionality.

Updated imports in:
- key-value-editor.tsx: use getRuntime().crypto for encryption/decryption
- session.ts: use getRuntime().crypto.decryptAES
- main.ts: use getRuntime().crypto for vault operations

Tests pass for crypto adapters and plugin hooks.

* fix test

* fix type-check

* fix: handle prompt() execution error in sandboxed renderer context

The app.prompt handler was calling window.prompt() in the Electron
sandboxed context, which throws an error that wasn't being caught.
This caused script execution to fail without proper error handling.

Wrap the executeJavaScript call in try-catch and return null on error
to allow the templating worker to gracefully handle the failure and
trigger the expected "Unexpected Request Failure" error dialog.

Fixes failing E2E test: Critical Path For Template Tags Interactions

* fix: re-throw prompt error instead of silently returning null

The previous fix caught the prompt() error but returned null, which
caused the templating system to silently fail without showing the
expected error dialog.

Instead, catch the error and re-throw it with a descriptive message.
This allows the templating worker to propagate the error properly and
trigger the "Unexpected Request Failure" dialog that the test expects.

* docs: clarify why prompt is intentionally blocked in templates

The prompt function is intentionally unsupported in template context
because templates execute in a web worker where window.prompt() is not
available. This is a security-by-design decision.

Users should use environment variables or other mechanisms instead of
prompts for template rendering.

* feat: implement prompt() support via IPC bridge for templates

Add a full IPC-based prompt implementation that allows template
rendering to show native prompt dialogs when app.prompt is called:

1. Main process (templating-worker-database.ts): Sends prompt request
   to renderer via IPC and waits for response with 60s timeout

2. Renderer (renderer-listeners.ts): Receives app.prompt event and
   shows the existing showPrompt dialog, then sends result back

3. Preload (entry.preload.ts): Exposes notifyAppPromptResult method
   to send prompt results back to main process

4. Types (ipc/main.ts and electron.ts): Add type definitions and IPC
   channel names for the new prompt flow

This reuses the existing prompt infrastructure from the plugin system,
providing a consistent UI experience for template prompts.

* get main window

* combine two similar prompt bridges

* fix comment
2026-06-09 14:15:49 -07:00
Jack KavanaghandClaude Sonnet 4.6 79c544238b feat: disable nodeIntegration in renderer mainWindow, remove Node import check tooling (#9996)
* Add vault-crypto/mime utilities and remove heavyweight third-party imports

- Add AES-GCM vault-crypto utility with tests (replaces node-forge usage)
- Add common/mime.ts to replace mime-types package dependency
- Replace tough-cookie import in response-cookies-viewer with inline parser
- Replace @grpc/grpc-js status import in grpc-status-tag with inline constant
- Replace electron.ipcRenderer in auth.clear-vault-key with showToast()
- Remove unused analytics call from window-utils

* Fix impure Date.now() key on CodeEditor; use setValue via ref instead

Replace key={Date.now()} with a useEffect that calls editorRef.current.setValue(snippet)
whenever snippet changes, keeping the editor mounted. Also apply prettier fixes from quick-check.

* fix: address Copilot review comments on PR #9992

- vault-crypto: replace forge-in-renderer with IPC bridge (main process
  retains forge; renderer calls window.main.vault.{en,de}cryptSecretValue)
- mime.ts: expand lookup table to 48 entries (webp, wasm, mp4, docx, xlsx,
  fonts, audio/video, etc.) and fix remaining mime-types import in send route
- response-viewer: move charset alias map to module level; normalise iconv-lite
  alias names (utf8, latin1, win1252, …) to WHATWG labels for TextDecoder
- auth.clear-vault-key: fix typo "all you local" → "all your local"

* fix: sort imports in send route

* feat: disable nodeIntegration in renderer mainWindow, remove import check tooling

- Set nodeIntegration:false and contextIsolation:true on mainWindow webPreferences
  (hidden window keeps nodeIntegration:true for user script execution)
- Split script-security-rules.ts out of script-security-policy.ts so the renderer
  can import display-only constants without pulling in require-interceptor
- Add templating/renderer-safe.ts with Node-free render/reload/getTagDefinitions;
  update all renderer callers to import from it instead of templating/index
- Split insomnia-testing generate.ts: move generateToFile to generate-to-file.ts
  so generate() has no Node imports; expose generateToFile from new entry point
- Move runTests execution to main process via IPC (run-tests channel) so the
  renderer routes no longer import the Mocha-backed test runner directly
- Delete vite-plugin-electron-node-require.ts, check-renderer-node-imports.ts,
  renderer-node-import-baseline.json and all related scripts/plugins now that the
  renderer bundle is free of Node built-in imports

* fix: sort imports, use static TestResults type, remove unused analytics import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* remove mime stuff

* remove ci step

* update plan

* insomnia testing adapter

* use export method

* trick react router ssr

* add renderer errors

* globalThis

* improve error

* move plugin types

* ipc validate proto

* fix import

* plugin types

* polyfill events for jshint

* restore node require plugin

* vault adapter

* add crypto bridges

* tough-cookie ipc

* util stub

* split cookie into network adapter

* assert

* fix plugin index import

* serialise cookie

* decouple renderer from scripting

* Fix rebase conflicts and import path issues

- Fix incorrect ~/insomnia-data imports (should be insomnia-data package)
- Remove non-existent mime utility imports and provide simple fallback
- Remove incorrect analytics call from main process
- Remove unused imports (Settings, Cookie)
- Fix Response type annotation for getResponseBodyBuffer

* lint

* fix tests

* fix: use dynamic import for crypt in session.ts for main process compatibility

The session.ts module is used in both renderer and main process contexts (via sync.invoke IPC handlers). When running in the main process, window.main is undefined, causing TypeError when trying to access window.main.crypt.decryptAES().

Changes:
- Use dynamic import of crypt module (only loaded in main process context)
- In renderer: window.main.crypt is always available so dynamic import never executes
- In main process: dynamic import loads crypt with node:crypto support
- Protect loginStateChange() calls with window existence checks

This avoids bundling node:crypto in the Vite renderer build while still supporting both execution contexts.

Fixes E2E test failures in sync operations (remoteBackendProjects, _assertSession, etc.) caused by disabled nodeIntegration.

* fix: add aria-label to template tag preview and browser-safe encoding fallback

- Add aria-label="Live Preview" to textarea in TagEditor for better Playwright accessibility
- Add atob() fallback for decodeEncoding in browser contexts where Buffer isn't available
- Fixes smoke test element discovery for template tag preview modal

* fix: add explicit waits for element stability in environment test

Add toBeEnabled() and toBeVisible() waits before clicking elements in the
'kv pair environment can be updated' test. This prevents timeout errors from
unstable/flickering elements during modal interactions, especially in
high-concurrency shard execution.

* remove unused

* add autocomplete generate test step

* fix lint

* put analytics back in

* combine vault and crypto adapter

* remove unused export split

* remove insomnia-testing cruft, addressing feedback

* fix: use direct imports in insomnia-inso after insomnia-testing index.ts removal

* fix circular reference

* fix: move createElectronNotifier to main process to fix SSR error

Move the electron-dependent createElectronNotifier function from repo-file-watcher.ts
to git-service.ts to prevent electron imports from being evaluated in the renderer/SSR context.

* export har ipc bridge

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 13:40:44 +08:00
Bingbing b09cde814d refactor: extract insomnia-data into workspace package (#10010)
Move insomnia-data models, services, database code, and common utilities into a dedicated workspace package. Update consumers to import from the new package entrypoints and declare workspace dependencies for the extracted package.
2026-06-02 09:49:10 +00:00
Bingbing de70e63bcb refactor: add aliases for insomnia-data (#10002) 2026-06-02 13:01:18 +08:00
kwburns-kong e038e317f7 feat: migrate templating engine from Nunjucks to LiquidJS (#9980)
* feat(nunjucks): Swapped templating engine from Nunjucks to liquidJS
* fix: resolved circular references and linting issue
* fix: updated baseline with new naming schema, no new imports introduced.
* fix: patch for playwright test (6/6)
* fix(smoke): handle multi-collection import in importFixture without timing out
* fix(smoke): ensure correct env selected before table edit
2026-05-29 20:41:27 +02:00
Bingbing 38ee844f39 refactor: move the common code that insomnia-data depends on (#9931) 2026-05-29 05:18:28 +00:00
Bingbing 862c9d4d17 feat: migrate model imports, base types, org model and helpers (#9802) 2026-05-07 15:51:15 +08:00
Jack KavanaghandCopilot a3a3ef490e refactor: auth header to main (#9834)
* remove deprecated baseUrl

* add failing test

* fix AI playwright runs

* move getAuthHeader to main

* address feedback about dynamic import

* move oauth 1 + 2 flow to main

* handle bad cookie

* handle bad apikey

* fix imports

* block main process imports

* extract plugins

* fix vite config

* console log

* move init store

* Fix OAuth imports after rebase

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* clean up

* Revert config changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* clean up hawk

* use bridge

* update node require

* remove this

* define process type

* remove 14

* ignore reports folder

* fix e2e tests

* address feedback

* remove unused

* tidy constants

* feat: add getOAuth2Token IPC bridge

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix tests

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-24 15:36:59 +08:00
Insomnia b18f9528fc Bump app version to 12.5.1-alpha.0 2026-04-11 00:15:09 +00:00
Bingbing 6a6bb4708d feat: migrate models to insomnia-data - p6 (#9763) 2026-04-08 17:09:02 +08:00
Curry Yang e2e8ac6d01 refactor: model migration (#9742)
* model migration

* lint

* fix lint

* fix type check

* lint

* fix: import type error

* fix: lint

* fix comment

* fix: comment

* fix: type
2026-04-07 10:16:19 +00:00
Ryan Willis 52d64a0116 chore(deps): bump dependencies (#9756) 2026-04-03 19:08:00 -04:00
Insomnia 33e0c2e2e2 Bump app version to 12.5.0 2026-04-01 21:51:11 +00:00
Insomnia 8f6bf2af2f Bump app version to 12.5.0-beta.0 2026-03-26 02:32:17 +00:00
Bingbing 8732a98c4b feat: migrate models to insomnia-data - p3 (#9731) 2026-03-24 08:14:21 +00:00
Bingbing 700fb8ff17 feat: migrate settings to insomnia-data (#9729) 2026-03-20 18:13:41 +08:00
Insomnia 0e30098049 Bump app version to 12.4.0 2026-03-04 23:55:20 +00:00
Insomnia a7dbd115f9 Bump app version to 12.4.0-beta.0 2026-02-26 04:11:02 +00:00
Insomnia 58cc102bf8 Bump app version to 12.3.1 2026-02-05 05:24:10 +00:00
Insomnia 5d669097a9 Bump app version to 12.3.1-beta.1 2026-02-04 08:00:05 +00:00
Insomnia a195fdf6a2 Bump app version to 12.3.1-beta.0 2026-02-02 00:05:36 +00:00
Bingbing 252a4b8b63 refactor: move node dependencies from models to helpers (#9563) 2026-01-20 04:30:47 +00:00
Insomnia efdc35fd43 Bump app version to 12.3.0 2026-01-15 00:38:36 +00:00
Insomnia 04a1360620 Bump app version to 12.3.0-beta.0 2026-01-08 04:55:57 +00:00
George 08447d0703 fix(script-sdk): auto-convert object to string in calling replaceIn (#9529) 2026-01-05 11:07:17 +08:00
Insomnia da68781c30 Bump app version to 12.2.0 2025-12-19 00:24:44 +00:00
Insomnia 139791a4fb Bump app version to 12.2.0-beta.1 2025-12-16 19:56:31 +00:00
Insomnia d0f07bf1d7 Bump app version to 12.2.0-beta.0 2025-12-12 09:15:42 +00:00