Skip to content

fix: refuse hided arguments no role names before opening a state folder - #2203

Merged
yansfil merged 4 commits into
mainfrom
fix/core-move-prep
Nov 7, 2026
Merged

yansfil merged 4 commits into
mainfrom
fix/core-move-prep

Conversation

@yansfil

@yansfil yansfil commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes with-hide/hide-private#670

Summary

hided는 아는 첫 인자가 아니면 무엇이든 daemon 시작으로 보내서, 기기에서 hided --version을 치면 그 기계의 상태 폴더에 core 시작 단계가 돌았습니다.
이제 hided는 인자를 맨 처음 한 번, 닫힌 목록으로 읽습니다: 인자 없음만 daemon이고, --version·--help는 출력하고 끝나며, 그 밖의 인자는 아무것도 열기 전에 사용법과 함께 exit 2로 거절됩니다.

$ hided --version
hided 1.2.2 c0691df0f
$ hided --nonsense; echo $?
hided does not know "--nonsense"
usage: hided [--version | --help]
...
2

Review

원인과 같은 원인의 경로:

경로 증거 고친 곳
hided --version / --help 2026-11-07 mini에서 core 시작 단계가 돌고 hided.json 등을 씀 환경을 읽기 전에 출력하고 끝
hided foo, hided --nonsense run()의 마지막 분기가 daemon 시작 owner watch·상태 폴더·로그 전에 거절, exit 2
hided core-login <남는 인자> 첫 인자만 보고 나머지는 버림 거절
hided --version extra 같은 남는 인자 위와 같음 거절
hided (인자 없음: hide connect, 시험 픽스처, 측정 스크립트) 지금 동작 그대로
node/attach/core-move/core-update/shell-exec/--open-helper 각 파서가 이미 USAGE로 거절 단어는 그 역할에 그대로 넘김
  • 조심해서 볼 파일: hided/src/bin/hided.rs - 역할마다 owner watch를 잡는 순서는 그대로(shell-exec만 그 전), 거절과 --version만 owner watch 앞에서 끝납니다.
  • 판단해 주세요: help와 -h도 --help로 받습니다(hide와 같게).

