Skip to content

Close Rust advisory owner-chain gaps - #197

Merged
seonghobae merged 5 commits into
developfrom
stepwise/rust-alert-owner-chain-v2
May 1, 2026
Merged

Close Rust advisory owner-chain gaps#197
seonghobae merged 5 commits into
developfrom
stepwise/rust-alert-owner-chain-v2

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

Summary

  • Refresh the Tauri Rust lockfile to remove the stale rand 0.7.3, fxhash, kuchikiki, selectors, phf 0.8, and proc-macro-hack advisory/deprecation path.
  • Replace broad RustSec exceptions with a narrow, documented glib 0.18.5 owner-chain exception guarded by supply-chain policy tests.
  • Narrow the main Tauri capability from core:default to explicit event permissions.

Closes part of #194.
Follow-up tracker for the remaining upstream-owned glib exception: #196.

Verification

python3 scripts/checks/verify_supply_chain.py
Supply-chain verification passed

uv run --project services/analysis-engine pytest services/analysis-engine/tests/test_supply_chain_policy.py -q
55 passed in 0.25s

git diff --check
(no output)

Earlier full local verification on this change set also passed:

cargo audit --no-fetch
cargo test --locked
npm run test --workspaces --if-present
npm run typecheck --workspaces --if-present
./scripts/harness/quickcheck.sh

Security Notes

  • Untrusted inputs: no new runtime file, URL, model, IPC, or subprocess input path is introduced; this changes dependency metadata, policy checks, and Tauri permissions.
  • Trust boundary: the remaining glib 0.18.5 advisory is allowed only for the externally owned Tauri/wry/webkit2gtk/gtk GTK3 dependency chain.
  • Safe failure: verify_supply_chain.py now fails closed for stale rand 0.7.x, stale fxhash exceptions, non-numeric glib versions, unowned glib 0.18.5, mixed owners, and unexpected Tauri-reachable owners.
  • Logging/privacy: no user data or local analysis data is logged or exported.
  • Test points: focused policy tests, supply-chain verification, Cargo audit/test, workspace tests/typecheck, and full harness quickcheck.

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6896131b-a97b-4183-bee5-d67334ddbb75

📥 Commits

Reviewing files that changed from the base of the PR and between d321b8a and 688f9d6.

📒 Files selected for processing (2)
  • scripts/checks/verify_supply_chain.py
  • services/analysis-engine/tests/test_supply_chain_policy.py

📝 Walkthrough

Summary by CodeRabbit

  • 보안

    • 특정 취약점 예외(RUSTSEC-2025-0057, RUSTSEC-2026-0097) 제거. glib 관련 예외(RUSTSEC-2024-0429)를 GTK3 경로·VariantStrIter 사례로 범위 제한하고 제거 조건 명시.
  • 권한 관리

    • 광범위한 core:default 제거, 명시적 이벤트 권한(core:event:allow-listen, core:event:allow-unlisten)으로 대체.
  • 문서

    • 종속성 정책에 예외 범위·검증 절차·제거 기준 및 용어 정비 반영.
  • 테스트

    • 공급망·예외 회귀 테스트 대폭 강화 및 관련 검증 추가.

Walkthrough

RustSec 예외 목록을 축소하고 rand 0.7.3 예외를 철회했으며, GLib RUSTSEC-2024-0429 예외를 Tauri→wry→webkit2gtk→gtk(gtk3) 소유자 체인으로 한정하는 공급망 검증 로직과 관련 테스트·문서·audit 설정·권한 구성이 갱신되었습니다.

Changes

Cohort / File(s) Summary
감사 설정
apps/desktop/src-tauri/.cargo/audit.toml
RUSTSEC-2025-0057(fxhash) 및 RUSTSEC-2026-0097(rand 0.7.3) 무시 항목 제거; RUSTSEC-2024-0429 예외 주석·범위 갱신.
권한 설정
apps/desktop/src-tauri/capabilities/main.json
core:default 제거; 이벤트 관련 권한을 core:event:allow-listen, core:event:allow-unlisten 등으로 구체화.
의존성 정책 문서
docs/security/dependency-policy.md
허용 예외 집합 축소(gtk3 관련 RUSTSEC-2024-0413 유지), RUSTSEC-2024-0429 예외를 GTK3 스택 경로로 제한하고 제거 조건 명시.
공급망 검증 스크립트
scripts/checks/verify_supply_chain.py
rand 0.7.3 예외 철회(항상 위반 처리), GLib 전용 검사 경로 추가(0.18.5 VariantStrIter 예외를 Tauri→wry→webkit2gtk→gtk 소유자 체인으로 한정), Cargo.lock 그래프 유틸리티 및 숫자형 semver 파싱/검증 로직 추가.
정책 테스트
services/analysis-engine/tests/test_supply_chain_policy.py
rand 예외 철회 관련 검증·회귀 테스트 추가, fxhash/audit 존재성 검사 추가, GLib 소유자 체인·버전 케이스를 포괄하는 회귀 테스트 대량 추가 및 권한·문서 일관성 검증 추가.

Sequence Diagram(s)

sequenceDiagram
  rect rgba(240,240,255,0.5)
  actor CI as CI/Developer
  end
  rect rgba(255,240,240,0.5)
  participant Script as verify_supply_chain.py
  participant Lock as Cargo.lock
  participant Audit as apps/.../.cargo/audit.toml
  participant Tests as services/.../test_supply_chain_policy.py
  participant Docs as docs/security/dependency-policy.md
  end

  CI->>Script: 검증 실행
  Script->>Lock: 읽기 (패키지 그래프)
  Script->>Script: 그래프 분석 (ancestors, reachability, 경로 매칭)
  Script->>Audit: 읽기 (예외 목록)
  Script->>Docs: 검증(문서화된 예외 범위)
  Script->>Tests: 위반/허용 결과 제공
  Script->>CI: 결과 리포트 (통과/실패)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 깡충, 코드 사이로 뛰어들었네,
체인 따라 예외를 조여 묶었지요.
rand는 떠났고 GLib은 길을 한정했네,
검증은 단단히, 당근으로 축배! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Close Rust advisory owner-chain gaps' accurately summarizes the main change: closing advisory owner-chain gaps by removing stale advisories and replacing broad exceptions with a narrow, documented glib owner-chain exception.
Description check ✅ Passed The description is directly related to the changeset, providing clear context on removing stale dependencies (rand 0.7.3, fxhash, etc.), replacing broad RustSec exceptions with a narrow glib exception, and narrowing Tauri capability permissions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stepwise/rust-alert-owner-chain-v2

Review rate limit: 2/5 reviews remaining, refill in 27 minutes and 36 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/checks/verify_supply_chain.py`:
- Around line 683-688: The current check only gathers direct owners via
cargo_lock_dependency_owners for RUST_GLIB_LEGACY_EXCEPTION_PACKAGE, which lets
a non-Tauri root bypass the exception if it shares intermediate package keys;
change the logic to compute all ancestor/root owners by traversing reverse
dependencies starting from the glib package (use/replace
cargo_lock_reachable_package_keys_by_name and cargo_lock_dependency_owners
usage) so you collect the full ancestor set for
RUST_GLIB_LEGACY_EXCEPTION_PACKAGE and then validate that every ancestor/root is
inside the documented Tauri GTK chain (i.e., the allowlist represented by
RUST_GLIB_LEGACY_ROOT_NAME and related GTK chain names); apply the same
replacement to the analogous block around lines 792-801.

In `@services/analysis-engine/tests/test_supply_chain_policy.py`:
- Around line 992-1000: Update the
test_tauri_main_capability_uses_explicit_core_permissions test to also assert
that emit permissions are absent: after reading capability into content
(variable capability / content), add negative assertions ensuring
'"core:event:allow-emit"' and '"core:event:allow-emit-to"' are not in content so
the test fails if emit permissions are reintroduced; keep the existing checks
for core:default removal and listen/unlisten presence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 52aa9536-1be9-472b-995f-898c98f1ef72

📥 Commits

Reviewing files that changed from the base of the PR and between 9879cf8 and 38f5ac7.

⛔ Files ignored due to path filters (5)
  • apps/desktop/src-tauri/Cargo.lock is excluded by !**/*.lock
  • apps/desktop/src-tauri/gen/schemas/acl-manifests.json is excluded by !**/gen/**
  • apps/desktop/src-tauri/gen/schemas/capabilities.json is excluded by !**/gen/**
  • apps/desktop/src-tauri/gen/schemas/desktop-schema.json is excluded by !**/gen/**
  • apps/desktop/src-tauri/gen/schemas/macOS-schema.json is excluded by !**/gen/**
📒 Files selected for processing (5)
  • apps/desktop/src-tauri/.cargo/audit.toml
  • apps/desktop/src-tauri/capabilities/main.json
  • docs/security/dependency-policy.md
  • scripts/checks/verify_supply_chain.py
  • services/analysis-engine/tests/test_supply_chain_policy.py

Comment thread scripts/checks/verify_supply_chain.py
Comment thread services/analysis-engine/tests/test_supply_chain_policy.py
@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/checks/verify_supply_chain.py`:
- Around line 816-821: The current boolean check only compares ancestor name
sets and allows a bypass like bandscope-desktop -> gtk -> glib when another
valid tauri chain exists; change the logic that uses legacy_glib_ancestors and
ancestor_names so it verifies per root-to-glib path inclusion of the required
chain (not just set membership). Concretely, for each candidate root in
allowed_app_roots (and for legacy_glib_ancestors entries), enumerate or traverse
the dependency paths from that root to glib and ensure at least one path
contains the documented chain elements (e.g., tauri -> tauri-runtime-wry -> wry
-> webkit2gtk -> gtk -> glib) before allowing the exception; reject if any root
can reach glib by a path that does not include the required chain. Update the
code around legacy_glib_ancestors, glib_exception_owned_packages,
allowed_app_roots, and ancestor_names to implement this path-level check and add
a regression test reproducing the described lockfile scenario (bandscope-desktop
-> gtk -> glib plus the normal tauri chain) to assert the function now returns
False.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 64e33a4d-174b-468c-813d-588fcd5c9835

