fix(rules-core): isolate package + block symlink escape from rule sources

- Drop the back-import of src/shared/logger so @oh-my-opencode/rules-core
  stays free of host-adapter dependencies (ROADMAP package layering
  invariant). Expose setSisyphusRuleDeprecationLogger(logger) for hosts to
  inject their own logger; default is a noop.
- Wire the host injection in src/hooks/rules-injector/rule-file-finder.ts
  as a module-level side effect so existing behavior is preserved.
- Add realpath boundary check to findRuleFilesRecursive and
  validFileRealPath. Project rule scanners now refuse entries whose
  realpath escapes the rule-source root, closing the symlink-escape
  vector where a malicious repo could point .github/copilot-instructions.md
  (or any .omo/rules/* entry) at ~/.ssh/id_rsa and have the rule injector
  pull the secret into model context.
This commit is contained in:
YeonGyu-Kim
2026-05-20 15:26:04 +09:00
parent 89f6902617
commit b24dc6eeb8
4 changed files with 48 additions and 16 deletions
@@ -1,2 +1,7 @@
import { setSisyphusRuleDeprecationLogger } from "@oh-my-opencode/rules-core";
import { log } from "../../shared/logger";
setSisyphusRuleDeprecationLogger(log);
export { findRuleFiles } from "@oh-my-opencode/rules-core";
export type { FindRuleFilesOptions } from "@oh-my-opencode/rules-core";