Evidence

  • 확인한 것(1598040): hided/tests/it/arguments.rs 3개 - 빈 HOME·USERPROFILE·HIDE_STATE_DIR로 --version, --help, 모르는 인자 4가지를 실행해 종료 코드, 출력, 그리고 HOME 아래에 아무 파일도 생기지 않음을 확인. hided::role 단위 시험 2개(인자 없음만 daemon, 각 역할이 자기 단어를 받음).
    • Linux: 이 PR CI의 rust workspace에서 5개 PASS.
    • Windows: 이 PR CI의 windows check에서 arguments:: 3개, role:: 2개 PASS(이 PR이 Windows 레인에 넣음).
    • macOS: 로컬 nextest 5개 PASS(macOS Rust 시험은 PR CI에서 돌지 않음).
  • 확인한 것: cargo clippy -p hided --all-targets -D warnings, cargo fmt --check 통과.
  • 확인한 것: CI에서 실패한 것은 desktop e2e macos 2/2 하나이고(세 번 같음), main push도 같은 시험(terminal-links, session-workflow)으로 실패합니다(with-hide/hide-private#686). 이 PR은 데스크톱 앱이나 터미널 링크를 건드리지 않습니다.
  • 확인하지 못한 것: 설치된 앱과 mini에서 직접 hided --version은 실행하지 않았습니다(운영자 기기를 건드리지 않음).

hided read its role as a chain of first-argument checks whose fallthrough
started the daemon, so --version, a typo or a stray flag ran a core's
start on whatever state folder the environment named. The role is now
parsed once from a closed list: no arguments is the daemon, --version and
--help print and end, and anything else is refused with exit 2 before an
owner watch, state folder, lock or log is touched.

Closes with-hide/hide-private#670

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PASS (소스 리뷰) · serious 0 / ordinary 0 / minor 1
대상: 2164dcb, 시작점 3eac331.

원인과 같은 원인의 경로 표를 먼저 대조했습니다.
인자 없음과 core-login 단독만 daemon으로 가고, 모르는 첫 인자 및 core-login/version/help의 남는 인자는 환경 준비 전에 exit 2로 끝납니다.
node, attach, core-move, core-update, shell-exec, open-helper의 기존 파서와 인자 전달도 대조했습니다.
원칙 13(같은 원인 전체 수정)에 맞게 특정 문자열 예외가 아닌 닫힌 역할 목록으로 daemon 기본 분기를 없앴습니다.

정확성·흩어짐·단순함·모듈 경계·소유와 상한·테스트를 검토했고 막는 지적은 없습니다.
역할 판정의 소유자는 role::parse 한 곳이며 실행은 기존 역할 구현에 남습니다.
실제 바이너리를 빈 HOME/state에서 실행하고 종료 코드·출력·파일 부재를 관찰하는 arguments 회귀 시험은 원래 실패 경로를 잡습니다.

  • minor · 정확성/설명 · hided/src/bin/hided.rs:33,59: PR Review는 --version이 owner watch 전에 끝난다고 하지만 실제로는 OwnerWatch::from_launch 후 run(role)에서 출력합니다.
    상태 폴더를 열지 않는다는 핵심은 맞습니다.
    본문의 순서를 정정해 주세요. 현재 환경의 owner metadata가 잘못되면 버전 출력도 owner-watch 오류로 끝날 수 있다는 한계도 있습니다.

증거 범위: 소스와 CI 설정을 읽었으며, 로컬 cargo/실행 시험은 새로 돌리지 않았습니다.
CI 42376783237의 windows check는 SUCCESS이나 전체 실행은 진행 중이고 개별 시험 로그는 아직 조회되지 않았습니다.
작성자가 보고한 macOS 통과와 실제 로그의 대조는 대기 중입니다.
세 OS 실행 완료와 core-prep의 나머지 두 PR(#672/#674)은 이 소스 PASS에 포함되지 않습니다.

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PASS (변경분 소스 리뷰) · serious 0 / ordinary 0 / minor 0
대상: 1598040.
이전 검토 2164dcb 이후의 hided/src/bin/hided.rs 변경만 읽었습니다.

앞선 minor 지적은 해소됐습니다.
--version과 --help가 main의 역할 해석 직후 출력하고 반환하므로 OwnerWatch::from_launch와 환경·상태 폴더 준비에 도달하지 않습니다.
실행 위치를 옮기면서 기존 run의 출력 분기를 제거했고, 다른 역할의 실행 순서는 보존했습니다.
새로운 막는 지적은 없습니다.

작성자의 nextest-670.log를 읽어 이전 코드 c0691df0f의 arguments 3개와 role 2개 PASS를 확인했습니다(전체 필터 결과 18 PASS).
이는 새 커밋의 실행 증거로 이월하지 않습니다.
159804011의 macOS 재실행과 CI 42378538528은 대기 중이며, 이번 리뷰에서는 빌드·시험을 새로 실행하지 않았습니다.
core-prep 전체 판정은 #672/#674 PR 검토 후 기록합니다.

@yansfil
yansfil enabled auto-merge November 7, 2026 16:46

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

PASS (변경분 소스 재리뷰) - 039e0fe82117cdd613c11159e98d244aa596c767.
main 병합 이후 hided/src/bin/hided.rs, hided/src/role.rs, hided/tests/it/arguments.rs는 이전에 PASS한 159804011과 동일합니다.
기존 지적 종결과 소스 판정을 유지합니다.
이 재리뷰는 병합으로 바뀐 범위 확인이며, cargo·빌드는 실행하지 않았고 새 head의 전체 CI 판정을 대신하지 않습니다.

@yansfil
yansfil added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 7da8ad8 Nov 7, 2026
57 checks passed
@yansfil
yansfil deleted the fix/core-move-prep branch November 7, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant