{"id":2515,"date":"2025-09-22T16:29:53","date_gmt":"2025-09-22T16:29:53","guid":{"rendered":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2025\/09\/22\/new-trusted-publishing-enhances-security-on-nuget-org\/"},"modified":"2025-09-22T16:29:53","modified_gmt":"2025-09-22T16:29:53","slug":"new-trusted-publishing-enhances-security-on-nuget-org","status":"publish","type":"post","link":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/2025\/09\/22\/new-trusted-publishing-enhances-security-on-nuget-org\/","title":{"rendered":"New Trusted Publishing enhances security on NuGet.org"},"content":{"rendered":"<p>We\u2019re excited to announce Trusted Publishing on nuget.org \u2014 a simpler, safer way to publish NuGet packages from GitHub Actions. Rather than relying on long\u2011lived API keys, your workflow can use a short\u2011lived GitHub OIDC token to request a temporary, single\u2011use NuGet API key. These keys expire quickly (\u2248 1 hour), eliminating long\u2011lived secrets that need to be stored, rotated, or protected from leaks.<\/p>\n<p> Read the docs at <a href=\"https:\/\/aka.ms\/nuget\/trusted-publishing\">aka.ms\/nuget\/trusted-publishing<\/a><\/p>\n<p><a href=\"https:\/\/www.nuget.org\/account\/trustedpublishing\" target=\"_blank\"><\/a><\/p>\n<h2>Why Trusted Publishing? <\/h2>\n<p>No long\u2011lived secrets \u2014 nothing sensitive stored in your repository or CI.<br \/>\nShort\u2011lived credentials \u2014 temporary API keys are issued just\u2011in\u2011time and typically last about <strong>1 hour<\/strong>.<br \/>\nOne token \u2192 one key \u2014 each job\u2019s OIDC token maps to a single temporary API key used for that publish.<\/p>\n<h2>Getting started <\/h2>\n<p><strong>Open the Trusted Publishing page<\/strong><br \/>\nSign in to <strong>nuget.org<\/strong> \u2192 open your user menu (top right) \u2192 <strong>Trusted Publishing<\/strong> (next to <strong>API Keys<\/strong>).<br \/>\n<strong>Create a policy<\/strong><\/p>\n<p><strong>Package owner:<\/strong> you or your organization<br \/>\n<strong>Repository owner \/ repository:<\/strong> your GitHub org\/user and repository name (for example contoso-sdk)<br \/>\n<strong>Workflow file:<\/strong> the YAML file in .github\/workflows\/ (for example release.yml)<br \/>\n<em>(Optional)<\/em> <strong>Environment:<\/strong> if your workflow uses GitHub Actions environments<\/p>\n<p><strong>Wire up your GitHub Actions workflow<\/strong> using the minimal example below.<\/p>\n<h2>Minimal GitHub Actions example <\/h2>\n<p>This example includes only the steps that interact with nuget.org: enabling OIDC, exchanging the token for a temporary API key, and pushing the package.<\/p>\n<p>permissions:<br \/>\n  id-token: write   # required for GitHub OIDC<\/p>\n<p>jobs:<br \/>\n  build-and-publish:<br \/>\n    permissions:<br \/>\n      id-token: write  # enable GitHub OIDC token issuance for this job<\/p>\n<p>    steps:<br \/>\n      # Build your artifacts\/my-sdk.nupkg package here<\/p>\n<p>      # Get a short-lived NuGet API key<br \/>\n      &#8211; name: NuGet login (OIDC \u2192 temp API key)<br \/>\n        uses: NuGet\/login@v1<br \/>\n        id: login<br \/>\n        with:<br \/>\n          # Recommended: use a secret like ${{ secrets.NUGET_USER }} for your nuget.org username (profile name), NOT your email address<br \/>\n          user: contoso-bot<\/p>\n<p>      # Push the package<br \/>\n        run: dotnet nuget push artifacts\/my-sdk.nupkg &#8211;api-key ${{ steps.login.outputs.NUGET_API_KEY }} &#8211;source https:\/\/api.nuget.org\/v3\/index.json<\/p>\n<h2>How it works <\/h2>\n<p>GitHub issues an OIDC token to the job.<br \/>\nThe NuGet login step sends that token to nuget.org.<br \/>\nnuget.org validates the token against your Trusted Publishing policy and returns a temporary API key.<br \/>\nYour workflow uses that key to publish. Request the key immediately before running dotnet nuget push \u2014 it expires quickly (\u2248 <strong>1 hour<\/strong>).<\/p>\n<h2>Policy ownership &amp; lifecycle <\/h2>\n<p><strong>Private repo bootstrap (7 days, re-activate anytime).<\/strong> New policies for private repositories start out as active for 7 days by default. After the first successful NuGet login (the exchange of a job\u2019s OIDC token for a temporary API key), the policy becomes permanently active and is bound to immutable GitHub IDs. If you miss the initial 7\u2011day window, you can manually re\u2011activate the policy for another 7 days from the Trusted Publishing page. A successful NuGet login is sufficient \u2014 you don\u2019t need to publish a package.<br \/>\n<strong>Owner matters.<\/strong> A policy is owned by a user or organization and applies only to packages owned by that owner.<br \/>\n<strong>Org changes are respected.<\/strong> If the policy creator loses org membership, or the org is locked or deleted, the policy is disabled and displays a clear warning. When membership or org access is restored, the policy re\u2011activates automatically.<\/p>\n<h2>Migrating from long\u2011lived API keys <\/h2>\n<p>Already publishing from GitHub Actions? Switching is easy:<\/p>\n<p>Create a Trusted Publishing policy on nuget.org.<br \/>\nRemove stored NuGet API keys from your repo or CI secrets.<br \/>\nAdd NuGet\/login@v1 to your workflow and use its output key with dotnet nuget push.<br \/>\nDone \u2014 enjoy, no more key management!<\/p>\n<h2>Try it today <\/h2>\n<p>Read the docs at <a href=\"https:\/\/aka.ms\/nuget\/trusted-publishing\">aka.ms\/nuget\/trusted-publishing<\/a><br \/>\nSign in to <strong>nuget.org \u2192 Trusted Publishing<\/strong> (next to <strong>API Keys<\/strong>) and create your first policy.<\/p>\n<p><span>Huge thanks to <a class=\"fui-Link ___1q1shib f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1s184ao f1mk8lai fnbmjn9 f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn\" title=\"https:\/\/openssf.org\/\" href=\"https:\/\/openssf.org\/\" target=\"_blank\">OpenSSF<\/a> and the <a class=\"fui-Link ___1q1shib f2hkw1w f3rmtva f1ewtqcl fyind8e f1k6fduh f1w7gpdv fk6fouc fjoy568 figsok6 f1s184ao f1mk8lai fnbmjn9 f1o700av f13mvf36 f1cmlufx f9n3di6 f1ids18y f1tx3yz7 f1deo86v f1eh06m1 f1iescvh fhgqx19 f1olyrje f1p93eir f1nev41a f1h8hb77 f1lqvz6u f10aw75t fsle3fq f17ae5zn\" title=\"https:\/\/openssf.org\/technical-initiatives\/repository-security\/\" href=\"https:\/\/openssf.org\/technical-initiatives\/repository-security\/\" target=\"_blank\">Securing Software Repos working group<\/a> for defining the Trusted Publishing guidelines and encouraging their adoption throughout the broader ecosystem.<\/span><\/p>\n<p>Publish more securely and with less friction \u2014 thank you for contributing to the NuGet community. <\/p>\n<p>The post <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/enhanced-security-is-here-with-the-new-trust-publishing-on-nuget-org\/\">New Trusted Publishing enhances security on NuGet.org<\/a> appeared first on <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\">.NET Blog<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>We\u2019re excited to announce Trusted Publishing on nuget.org \u2014 a simpler, safer way to publish NuGet packages from GitHub Actions. [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-2515","post","type-post","status-publish","format-standard","hentry","category-dotnet"],"_links":{"self":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/2515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/comments?post=2515"}],"version-history":[{"count":0,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/posts\/2515\/revisions"}],"wp:attachment":[{"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/media?parent=2515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/categories?post=2515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rssfeedtelegrambot.bnaya.co.il\/index.php\/wp-json\/wp\/v2\/tags?post=2515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}