Secure Your Shopify App with Network Access Rules in shopify.app.toml

Learn how to declare allowed navigation hosts and sources in your shopify.app.toml file, eliminate external‑link warnings, and boost security for storefront and admin experiences.

Secure Your Shopify App with Network Access Rules in shopify.app.toml
5 sections

Shopify’s latest developer update gives you granular control over every external request your app makes. By adding a new network_access section to shopify.app.toml, you can whitelist navigation hosts and data sources, removing the dreaded “You’re leaving Shopify” warning for shoppers and giving Shopify the information it needs to guard against malicious traffic. In this post we’ll break down exactly what changed, who needs to act, and step‑by‑step instructions to get your app compliant and frictionless.

What Changed: Network Access Rules in shopify.app.toml

The new network_access section adds two properties to your app’s TOML configuration:

• allowed_navigation_hosts — a list (max 20) of exact hostnames that your app links to from the storefront or checkout. When a shopper clicks a link that points to one of these hosts, Shopify skips the external‑link warning, creating a smoother checkout flow.

• allowed_sources — up to 20 HTTPS origins that your app’s JavaScript, Liquid, or proxy code loads resources from or sends requests to on storefront, checkout, or the admin. Shopify uses this list to monitor for suspicious activity and to protect your app and merchants from cross‑site attacks.

Both arrays accept plain strings. Hosts must be written exactly as they appear in your links (e.g., app.example.com without protocol). Sources must include the full scheme (e.g., https://api.app.example.com).

Here’s a minimal example that you can paste directly into your shopify.app.toml:

[network_access]

allowed_navigation_hosts = ["app.example.com"]

allowed_sources = ["https://api.app.example.com"]

Who Is Affected

Any public or private app that embeds links, iframes, scripts, or API calls pointing outside Shopify’s domain is impacted. That includes:

• Embedded app home pages that redirect users to your SaaS dashboard.

• Checkout extensions that fetch pricing data or shipping estimates from an external service.

• Admin extensions, app proxies, or custom storefront scripts that call your backend APIs or CDN assets.

If you don’t declare these endpoints, Shopify will continue to show the external‑link warning and may flag suspicious traffic, which could lead to temporary throttling or app review delays.

How to Implement the New network_access Section

  • Audit your codebase. Search for all hard‑coded URLs, fetch calls, script tags, and iframe src attributes that point to domains you don’t control.
  • Create two arrays:
  • • allowed_navigation_hosts – every domain a shopper can be sent to via a link or button.

    • allowed_sources – every origin your JavaScript loads from or posts data to (including APIs, CDNs, analytics providers, etc.).

  • Add the network_access section to the root of your shopify.app.toml file, using the exact syntax shown above. Remember the 20‑item limit per array; if you need more, prioritize critical hosts and consider consolidating assets behind a single domain or CDN.
  • Run shopify app deploy to push the updated TOML to Shopify. The CLI will validate the syntax and warn you if any host exceeds the limit or is malformed.
  • Test in a development store: click every external link and watch the network tab. You should no longer see the “Leaving Shopify” modal for hosts you added, and console warnings about unregistered sources will disappear.
  • Testing and Deployment Checklist

  • Verify that all URLs in allowed_navigation_hosts match the href values exactly (no trailing slashes, no protocol).
  • Ensure every HTTPS origin that your front‑end code contacts appears in allowed_sources (e.g., GraphQL endpoints, webhook receivers, third‑party analytics).
  • Run shopify theme check or a linting step to catch stray URLs that might have been missed.
  • Deploy to a staging store first, confirm that the external‑link warning is gone, and monitor Shopify’s app activity logs for any “unregistered source” alerts.
  • Once verified, push the changes to production and notify any merchant partners that the user experience will be smoother.
  • Conclusion & Next Steps

    By declaring your app’s external hosts in shopify.app.toml, you not only eliminate friction for shoppers but also give Shopify the data it needs to keep your app safe. The change is straightforward—just audit, list, and deploy—and the payoff is an app that feels native, secure, and trustworthy. Need help updating your TOML file or testing the new settings? Drop a comment below or reach out to our Shopify expert team for a quick walkthrough.

    Tags
    Sources

    Related Articles

    Secure Your Shopify Admin API Calls with an IP Allowlist

    Secure Your Shopify Admin API Calls with an IP Allowlist

    Shopify now lets you lock down Admin API tokens to specific IP addresses. Learn what changed, who it affects, and step‑by‑step how to configure the new IP allowlist to protect your app’s data.

    October 27, 20265 min
    Auto‑Sync Translations in Translate & Adapt: Up to 8 Languages Now Updated Weekly

    Auto‑Sync Translations in Translate & Adapt: Up to 8 Languages Now Updated Weekly

    Shopify’s Translate & Adapt now auto‑syncs new content for up to eight languages, keeping storefronts fresh without manual re‑translation. Learn who’s affected, how to enable it, and best practices for merchants and developers.

    October 27, 20263 min
    Earn Extra Commission with Promoted Placements Beta: Shop Campaigns Now Included

    Earn Extra Commission with Promoted Placements Beta: Shop Campaigns Now Included

    Shopify’s Promoted Placements beta now supports Shop Campaigns, automatically adding merchant‑funded commissions to the catalog API response. Learn what changed, who’s affected, and how to capture the new commission data in your integrations.

    October 27, 20263 min
    Unlock External Brand Products with the New Catalog API sources Parameter (Beta)

    Unlock External Brand Products with the New Catalog API sources Parameter (Beta)

    Learn how the Catalog API beta now lets you search for products from brands that don’t sell on Shopify. We break down what changed, who it affects, and show you exactly how to add the new sources parameter to your calls.

    October 27, 20263 min