Skip to content

fix(owners): read a 0-byte OWNERS file as listing nobody - #416

Merged
mrbobbytables merged 1 commit into
cncf:mainfrom
mrbobbytables:fix/empty-owners-file
Oct 9, 2026
Merged

mrbobbytables merged 1 commit into
cncf:mainfrom
mrbobbytables:fix/empty-owners-file

Conversation

@mrbobbytables

Copy link
Copy Markdown
Member

Description

GitHub returns content: "" for an empty blob. Both OWNERS decode sites (decode in src/utils/owners.ts, retrieveOwnersFile in src/utils/auth.ts) rejected that as invalid OWNERS file returned from GitHub API, failing every OWNERS-reading run on a 0-byte OWNERS file. They now only reject a missing content, so an empty file reaches parseOwners and lists nobody.

Fixes #404

Testing

  • Added a 0-byte OWNERS case to __tests__/utils/ownersAuth.test.ts (tree/blob path)
  • Added a 0-byte root OWNERS row to the policyAllows table in __tests__/utils/auth.test.ts
  • Both new cases fail without the source change and pass with it
  • npm test

#406 drives the other parseOwners shapes through the bundle; a 0-byte case can be added there now.

Checklist

  • I ran npm run all to lint and build my code
  • I ran npm run pack and committed dist/
  • Commits are signed off (DCO)
  • Note any new dependencies these changes bring in (none)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (n/a)
  • My changes generates no new warnings (the 2 existing jsdoc warnings are unrelated)

GitHub returns content "" for an empty blob; the truthiness check on
content rejected it as invalid. Check for undefined instead so the empty
file reaches parseOwners.

Fixes cncf#404

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Please add a kind label with /kind failing-test or /kind cleanup.

@mrbobbytables
mrbobbytables merged commit 4f20776 into cncf:main Oct 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] a 0-byte OWNERS file fails every OWNERS-reading run with "invalid OWNERS file returned from GitHub API" (decode treats content "" as missing)

1 participant