📥 Commits

Reviewing files that changed from the base of the PR and between 38f5ac7 and 29c3a95.

📒 Files selected for processing (2)
  • scripts/checks/verify_supply_chain.py
  • services/analysis-engine/tests/test_supply_chain_policy.py

Comment thread scripts/checks/verify_supply_chain.py Outdated
@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/checks/verify_supply_chain.py`:
- Around line 803-831: The function glib_legacy_exception_owners_are_allowed
currently only checks ancestor name subsets and allowed app roots, which permits
short-circuit paths like "tauri -> glib 0.18.5"; fix it by also extracting the
direct owner names (the immediate owner component, e.g. ancestor.rsplit(" ",
1)[0] or otherwise derived from legacy_glib_ancestors/package_dependencies) and
enforce that this set is a subset of RUST_GLIB_LEGACY_DIRECT_OWNER_NAMES before
returning true; update glib_legacy_exception_owners_are_allowed to perform this
extra subset check (in addition to the existing ancestor_names <=
RUST_GLIB_LEGACY_ALLOWED_ANCESTOR_NAMES |
RUST_GLIB_LEGACY_ALLOWED_APP_ROOT_NAMES and the existing
glib_allowed_app_roots_reach_glib_through_tauri check), and add a regression
test in services/analysis-engine/tests/test_supply_chain_policy.py that asserts
a path like "tauri -> glib 0.18.5" is rejected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4e463b7f-3247-411e-a595-a3342cc27cc6

📥 Commits

Reviewing files that changed from the base of the PR and between 29c3a95 and 31ecb77.

📒 Files selected for processing (2)
  • scripts/checks/verify_supply_chain.py
  • services/analysis-engine/tests/test_supply_chain_policy.py

@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/checks/verify_supply_chain.py`:
- Around line 811-845: The current glib_legacy_exception_owners_are_allowed only
validates name sets and allows shortened chains (e.g., bandscope-desktop ->
tauri -> gtk -> glib); update the logic so each allowed app root has at least
one dependency path in package_dependencies that contains the full ordered
intermediary chain (tauri -> tauri-runtime-wry -> wry -> webkit2gtk -> gtk ->
glib with the expected versions) instead of just checking set membership.
Concretely, change or extend glib_allowed_app_roots_reach_glib_through_tauri to
traverse package_dependencies from each allowed_app_root and assert an ordered
subsequence of nodes (using package names via rsplit(" ",1)[0]) exists before
reaching the glib package, and add a regression test that builds the
bandscope-desktop-like graph (app -> tauri -> gtk -> glib) to assert it fails
while a full chain passes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bbe9ff8b-332d-4562-9cbb-6c0e01d1d0e4

📥 Commits

Reviewing files that changed from the base of the PR and between 31ecb77 and d321b8a.

📒 Files selected for processing (2)
  • scripts/checks/verify_supply_chain.py
  • services/analysis-engine/tests/test_supply_chain_policy.py

Comment thread scripts/checks/verify_supply_chain.py
@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 1, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/checks/verify_supply_chain.py`:
- Around line 845-852: The current logic only enforces the full chain when
allowed_app_roots is non-empty via
glib_allowed_app_roots_reach_glib_through_tauri(package_dependencies,
allowed_app_roots), which lets abbreviated chains like tauri->gtk->glib pass
when allowed_app_roots (off_chain_ancestors) is empty; always validate that any
detected Tauri ancestor enforces RUST_GLIB_LEGACY_EXPECTED_CHAIN_NAMES
regardless of allowed_app_roots by adding a check that ancestor_names (or the
ancestor set computed from off_chain_ancestors/ancestor_names) is a superset of
RUST_GLIB_LEGACY_EXPECTED_CHAIN_NAMES when a Tauri ancestor is present, in
addition to the existing allowed-app-root checks (keep existing
glib_allowed_app_roots_reach_glib_through_tauri and the final ancestor_names <=
... check).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7c0c480b-e5c3-45bd-946e-c8cf2a24a0c5

📥 Commits

Reviewing files that changed from the base of the PR and between d321b8a and 688f9d6.

📒 Files selected for processing (2)
  • scripts/checks/verify_supply_chain.py
  • services/analysis-engine/tests/test_supply_chain_policy.py

Comment thread scripts/checks/verify_supply_chain.py
@seonghobae
seonghobae marked this pull request as ready for review May 1, 2026 07:50
@seonghobae
seonghobae merged commit d596c03 into develop May 1, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant