Skip to content

fix(core): reject YAML aliases and merge expansion in notes - #1933

Merged
phernandez merged 1 commit into
mainfrom
codex/security-simple-yaml
Oct 29, 2026
Merged

phernandez merged 1 commit into
mainfrom
codex/security-simple-yaml

Conversation

@phernandez

Copy link
Copy Markdown
Member

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T00:40:16.514453Z b445aa3 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 58628c3 to ef3347f Compare October 28, 2026 21:44
@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from f744253 to b9368db Compare October 28, 2026 21:44
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: ef3347f5d2

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from b9368db to f4f2956 Compare October 28, 2026 22:17
@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from ef3347f to 34a7e9c Compare October 28, 2026 22:17
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 34a7e9c67f

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 34a7e9c to 7bde6c2 Compare October 28, 2026 22:21
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 7bde6c21dd

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from d7a9e79 to 372aa7c Compare October 28, 2026 22:23
@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 7bde6c2 to 4040a84 Compare October 28, 2026 22:23
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from 372aa7c to e257e8e Compare October 28, 2026 22:26
@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 4040a84 to 3214ec6 Compare October 28, 2026 22:26
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 4040a8496b

ℹ️ 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".

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 3214ec648b

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from e257e8e to 8b577e6 Compare October 28, 2026 23:01
@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 3214ec6 to 027f499 Compare October 28, 2026 23:01
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 027f4994aa

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from 8b577e6 to c47c543 Compare October 28, 2026 23:05
@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 027f499 to 6ee9800 Compare October 28, 2026 23:05
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 6ee9800d35

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 6ee9800 to f96f688 Compare October 28, 2026 23:10
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from f96f688 to 3ae9bdf Compare October 28, 2026 23:19
@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from a083edc to 412b611 Compare October 28, 2026 23:19
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 3ae9bdfd33

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 3ae9bdf to 0a48783 Compare October 28, 2026 23:25
@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from 412b611 to f02c754 Compare October 28, 2026 23:25
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from f02c754 to e6fd64b Compare October 28, 2026 23:27
@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 0a48783 to 92b3ee3 Compare October 28, 2026 23:27
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 92b3ee3f78

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from e6fd64b to 6649d5f Compare October 28, 2026 23:33
@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 92b3ee3 to f508403 Compare October 28, 2026 23:33
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: f508403f7c

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from f508403 to 3b8d968 Compare October 28, 2026 23:43
@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from 6649d5f to 0a209fb Compare October 28, 2026 23:43
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 3b8d9680a6

ℹ️ 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".

@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 3b8d968 to 79384a5 Compare October 29, 2026 00:12
@phernandez
phernandez force-pushed the codex/security-shared-path-contracts branch from 0a209fb to 5997238 Compare October 29, 2026 00:12
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 79384a5b16

ℹ️ 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".

Base automatically changed from codex/security-shared-path-contracts to main October 29, 2026 00:37
@phernandez
phernandez force-pushed the codex/security-simple-yaml branch from 79384a5 to b445aa3 Compare October 29, 2026 00:38
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: b445aa3162

ℹ️ 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".

@phernandez
phernandez merged commit d0a7fbc into main Oct 29, 2026
52 checks passed
@phernandez
phernandez deleted the codex/security-simple-yaml branch October 29, 2026 01:02
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.

Bound YAML graph normalization and merge expansion in Core

1 participant