Repository navigation
refactor(core): share project path validation contracts - #1932
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19c4980e19
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
19c4980 to
c650397
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
f744253 to
b9368db
Compare
47f7789 to
21d4111
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
21d4111 to
f2939a7
Compare
b9368db to
f4f2956
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4f2956908
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
d7a9e79 to
372aa7c
Compare
f2939a7 to
4923a55
Compare
|
@codex review |
372aa7c to
e257e8e
Compare
4923a55 to
46d3ab7
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
46d3ab7 to
f610f1d
Compare
e257e8e to
8b577e6
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
8b577e6 to
c47c543
Compare
f610f1d to
4c483a3
Compare
|
@codex review |
412b611 to
f02c754
Compare
|
@codex review |
f02c754 to
e6fd64b
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
e6fd64b to
6649d5f
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
6649d5f to
0a209fb
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
Signed-off-by: phernandez <[email protected]>
0a209fb to
5997238
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
## Why YAML aliases create shared or cyclic containers that downstream normalization, schema processing, and export treat as trees; merge construction can expand work before those consumers run. A 347-character alias document allocated 2.5 MiB in normalization, and a cyclic alias caused RecursionError in the real entity parser. Fixes #1892 (K6/K15/K16/K22/K44). ## What Changed Adopt the user-approved simple YAML policy: aliases and merge keys are unsupported in note metadata. Reject them during YAML composition, before construction or recursive normalization. Emit repeated values directly so writers do not introduce aliases. Document the policy in DOMAIN_MODEL.md. ## Implementation Details One SafeLoader subclass enforces the policy across Core frontmatter parsing, MCP read shaping, python-frontmatter adapters, schema-file reads, local Wiki ownership parsing, and OKF validation. OKF retains its timestamp-spelling resolver while inheriting the same graph restriction. Existing malformed-frontmatter handling preserves canonical bytes as body content; strict metadata/OKF readers reject unsupported YAML. SafeDumper customization keeps generated frontmatter compatible with the reader. Stacked on #1932; only YAML policy, its adapters, documentation, and regression tests are new here. ## Testing - Before the fix: 14 policy regressions failed, including the real entity-parser cycle and writer-produced aliases. - `uv run pytest tests/markdown/test_simple_yaml_policy.py tests/utils/test_file_utils.py tests/utils/test_frontmatter_obsidian_compatible.py tests/okf tests/picoschema tests/services/test_entity_service.py tests/services/test_note_section_edits.py tests/mcp/test_tool_read_note.py tests/api/v2/test_schema_router.py tests/index/test_local_wiki_projection.py -q --no-cov`: 608 passed. - No mocks in the new alias/cycle/merge/reader/writer regressions. Ordinary quoted marker text remains data. - `just fast-check`: passed, including repository type checking. - `just doctor`: passed sandboxed write/index/search self-test. - `git diff --check`: passed. ## Risks / Follow-ups This deliberately stops accepting alias/merge metadata. Existing notes must repeat those values directly to use them as frontmatter; canonical bytes are not automatically rewritten. Unused anchors carry no alias edges and do not expand graphs. The CI project-update configuration parser is not note metadata and retains its existing YAML handling. Cloud must update Core and use the shared policy in any Cloud-owned YAML reader to receive the complete cross-repository fix. Signed-off-by: phernandez <[email protected]>
Why
Project creation and project moves duplicated resolved-root checks, and note moves maintained separate portable-path syntax checks. The user requested shared path helpers across these security boundaries.
What Changed
Reuse resolve_path_within_root for project creation and project moves, requiring strict descendants of a configured root. Reuse valid_project_path_value for note-move syntax. Uploads already use that portable validator in #1928; storage/import/materialization guards already share resolved containment in #1931.
Implementation Details
The shared helpers live in the preceding PRs. This PR removes the remaining project and note-move copies and adds controls for root permissions, sibling-prefix and symlink escapes, filename spelling, and literal tildes. Filename normalization remains an explicit operation policy; reference validation keeps its existing default restrictions. Object-storage keys do not resolve against the host filesystem.
Stacked on #1931. The ignore-rule PR (#1929) is held separately and is not a dependency.
Testing
uv run pytest tests/utils/test_path_containment.py tests/utils/test_validate_project_path.py tests/utils/test_remote_project_paths.py tests/runtime/test_note_move_destination.py tests/services/test_destination_containment.py tests/services/test_project_move_root.py tests/services/test_project_root_containment.py tests/cli/cloud/test_upload_destination.py -q --no-cov: 118 passed on the final stack.just fast-check: passed, including repository type checking.just doctor: passed sandboxed write/index/search self-test.Risks / Follow-ups
Note moves apply the shared portable restrictions, including control characters and Windows-normalized traversal segments. File storage explicitly permits literal tildes because it never expands home markers. Native POSIX storage preserves literal-colon names; remote keys and reference validation retain their drive restrictions. Archive syntax remains a separately stricter format contract.