Skip to content

Coderabbit/secure frontmatter parsing/0fd11ca8 - #47105

Closed
Ahmed-B52 wants to merge 9 commits into
github:mainfrom
Ahmed-B52:coderabbit/secure-frontmatter-parsing/0fd11ca8
Closed

Ahmed-B52 wants to merge 9 commits into
github:mainfrom
Ahmed-B52:coderabbit/secure-frontmatter-parsing/0fd11ca8

Conversation

@Ahmed-B52

@Ahmed-B52 Ahmed-B52 commented Nov 28, 2026 •

Copy link
Copy Markdown

Why:

Closes:

What's being changed (if available, include any code snippets, screenshots, or gifs):

Check off the following:

  • A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require an SME review from GitHub staff.
  • The changes in this PR meet the docs fundamentals that are required for all content.
  • All CI checks are passing and the changes look good in the review environment.

Ahmed-B52 and others added 9 commits November 27, 2026 23:41
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
<!-- coderabbit-ai-generated:v1 -->
…on-builder/fb051f5c

Prevent GraphQL injection in docs review project updates
…parsers/f720c066

Restrict frontmatter parsing to safe YAML formats
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Resolved conflicts in:
- src/content-render/tests/move-by-content-type.ts (unmerged)
- src/frame/lib/read-frontmatter.ts (unmerged)

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
CodeRabbit-Task-Id: 0d1cc25f-093e-44ff-9f53-0de2c3e25501
Copilot AI lite review requested due to automatic review settings November 28, 2026 01:14
@welcome

welcome Bot commented Nov 28, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@docs-bot docs-bot added the invalid This issue/PR is invalid label Nov 28, 2026
@docs-bot

Copy link
Copy Markdown
Collaborator

This pull request may have been opened accidentally. I'm going to close it now, but feel free to check out our contribution guidelines, or raise an issue.

1 similar comment
@docs-bot

Copy link
Copy Markdown
Collaborator

This pull request may have been opened accidentally. I'm going to close it now, but feel free to check out our contribution guidelines, or raise an issue.

@github-actions github-actions Bot closed this Nov 28, 2026
@docs-bot

Copy link
Copy Markdown
Collaborator

This pull request may have been opened accidentally. I'm going to close it now, but feel free to check out our contribution guidelines, or raise an issue.

1 similar comment
@docs-bot

Copy link
Copy Markdown
Collaborator

This pull request may have been opened accidentally. I'm going to close it now, but feel free to check out our contribution guidelines, or raise an issue.

@docs-bot

Copy link
Copy Markdown
Collaborator

👋 Hi there! It looks like you've modified some files that we can't accept as contributions:

  • src/article-api/lib/graphql-helpers.ts
  • src/article-api/transformers/audit-logs-transformer.ts
  • src/article-api/transformers/github-apps-transformer.ts
  • src/article-api/transformers/rest-transformer.ts
  • src/article-api/transformers/webhooks-transformer.ts
  • src/content-linter/lib/helpers/utils.ts
  • src/content-render/scripts/move-by-content-type.ts
  • src/content-render/tests/move-by-content-type.ts
  • src/data-directory/README.md
  • src/data-directory/lib/data-directory.ts
  • src/data-directory/lib/get-data.ts
  • src/data-directory/tests/get-data.ts
  • src/frame/lib/parse-yaml-frontmatter.ts
  • src/frame/lib/read-frontmatter.ts
  • src/frame/tests/read-frontmatter.ts
  • src/versions/scripts/update-versioning-in-files.ts
  • src/workflows/fm-utils.ts
  • src/workflows/fr-add-docs-reviewers-requests.ts
  • src/workflows/projects.ts
  • src/workflows/ready-for-docs-review.ts
  • src/workflows/tests/projects.ts

You'll need to raise a new PR that doesn't include those files, before we can review.

