Skip to content

feat: prefer using hub api to check if publisher is trusted - #539

Merged
sayakpaul merged 3 commits into
mainfrom
check-trusted-publisher-from-hub-api
May 13, 2026
Merged

sayakpaul merged 3 commits into
mainfrom
check-trusted-publisher-from-hub-api

Conversation

@drbh

@drbh drbh commented May 12, 2026

Copy link
Copy Markdown
Collaborator

This PR prefers checking if a publisher is trusted from the hub api response

depends on: https://github.com/huggingface-internal/moon-landing/pull/18061
related to: #538

CI may need to be rerun after the latest backend deployment

Co-authored-by: Copilot <copilot@github.com>
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@wadeKeith wadeKeith left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Withdrawn; this review was too cursory.

Comment thread kernels/src/kernels/utils.py Outdated
except Exception:
failure_reason = "could not verify publisher trust status"
else:
if getattr(info, "trustedKernelPublisher", False) is True:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if getattr(info, "trustedKernelPublisher", False) is True:
if getattr(info, "trustedKernelPublisher", False):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, updated in latest too

Comment thread kernels/src/kernels/utils.py Outdated
try:
info = _get_hf_api().get_organization_overview(publisher)
except Exception:
failure_reason = "could not verify publisher trust status"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to have a raise here as immediately. Raising once we know we can solves future logic bugs when this function becomes more complicated.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good to me this makes sense. updated in latest

@sayakpaul sayakpaul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any test needs to be updated?

@drbh

drbh commented May 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

Any test needs to be updated?

I don't think so, the trustedPublishers returned from the api should match the ones that were previously hardcoded so the tests should pass.

CI looks green (aside from the E2E test which should be resolved in #519) so I think the tests may be good as it

**will leaved unmerged for now, but if this looks good please feel free to merge! Otherwise I'll address any issues and merge tomorrow in my morning

@sayakpaul
sayakpaul merged commit 000eb6e into main May 13, 2026
68 of 69 checks passed
@sayakpaul
sayakpaul deleted the check-trusted-publisher-from-hub-api branch May 13, 2026 06:16

This branch was previously deployed

1 inactive deployment
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.

5 participants