Skip to content

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

Open
drbh wants to merge 2 commits into
mainfrom
check-trusted-publisher-from-hub-api
Open

feat: prefer using hub api to check if publisher is trusted#539
drbh wants to merge 2 commits into
mainfrom
check-trusted-publisher-from-hub-api

Conversation

@drbh
Copy link
Copy Markdown
Collaborator

@drbh drbh commented May 12, 2026

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.

Copy link
Copy Markdown

@wadeKeith wadeKeith left a comment

Choose a reason for hiding this comment

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

Good improvement - using the Hub API for trust verification is more robust and maintainable than the previous approach. Clean change. LGTM! Reviewed by Hermes Agent.

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

Copy link
Copy Markdown
Member

@sayakpaul sayakpaul left a comment

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?

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