The complete list of files we can't accept are:

  • Anything in the root directory
  • .devcontainer/**
  • .github/**
  • data/reusables/rai/**
  • .vscode/**
  • config/**
  • contributing/**
  • src/**
  • content/actions/how-tos/secure-your-work/security-harden-deployments/**
  • content/README.md

We also can't accept contributions to files in the content directory with frontmatter contentType: rai. You can always check out our full contribution guidelines.

@github-actions

Copy link
Copy Markdown
Contributor

How to review these changes 👓

Thank you for your contribution. To review these changes, choose one of the following options:

A Hubber will need to deploy your changes internally to review.

Table of review links

Note: Please update the URL for your staging server or codespace.

This pull request contains code changes, so we will not generate a table of review links.

🤖 This comment is automatically generated.

Copilot AI 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.

🟡 Changes recommended

A critical parsing bug reparses already-separated body content, causing valid Markdown thematic breaks to be misinterpreted as frontmatter and potentially throwing or stripping content.

1 open issue
What changed in this PR

This PR replaces selected gray-matter usage with shared YAML/JSON frontmatter parsing, parameterizes ProjectV2 GraphQL mutations, and strengthens content migration filesystem safety.

Changes:

  • Adds centralized frontmatter parsing and serialization with handling for BOMs, line endings, labels, and malformed input.
  • Migrates workflows, data utilities, linting, and article API transformers to the shared parser and parsed Markdown content.
  • Uses GraphQL variables for user-derived ProjectV2 values and adds safer path, symlink, write, and cleanup behavior to content migration.
File Description
src/​workflows/​tests/​projects.ts Adds tests for variable-based ProjectV2 mutations and GraphQL-safe values.
src/​workflows/​ready-for-docs-review.ts Passes generated ProjectV2 mutation variables through the GraphQL request.
src/​workflows/​projects.ts Builds parameterized ProjectV2 mutations with fixed field names and request variables.
src/​workflows/​fr-add-docs-reviewers-requests.ts Updates reviewer-request workflow calls to use the new mutation variables API.
src/​workflows/​fm-utils.ts Uses the shared frontmatter parser for workflow content-type checks.
src/​versions/​scripts/​update-versioning-in-files.ts Removes an obsolete TypeScript suppression related to serialization options.
src/​frame/​tests/​read-frontmatter.ts Adds coverage for frontmatter parsing, labeling, errors, and serialization.
src/​frame/​lib/​read-frontmatter.ts Replaces gray-matter integration with shared parsing and YAML serialization.
src/​frame/​lib/​parse-yaml-frontmatter.ts Adds centralized secure YAML/JSON frontmatter parsing and validation.
src/​data-directory/​tests/​get-data.ts Tests labeled, malformed, translated, and fallback reusable frontmatter behavior.
src/​data-directory/​README.md Documents reusable Markdown frontmatter conventions and parsing behavior.
src/​data-directory/​lib/​get-data.ts Uses the shared parser for data and reusable Markdown loading.
src/​data-directory/​lib/​data-directory.ts Uses shared parsing when loading Markdown data files.
src/​content-render/​tests/​move-by-content-type.ts Adds tests for migration safety, symlinks, writes, cleanup, and malformed frontmatter.
src/​content-render/​scripts/​move-by-content-type.ts Adds path validation, symlink checks, safer writes, and conservative cleanup behavior.
src/​content-linter/​lib/​helpers/​utils.ts Uses the shared parser for linter frontmatter extraction.
src/​article-api/​transformers/​webhooks-transformer.ts Uses already-stripped page Markdown for manual content.
src/​article-api/​transformers/​rest-transformer.ts Extracts manual content directly from the parsed page Markdown.
src/​article-api/​transformers/​github-apps-transformer.ts Uses already-stripped page Markdown for GitHub Apps content.
src/​article-api/​transformers/​audit-logs-transformer.ts Extracts manual content directly from the parsed page Markdown.
src/​article-api/​lib/​graphql-helpers.ts Simplifies manual content extraction from parsed page Markdown.

Review effort: Lite

Comment thread src/frame/lib/read-frontmatter.ts Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid This issue/PR is invalid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants