Commit graph

55 commits

Author SHA1 Message Date
Jason Lee
76424dd0ae Bump v0.5.0 2025-12-08 10:54:12 +08:00
Floyd Wang
e43662190a Bump v0.5.0-preview2 2025-12-02 17:12:49 +08:00
Jason Lee
740d59d280 Bump v0.5.0-preview0 2025-11-27 14:49:36 +08:00
orbisai0security
5ae9311202
chore: Upgrade tracing-subscriber to fix CVE-2025-58160 (#1678)
## Security Fix

This PR addresses a **LOW** severity vulnerability detected by our
security scanner.

### Security Impact Assessment

| Aspect | Rating | Rationale |
|--------|--------|-----------|
| Impact | Low | In the gpui-component repository, which is a Rust-based
GUI component library for building native apps, tracing log pollution
could allow misleading or polluted logs during application runtime,
potentially aiding in debugging obfuscation or minor information
leakage, but it poses minimal risk as the library focuses on UI
rendering and does not handle sensitive data or network operations
directly. |
| Likelihood | Low | The repository is a client-side GUI component
library, typically deployed in desktop or native applications with
limited network exposure, making exploitation unlikely as attackers
would need to compromise the local app environment first, and log
pollution requires specific conditions not common in this usage context.
|
| Ease of Fix | Easy | Remediation involves updating the
tracing-subscriber dependency in Cargo.lock to a patched version, which
is a straightforward Cargo update with minimal risk of breaking changes
in a component library focused on UI elements rather than core logic. |

### Evidence: Proof-of-Concept Exploitation Demo

**⚠️ For Educational/Security Awareness Only**

This demonstration shows how the vulnerability could be exploited to
help you understand its severity and prioritize remediation.

#### How This Vulnerability Can Be Exploited

The vulnerability in CVE-2025-58160 affects the `tracing-subscriber`
crate, a transitive dependency in this Rust-based UI component library
repository (gpui-component). An attacker with control over input that
influences logging (e.g., via user-provided data or network inputs in an
application built with this library) could exploit this to inject
arbitrary log messages, polluting logs and potentially obscuring
security events or misleading forensic analysis. Since gpui-component is
a library that integrates with GPUI (which uses tracing for logging),
exploitation would occur in downstream applications that enable logging
and process untrusted inputs, allowing log spoofing without direct code
execution.

The vulnerability in CVE-2025-58160 affects the `tracing-subscriber`
crate, a transitive dependency in this Rust-based UI component library
repository (gpui-component). An attacker with control over input that
influences logging (e.g., via user-provided data or network inputs in an
application built with this library) could exploit this to inject
arbitrary log messages, polluting logs and potentially obscuring
security events or misleading forensic analysis. Since gpui-component is
a library that integrates with GPUI (which uses tracing for logging),
exploitation would occur in downstream applications that enable logging
and process untrusted inputs, allowing log spoofing without direct code
execution.

```rust
// Proof-of-Concept: Demonstrating log pollution in an application using gpui-component
// This assumes a downstream app (e.g., a GPUI-based GUI app) that uses gpui-component and enables tracing-subscriber for logging.
// The exploit leverages the vulnerability by injecting malicious log messages via controlled input, such as user text fields or network data.
// Prerequisites: The app must have tracing-subscriber configured (common in GPUI apps for debugging), and the attacker needs a way to influence log inputs (e.g., via a text input in the UI).

use gpui_component::{button::Button, input::Input, Component}; // Import from this repository's library
use gpui::{App, Context, WindowOptions}; // GPUI framework
use tracing_subscriber; // Vulnerable dependency (transitive via GPUI)
use tracing::{info, warn}; // For logging

fn main() {
    // Initialize tracing-subscriber (vulnerable version from Cargo.lock)
    tracing_subscriber::fmt::init();

    // Create a simple GPUI app using gpui-component
    App::new().run(|cx: &mut App| {
        cx.open_window(WindowOptions::default(), |cx| {
            let input = cx.new(|cx| Input::new(cx)); // UI component from gpui-component
            let button = cx.new(|cx| Button::new("Submit", cx));

            // Simulate attacker-controlled input: Malicious payload to pollute logs
            // In a real exploit, this could come from user input, network, or file
            let malicious_input = "%0A[ATTACKER] Fake security alert: Unauthorized access detected from IP 192.168.1.100%0A"; // Newline injection for log pollution

            // When button is clicked, log the input (vulnerable point)
            button.on_click(cx, move |_, cx| {
                // This logs the input, allowing pollution if input is controlled
                info!("User input: {}", malicious_input);
                warn!("Processing complete"); // Additional log for context
            });

            cx.focus(&input);
        });
    });
}

// To run this PoC:
// 1. Clone the gpui-component repo and build it as a dependency.
// 2. Create a new Rust project with GPUI and this library as deps.
// 3. Add the above code to main.rs.
// 4. Run with `cargo run`.
// 5. Interact with the UI (e.g., click the button) – check logs for injected messages like "[ATTACKER] Fake security alert...".
// Impact: Logs are polluted, potentially hiding real events or creating false positives in monitoring systems.
```

#### Exploitation Impact Assessment

| Impact Category | Severity | Description |
|-----------------|----------|-------------|
| Data Exposure | Low | Logs could be polluted with fake entries,
potentially masking sensitive information leakage if real logs contain
user data or API keys; however, no direct data theft occurs, as
pollution is limited to log output and doesn't expose underlying data
stores in this UI library context. |
| System Compromise | None | No system access is gained; the
vulnerability only allows log message injection, not code execution,
privilege escalation, or control over the application or host system. |
| Operational Impact | Low | Polluted logs could confuse
monitoring/alerting systems, leading to missed security events or false
alarms, but no service disruption, denial-of-service, or resource
exhaustion is possible in this library's isolated UI component usage. |
| Compliance Risk | Low | Could violate logging integrity requirements
in standards like OWASP Top 10 (A09:2021 - Security Logging and
Monitoring Failures) or SOC2 CC7.1 (monitoring), but impact is minimal
for most regulations unless logs are critical for audits in sensitive
apps (e.g., no direct GDPR or HIPAA violations from log pollution
alone). |

### Vulnerability Details
- **Rule ID**: `CVE-2025-58160`
- **File**: `Cargo.lock`
- **Description**: tracing-subscriber: Tracing log pollution

### Changes Made
This automated fix addresses the vulnerability by applying security best
practices.

### Files Modified
- `Cargo.lock`

### Verification
This fix has been automatically verified through:
-  Build verification
-  Scanner re-scan
-  LLM code review

🤖 This PR was automatically generated.

Co-authored-by: orbisai0security <orbisai0security@users.noreply.github.com>
2025-11-25 07:26:01 +00:00
Jason Lee
f2cbc16655
chore: Update to use Rust edition 2024. (#1669) 2025-11-24 14:38:43 +08:00
Jason Lee
0a24925a7f Bump v0.4.1 2025-11-20 17:26:14 +08:00
Jason Lee
aa4f896b20 Bump v0.4.0 2025-11-17 10:05:08 +08:00
Jason Lee
f35d0c5832 Bump v0.4.0-preview3 2025-11-14 18:42:40 +08:00
Jason Lee
37d1678b6f
assets: Add gpui-component-assets crate. (#1601) 2025-11-14 15:03:26 +08:00
Jason Lee
724ccd64a7
chore: Add ui folder to Cargo default-members. (#1600)
This to help `cargo test` default will test `ui` and `story`.
2025-11-14 06:16:03 +00:00
Jason Lee
f88b547b70 Bump v0.4.0-preview2 2025-11-12 15:16:49 +08:00
ihavecoke
838fd6411a
webview: Add inspector feature to enable WebView developer tools (#1564) 2025-11-12 11:11:18 +08:00
Jason Lee
34c589d45b Bump v0.4.0-preview1. 2025-11-06 22:27:26 +08:00
Floyd Wang
123934237a Bump v0.4.0-preview0 2025-10-30 15:50:45 +08:00
Floyd Wang
183d17731d Bump v0.3.1 2025-10-27 13:52:29 +08:00
Jason Lee
ab7af9c01d Bump v0.3.0 2025-10-24 10:47:04 +08:00
Floyd Wang
b80fca28c1 Bump v0.3.0-preview2 2025-10-23 16:36:23 +08:00
Jason Lee
17ec395853 Bump v0.3.0-preview0 2025-10-17 10:37:49 +08:00
Jason Lee
f16487a2cb
chore: Fix license link in crate meta. (#1393)
Close #1392
2025-10-17 10:32:09 +08:00
Jason Lee
ca9d5b77e2 chore: Release v0.2.0 2025-10-09 15:21:10 +08:00
Jason Lee
6ca9ac46fa
chore: Bump crate version. (#1340) 2025-10-09 15:20:34 +08:00
Jason Lee
d0396d779e
editor: Add document_colors LSP. (#1329) 2025-10-06 18:08:12 +08:00
Carlo Corradini
908c022efe
chore: Assets interpolate folder path via rust embed (#1318)
Use `rust-embed` feature `interpolate-folder-path` to always
(`debug`/`release`) load assets from the correct `assets` directory
2025-10-02 16:04:33 +08:00
Jason Lee
f1b6d7c5ed editor: Add completion, code_action provider. (#1242) 2025-09-15 19:25:02 +08:00
Jason Lee
3fa996c331
input: Fix line column by use chars offset. (#1239)
- Add autocorrect to markdown example for test `markers`.

<img width="1104" height="590" alt="image"
src="https://github.com/user-attachments/assets/03103088-e828-4039-82b0-c816d5f36141"
/>
2025-09-10 20:56:15 +08:00
Jason Lee
63f61dca04
chore: Avoid built-in tree-sitter languages in default. (#1135)
With a `tree-sitter-languages` feature to enable it (Default not
enable).

Changed this for reduce the application size (From 52 MB to 22MB), Ref
#1132

Now default only includes `tree-sitter-json`, if you want more:

```toml
[dependencies]
gpui-component = { features = ["tree-sitter-languages"] }
```

---

```
cargo bloat -p hello_world --release -n 10
    Finished `release` profile [optimized] target(s) in 0.27s
    Analyzing target/release/hello_world

 File  .text    Size              Crate Name
 0.4%   1.4% 88.5KiB simple_minify_html simple_minify_html::code_gen::attrs::ATTRS::{{closure}}
 0.3%   1.0% 62.1KiB              taffy taffy::compute::grid::track_sizing::resolve_intrinsic_track_sizes
 0.1%   0.5% 32.6KiB     gpui_component gpui_component::theme::theme_color::ThemeColor::dark
 0.1%   0.5% 30.0KiB     gpui_component gpui_component::theme::theme_color::ThemeColor::light
 0.1%   0.5% 29.9KiB          html5ever html5ever::tree_builder::TreeBuilder<Handle,Sink>::step
 0.1%   0.4% 27.2KiB               gpui taffy::compute::flexbox::compute_flexbox_layout
 0.1%   0.4% 23.3KiB               usvg usvg::text::layout::layout_text
 0.1%   0.4% 22.5KiB              resvg resvg::filter::apply_inner
 0.1%   0.3% 21.4KiB               gpui jpeg_decoder::decoder::Decoder<R>::decode_internal
 0.1%   0.3% 21.2KiB         image_webp image_webp::lossless::LosslessDecoder<R>::decode_image_stream
25.3%  94.3%  5.7MiB                    And 14091 smaller methods. Use -n N to show more.
26.8% 100.0%  6.0MiB                    .text section size, the file size is 22.4MiB
```
2025-08-14 18:02:27 +08:00
Jason Lee
9a040eaaac
list: Refactor List, Dropdown delegate API to support section. (#1107)
Ref UITableView API:

https://developer.apple.com/documentation/uikit/uitableviewdatasource

## Changes

- Added some section related API to `ListDelegeate` and
`DropdownDelegate` with default implement, so if you don't need section
that you can just keep the default.
- Added `sections_count` method to get the number of sections, default
is 1.
- Added `render_section_header` for special the section header by if
needed, default return None.
- Added `render_section_footer` for special the section footer by if
needed, default return None.

## Break Changes

- The `DropdownState` have change new method to use IndexPath type:

  ```diff
  - DropdownState::new(vec![], Some(1), window, cx);
  + DropdownState::new(vec![], Some(IndexPath::new(1)), window, cx);
  ```

- The `ListDelegeate`, `DropdownDelegate` has changed API:
  - The `ix` are change from `usize` to `IndexPath`.

  ```diff
- fn render_item(&self, ix: usize, window: &mut Window, cx: &mut
Context<List<Self>>) -> Option<Self::Item>
+ fn render_item(&self, ix: IndexPath, window: &mut Window, cx: &mut
Context<List<Self>>) -> Option<Self::Item>

- fn set_selected_index(&mut self, ix: Option<usize>, window: &mut
Window, cx: &mut Context<List<Self>>)
+ fn set_selected_index(&mut self, ix: Option<IndexPath>, window: &mut
Window, cx: &mut Context<List<Self>>)
  ```

- The `items_count` method have added `section` argument to support list
section.
  
  ```diff
  - fn items_count(&self, cx: &App) -> usize
  + fn items_count(&self, section: usize, cx: &App) -> usize
  ```

- The `can_load_more` method has renamed to `is_eof` in `ListDelegate`
and `TableDelegate`.

  ```diff
  - fn can_load_more(&self, cx: &App) -> bool
  + fn is_eof(&self, cx: &App) -> bool
  ```

- The `can_search` method has renamed to `searchable` in `ListDelegate`.

  ```diff
  - fn can_search(&self) -> bool
  + fn searchable(&self) -> bool
  ```

## Showcase

<img width="1196" height="925" alt="image"
src="https://github.com/user-attachments/assets/22750abe-cc3f-427e-903b-51758bd4e027"
/>

<img width="1214" height="934" alt="image"
src="https://github.com/user-attachments/assets/52d42546-e6e7-4448-9c0f-43cd659fb630"
/>

---------

Co-authored-by: Floyd Wang <gassnake999@gmail.com>
2025-08-05 19:23:32 +08:00
Jason Lee
7d3301d695
tab_bar: Fix some incorrect style in TabBar. (#1078)
This change to fix some incorrect style use, that will break in Taffy
0.5.2+

Ref https://github.com/zed-industries/zed/pull/34827

- Add `Tab::empty` to create a Tab without label.
- Fix form layout in Taffy new version.
- Update GPUI for scroll API changes.
2025-07-22 13:30:04 +08:00
Jason Lee
44427afacb
theme: Add to support highlight color to theme config. (#1055)
<img width="1058" height="1026" alt="image"
src="https://github.com/user-attachments/assets/300fb16b-c5e4-4eef-9690-54fcabc4fe47"
/>
<img width="836" height="855" alt="image"
src="https://github.com/user-attachments/assets/3fdc8301-375d-4223-a2ea-8d4f411a90bd"
/>
2025-07-14 17:04:18 +08:00
Jason Lee
c3ec1deb97
code-editor: Update CodeEditor to support external language. (#928)
Add [Navi](https://navi-lang.org) language for example to external
language for CodeEditor.

<img width="864" alt="image"
src="https://github.com/user-attachments/assets/73afa56d-31bd-4867-a9f2-0a8cf790af0f"
/>
2025-06-09 14:27:33 +08:00
Floyd Wang
516c8fada4
chart: Introduce chart (#878)
Add a new component called `plot`. It provides a low-level approach to
data analysis and visualization.
Chart is a collection of ready-to-use chart components built with
`plot`.

| Light | Dark |
| - | - |
| <img width="1712" alt="SCR-20250604-qhxb"
src="https://github.com/user-attachments/assets/bf7ce76e-ab7a-42c2-92e7-17cd135de66f"
/> | <img width="1712" alt="SCR-20250604-qhxr"
src="https://github.com/user-attachments/assets/dd3e44ea-bbb5-41a2-8cce-38b316d7d800"
/> |
2025-06-04 19:22:11 +08:00
Jason Lee
2b796c94e9
highlighter: Improve performance for large file. (#911)
Still need to improve.

This version can work smooth when the file lines are less than 5000
lines.

> cargo run --release on MacBook Pro, Apple M3 CPU

- Editing at 110 FPS+
- Display at 120 FPS.

<img width="977" alt="image"
src="https://github.com/user-attachments/assets/37958bcb-20d8-486b-8c50-2728d16f971b"
/>
2025-06-03 23:20:33 +08:00
Jason Lee
901312bc5a
chore: Switch gpui to depends on Zed official. (#912)
Now, GPUI have merged `window_handle` support for all platforms.

- https://github.com/zed-industries/zed/pull/24327
- https://github.com/zed-industries/zed/pull/24545
- https://github.com/zed-industries/zed/pull/28152

It's time to depends on Zed official main branch.
2025-06-02 10:05:45 +08:00
Jason Lee
5b508d7219
gallery: Redesign the gallery. (#797)
Close #773

<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/e27a28ca-cdd7-4970-8518-4fd0104bb3f8"
/>
2025-04-17 17:12:48 +08:00
Jakku Sakura
4f0617e96f
example: Fix to hide WebView when switch tab. (#764)
fixes #763
it also prevent crashing on linux due to gtk not initialized

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-04-02 10:50:20 +08:00
Floyd Wang
9f103bac6f
svg_img: Use system fonts to support CJK characters (#750)
| Before | After |
| - | - |
| <img width="528" alt="SCR-20250327-mpcz"
src="https://github.com/user-attachments/assets/22dc30ea-582a-4133-996a-90bcf8cb54be"
/> | <img width="535" alt="SCR-20250327-mnbv"
src="https://github.com/user-attachments/assets/5f360d17-8285-44d8-963b-17784c4c0eb5"
/> |
2025-03-27 14:44:04 +08:00
Jason Lee
9dade704fb
webview: Let webview as a feature and not default enable. (#648)
Close #646
2025-02-24 14:24:22 +08:00
Jason Lee
06f9178ec4
text: Add TextView with Markdown and Simple HTML support. (#639) 2025-02-20 20:08:59 +08:00
Jason Lee
a5db381ef4
chore: Upgrade GPUI 2025/02/10 (#610)
- Replace `Window::parent_view_id()` with `Window::current_view()`
https://github.com/zed-industries/zed/pull/24212
- Fix SvgImg crash by move `use_asset` to `request_layout`.
- Fix Input to implement `character_index_for_point` method
https://github.com/zed-industries/zed/pull/23989
- Fix Input IME position to under the cursor line.
  <img width="504" alt="image"
src="https://github.com/user-attachments/assets/8a6f56c8-6aae-4c0c-8c5a-3959d6a9d224"
/>
- Fix Input overflow sub crash.
2025-02-10 11:53:25 +08:00
Floyd Wang
abb3de013e
Rename package from ui to gpui-component (#606)
## 🚨Break Change

Update dependencies from `ui` to `gpui-component`.
2025-02-06 17:21:46 +08:00
Jason Lee
99a4c793c5
chore: Update crate name to gpui-component for publish crate to hold the name. (#603) 2025-02-06 11:57:34 +08:00
xda
5874c6974f
tiles: Add Tiles (#435)
## Break Changes

- Renamed `DockItemState` to `PanelState`.
- Renamed `DockItemInfo` to `PanelInfo`.
- Update `cx` type from `WindowContext` to `AppContext` for Panel trait
`panel_name` method.

## TODO

- [ ] Support merge panels into TabPanel.
- [ ] Support split panels into Tile.

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2024-12-16 20:33:14 +08:00
Jason Lee
9288dc91c2
input: Add to support multi-line Input. (#463) 2024-12-09 20:17:05 +08:00
Jason Lee
7a8eaefd30
story: Add very complex table data update example to test performance. (#274)
The example that used: 6000 rows x 60 cols, and refresh data every
100ms.

The CPU usage: 40% (macOS M4)


https://github.com/user-attachments/assets/40d6c64f-c658-4c7a-9251-fb76e17ec543
2024-09-26 19:40:07 +08:00
Jason Lee
bf134b2ff9
Add to support dump/load Dock layout. (#226) 2024-09-09 13:30:22 +08:00
Jason Lee
2c469da55a
Update GPUI and apply opacity feature. (#215) 2024-09-04 19:29:51 +08:00
Jason Lee
c5c8e46ac7
New Dock (#172)
https://github.com/user-attachments/assets/c8c55faa-8f17-4fa2-9f62-5fdd598087ef

- [x] Move to insert panel to tabs middle.
- [x] Zoom panel
- [x] Tab popup menu (Close Panel, Split, Zoom in/Zoom out)
- [x] TabBar scrollable
- [ ] TabBar nav history
2024-08-23 18:01:29 +08:00
Jason Lee
f05d2ebbd2
popup_menu: Add submenu support. (#165)
- Add submenu support.
- Removed Popover `window` mode, this is not a good design.


https://github.com/user-attachments/assets/0e3735f4-2bfb-459f-a24d-e3440e738d4f
2024-08-19 14:58:28 +08:00
Jason Lee
ebdcf244e2
Add Calendar and DatePicker. (#117)
https://github.com/user-attachments/assets/dda87fa7-f080-418a-8dd7-ab8581eb3beb
2024-08-07 20:25:11 +08:00
Jason Lee
e0103d1d58
Add CI (#62) 2024-07-24 10:39:19 +08:00