Commit graph

2072 commits

Author SHA1 Message Date
Shreyas
e9096eaca1
fix(common): url and param encoding (#5041) 2025-05-08 15:29:08 +05:30
Chhavi Goyal
b6e2e93457
feat: import authorization header with curl (#4963) 2025-05-08 15:08:50 +05:30
jamesgeorge007
9e8ecd97d0 chore: bump version to 2025.4.1 2025-05-07 16:21:39 +05:30
shuaixr
dafe56cfe9
fix: default Content-Type to x-www-form-urlencoded when importing curl POST with body (#5040)
fix: handle missing Content-Type when importing curl POST

When importing a curl POST request with a body and no explicit
Content-Type, default to `application/x-www-form-urlencoded`
to match curl's behavior.

Reference: https://everything.curl.dev/http/post/content-type.html
2025-05-07 14:25:45 +05:30
jamesgeorge007
77daa1f589 chore: update inspector warning regarding supported interceptors
Proxy interceptor doesn't support Digest & HAWK Auth.
2025-04-30 12:51:45 +05:30
jamesgeorge007
63135a0633 chore: bump CLI version 2025-04-29 15:12:57 +05:30
jamesgeorge007
bed898b523 chore: define supported interceptors for HAWK authentication
Update lockfile.
2025-04-29 15:07:32 +05:30
Anwarul Islam
ccf3c6f834
feat: add support for HAWK authentication (#4694)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-04-29 14:51:16 +05:30
Mir Ishfaq Hussain
cccd711507
refactor(backend): formatting updates in TeamEnvironmentsService (#4388)
Co-authored-by: mirarifhasan <arif.ishan05@gmail.com>
2025-04-29 14:37:03 +05:30
Raphael Hehl
cb52a582ac
feat(backend): add getTracker method for IP extraction (#3535)
Co-authored-by: Raphael Hehl <Raphael.Hehl@deutschebahn.com>
2025-04-29 14:29:01 +05:30
Dmitry
12f35d880d
feat: add file extensions to response exports (#4367)
Co-authored-by: Dmitry Mukovkin <d.mukovkin@cft.ru>
2025-04-29 13:51:34 +05:30
Shreyas
8c6ec87f90
fix(relay): better matching for content-type detection (#5025) 2025-04-29 13:10:08 +05:30
Andrew Bastin
decbb56c9f chore: bump vulnerable dependencies 2025-04-28 15:11:15 +05:30
jamesgeorge007
3219cb3b5d chore: bump version to 2025.4.0 2025-04-25 20:47:28 +05:30
jamesgeorge007
2b591b9536 test: resolve flaky CLI tests
Move to the in-house echo service for reliability.
2025-04-25 20:45:32 +05:30
Shreyas
fbeb0e56be
feat(desktop): file-based logs with rotation (#5009)
This PR adds a file-based logging system with size-based rotation to the desktop application. It essentially redirects existing diagnostic to size-based rotating files for troubleshooting environment-specific issues.

Closes HFE-801

The desktop application currently lacks a persistent logging mechanism in production environments. Logs are only available through the development mode console.

This PR will help diagnose issues reported in #4859, #4950, #5003, discussions #4984 and #4986.

Mainly aiming to understand errors in specific environments that can't be reproduced in our testing setups.

This implementation uses the tracing ecosystem (`tracing`, `tracing_subscriber`, `tracing_appender`) along with `file_rotate` to create log files in the platform's log directory. The logs are automatically rotated when they reach `10MB`, with a maximum of `5` files retained.

Thinking 10 * 5 MB is reasonable disk usage while maintaining sufficient history.

The system currently writes to both the console (with ANSI colors where supported) and to files (without ANSI formatting for readability). Log levels are currently controlled via the `RUST_LOG` environment variable, defaulting to "debug" when not specified.

| OS      | Log File Path                                        |
|---------|------------------------------------------------------|
| Windows | `C:\Users\<username>\AppData\Local\io.hoppscotch.desktop\logs\io.hoppscotch.desktop.log` |
| macOS   | `~/Library/Logs/io.hoppscotch.desktop/io.hoppscotch.desktop.log` |
| Linux   | `~/.local/share/io.hoppscotch.desktop/logs/io.hoppscotch.desktop.log` |
2025-04-25 17:09:51 +05:30
Shreyas
13b46d52f2
fix(desktop): disk space detection (#5019)
This fix replace `sys-info v0.9.1` with
the more actively maintained `sysinfo 0.34.2`
which does return size of the disk in bytes.

Closes #5017, HFE-831

Rebased on #5010, consider merging that first.

Issues:

Appload fails to load with a "Storage full" error despite
having sufficient disk space.

This was caused by a unit mismatch in the `sys-info` crate
which returns disk space in kilobytes instead of bytes.

- sys_info::disk_info() returns values in KB, see:
  60ecf1470a/c/linux.c (L119)
- The `StorageFull` error was triggered when comparing
  raw bytes against a KB value, causing false positive

Changes:
- Rewrite the `ensure_space` function to find the correct disk of the config dir
- Add a new `StorageError::DiskNotFound` for cases where the disk cannot
  be resolved
2025-04-25 16:57:37 +05:30
Shreyas
93787f8389
fix(desktop): add win version checks for DWM attr api (#5010)
fix: add win version checks for DWM attr api

This adds version checking before using Windows 11-specific DWM APIs.

Closes HFE-821

The desktop app crashes on startup on older Windows versions (pre-Windows 11)
due to unsupported DWM API calls for dark mode and caption styling.

According to docs at https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute,
both `DWMWA_USE_IMMERSIVE_DARK_MODE` and `DWMWA_CAPTION_COLOR` attributes
are only supported starting with Windows 11 Build 22000.

> DWMWA_USE_IMMERSIVE_DARK_MODE: [...] This value is supported starting
> with Windows 11 Build 22000"

and

> DWMWA_CAPTION_COLOR: [...] This value is supported starting
> with Windows 11 Build 22000.

See https://github.com/hoppscotch/hoppscotch/discussions/4984 for more details,
for reports of app crashing immediately on startup with these errors:

```
Failed to set dark mode: Error { code: HRESULT(0x80070057), message: "The parameter is incorrect." }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[0417/150158.530:ERROR:window_impl.cc(122)] Failed to unregister class Chrome_WidgetWin_0. Error = 1412
```

The tests were all over the place, both attributes (sometimes!) seems to be present
on Windows 10 1809 and even earlier, only if it was installed with network access,
so perhaps this is due to Windows updates? Other times, they weren't, especially on VMs.

The issue is reproducible on Windows Server 2019 Datacenter (v10.0.17763),
which is equivalent to Windows 10 version 1809.

This version is too old to support DWMWA_USE_IMMERSIVE_DARK_MODE,
which is only **officially supported** starting with Windows 11 Build 22000
according to Microsoft's documentation.

So at the moment, relying on official docs seems to be the right call,
and themes are definitely something app shouldn't crash for regardless.
2025-04-25 16:48:43 +05:30
Joel Jacob Stephen
485ac8c3c6
refactor(sh-admin): dashboard settings page redesign (#5014) 2025-04-24 20:24:32 +05:30
moaqz
a208125c7d
chore(i18n): update es translation (#4999) 2025-04-24 16:59:47 +05:30
Nivedin
f1b1a8894b
feat: add colour highlight for codesnippet (#5006)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-04-24 16:54:18 +05:30
jamesgeorge007
236db8396b chore: bump version to 2025.3.2 2025-04-15 13:16:56 +05:30
Akhil
4460751389
fix: account for templates directory in ARM images (#4992) 2025-04-15 13:13:53 +05:30
Nayan
45d99a48a2
fix(common): refine profile field validations (#4995) 2025-04-15 13:09:37 +05:30
atrimpe-ford
72cff75277
chore: truncate long secret environment variables (#4958)
Co-authored-by: nivedin <nivedinp@gmail.com>
2025-04-11 17:25:12 +05:30
Shreyas
80b63545f1
fix(common): extention interceptor response meta (#4980) 2025-04-10 13:28:20 +05:30
Anwarul Islam
3c150ec90a
feat(common): enhanced cookie parsing from curl arguments (#4977) 2025-04-10 12:56:05 +05:30
Anwarul Islam
111fdccfc8
feat: allow multiple params with same key to process get request queryparams (#4975)
Co-authored-by: curiouscorrelation <curiouscorrelation@gmail.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-04-10 12:54:26 +05:30
jamesgeorge007
9a5b5323ab chore: bump version to 2025.3.1 2025-04-09 19:47:01 +05:30
Anwarul Islam
965c722ff8
feat(common): lenient OpenAPI imports (#4917)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-04-09 19:44:35 +05:30
Nivedin
8a1996126d
feat: add support to export http postman graphql request (#4967) 2025-04-09 15:53:12 +05:30
Mir Arif Hasan
ae5b745f5c
test(backend): account for race conditions in verifyMagicLinkTokens test suite (#4969) 2025-04-08 20:32:01 +05:30
Shreyas
9cc8b68077
fix(kernel): deterministic form data processing (#4945) 2025-04-08 14:50:04 +05:30
Nivedin
3cf286a443
fix(common): OpenAPI response example status code bug (#4966)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-04-08 14:46:29 +05:30
Nivedin
a263113147
chore: add organization dashboard link to profile dropdown (#4952) 2025-04-07 19:56:29 +05:30
Shreyas
3803735d28
fix(web): add explicit headers following prior normalization (#4951)
These changes add explicit `Content-Type` headers to direct (via `native` interceptor)
authentication requests after changes made in [PR #4931](https://github.com/hoppscotch/hoppscotch/pull/4931) that modified how `Content-Type`
headers are handled in the `relay` plugin.

In [issue #4905](https://github.com/hoppscotch/hoppscotch/issues/4905), that was about Hoppscotch Agent and Native interceptor inconsistently
handling `Content-Type` headers. The issue had two main manifestations,
duplicate headers - when overriding the `Content-Type` header in the UI or using OAuth2 authentication, the agent
would send multiple `Content-Type` headers to the web server. This caused undefined behavior
and often 400 errors for backends that don't accept duplicate headers.
And inconsistent overrides - even when the content type was explicitly set (for example to
`application/json;v=2`), the agent/native would inconsistently apply this override. Server
logs revealed that roughly 50% of requests would use the correct override value, while the
others would revert to the default `application/json`.

The two-part solution implemented first in [PR #4911](https://github.com/hoppscotch/hoppscotch/pull/4911) addressed the duplicate headers issue
by implementing header normalization before final relay. This prevented duplicate headers
with different casing from being sent and [PR #4931](https://github.com/hoppscotch/hoppscotch/pull/4931) then resolved the inconsistent override
behavior by removing the automatic `Content-Type` header insertion in the `ContentHandler`
component. As explained in the PR description, this was a temporary workaround until we
implement a HTTP/2-compliant solution with proper normalization.

While the fixes in PR #4911 and #4931 correctly resolved the header inconsistency issues
for general API requests, they introduced a new problem: **requests that previously relied
on the automatic `Content-Type` insertion now have no `Content-Type` header at all**.

This mainly affects direct calls around authentication flows in the desktop module, which
were using the `content.json()` functionality without explicitly setting `Content-Type`
headers, relying on the automatic insertion that has now been removed.

These changes add the now-required explicit `Content-Type` headers to three
authentication-related API calls in the desktop platform module:

- **The initial user details GraphQL query**:
```javascript
headers: {
  Authorization: `Bearer ${accessToken}`,
  "Content-Type": "application/json",
},
```

- **The magic link email submission endpoint**:
```javascript
headers: {
  "Content-Type": "application/json",
},
```

- **The token verification endpoint**:
```javascript
headers: {
  "Content-Type": "application/json",
},
```

This will make sure that authentication flows continue to work properly with the native
interceptor after the header handling changes.

As noted in [PR #4931](https://github.com/hoppscotch/hoppscotch/pull/4931), this is considered a **temporary solution**. The plan is to revisit the
content-type handling when we implement a more comprehensive HTTP/2-compliant header
normalization system in the kernel layer.

While HTTP/1.1 headers are case-insensitive
per [RFC 7230](https://tools.ietf.org/html/rfc7230), inconsistent handling across server implementations can treat differently-cased
variations as distinct headers. HTTP/2 ([RFC 7540](https://tools.ietf.org/html/rfc7540)) mandates converting all header field
names to lowercase, which would prevent these issues altogether. In such cases, relying
fully on `MediaType` interface from the kernel will help handling these edge-cases.
2025-04-04 14:45:05 +05:30
Nivedin
fb2b677faf
fix: import bug with extension and agent interceptors (#4932)
Co-authored-by: curiouscorrelation <curiouscorrelation@gmail.com>
2025-03-28 17:52:45 +05:30
Christoffer Hjalmarsson
0c361faeab
fix(common): oauth2 basic header encoding (#4927) 2025-03-28 13:46:22 +05:30
Anwarul Islam
9e541a8a4b
feat: format JSON responses having text/plain content type (#4916)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-03-28 13:38:32 +05:30
jamesgeorge007
4e29810f69 chore: i18n string entry updates 2025-03-27 23:23:09 +05:30
Andrew Bastin
ba64fea681
chore: bump vulnerable dependencies (#4943) 2025-03-27 22:45:29 +05:30
Nivedin
f564b2e34f
feat: Agent registration UX flow updates (#4942)
Co-authored-by: curiouscorrelation <curiouscorrelation@gmail.com>
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-03-27 21:09:23 +05:30
jamesgeorge007
3c535b2ad4 chore: bump version to 2025.3.0 2025-03-27 13:15:30 +05:30
Anwarul Islam
24fbe3e01a
feat(common): create new requests without siphoning data from the previous one (#4909)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-03-27 12:49:42 +05:30
Anwarul Islam
bedb0ffdb6
fix(common): improve authorization header handling (#4818) 2025-03-26 17:12:41 +05:30
Christoffer Hjalmarsson
ba165bc505
fix(common): oauth2 password flow not respecting scopes (#4940) 2025-03-26 16:50:36 +05:30
Pranay Pandey
b9ea5f7916
feat: search requests by endpoint in personal workspace (#4779)
Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
2025-03-26 15:22:14 +05:30
Shreyas
d00c219401
fix(desktop): enable cookie support for sh-desktop (#4939) 2025-03-26 15:01:36 +05:30
Shreyas
72ff950d91
fix(relay): avoid override with header passthrough (#4931)
The current implementation causes duplicate `Content-Type` headers when users
override headers in the UI or use OAuth2 authentication with the agent.
Web servers receive multiple `Content-Type` headers which causes
undefined behavior and 400 errors for backends that don't accept duplicate headers.

This also fixes inconsistent behavior when overriding the `Content-Type` header
with custom values (e.g., `application/json;v=2`).

While HTTP/1.1 headers are case-insensitive per RFC 7230, inconsistent handling
across server implementations can treat differently-cased variations (e.g.,
"Content-Type" vs "content-type") as distinct headers. HTTP/2 (RFC 7540) mandates
converting all header field names to lowercase, which would prevent this issue.

This patch removes the automatic content-type header insertion, allowing user-defined
headers to take precedence without duplication. The is a temporary
workaround until we implement a HTTP/2-compliant solution with proper normalization.

This was implemented initially to support moving lower level handling
towards the kernel, although since the larger refactor has been slightly
deferred in favor of stability, this change is suitable for current
state.

This will be revisited when we implement HTTP/2 compliant header handling in the
kernel layer as part of our upcoming kernel efforts.

Use the following request to test this out on Desktop app and Agent and
override `Content-Type` header to `application/json;=v2`:

```
curl --request POST \
  --url 'https://echo.qubit.codes/?qp=1' \
  --header 'Content-Type: application/json;v=2' \
  --data '{ "test-key": "test-value" }'
```
2025-03-25 16:34:27 +05:30
SimonAllen
f5beabed1e
chore(i18n): update tw translation (#4920) 2025-03-25 16:32:25 +05:30