Skip to content

Harden BFBS reflection verification#9172

Open
M0nd0R wants to merge 1 commit into
google:masterfrom
M0nd0R:security/bfbs-semantic-verifier
Open

Harden BFBS reflection verification#9172
M0nd0R wants to merge 1 commit into
google:masterfrom
M0nd0R:security/bfbs-semantic-verifier

Conversation

@M0nd0R

@M0nd0R M0nd0R commented Jul 14, 2026

Copy link
Copy Markdown

Summary

  • harden BFBS reflection verification so malformed schema metadata is rejected before reflection helpers trust it
  • validate field ids, referenced object/enum indices, struct inline layout metadata, and union enum ordering
  • add regression coverage for malformed BFBS schemas that previously slipped through structural verification alone

Root Cause

The BFBS verifier accepted structurally valid buffers without enforcing the semantic invariants that reflection consumers rely on later. That left helper paths assuming field maps, type indices, struct layouts, and union metadata were already trustworthy.

Impact

Malformed BFBS inputs can no longer reach reflection helpers with inconsistent metadata that would otherwise trigger invalid indexing, invalid dereferences, or verifier/runtime disagreement.

Testing

  • ninja -C build flattests
  • build/flattests

@google-cla

google-cla Bot commented Jul 14, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions Bot added c++ codegen Involving generating code from schema labels Jul 14, 2026
@M0nd0R M0nd0R marked this pull request as ready for review July 14, 2026 01:53
@M0nd0R M0nd0R requested a review from dbaileychess as a code owner July 14, 2026 01:53
Reject malformed BFBS metadata before it reaches reflection helpers and add regression coverage for invalid field ids, type indices, struct layouts, and union enum ordering.

Tested with:
- cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DFLATBUFFERS_BUILD_TESTS=ON
- ninja -C build flattests
- build/flattests
@M0nd0R M0nd0R force-pushed the security/bfbs-semantic-verifier branch from 033d98a to deb5f08 Compare July 14, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant