惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
Google DeepMind News
Google DeepMind News
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The GitHub Blog
The GitHub Blog
I
InfoQ
A
About on SuperTechFans
GbyAI
GbyAI
宝玉的分享
宝玉的分享
爱范儿
爱范儿
博客园 - 【当耐特】
博客园 - 司徒正美
博客园 - 聂微东
P
Proofpoint News Feed
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
B
Blog RSS Feed
Jina AI
Jina AI
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
博客园 - 叶小钗

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Platform Engineering in Practice: Hardening Backstage wit...
Leonardo Via · 2026-05-19 · via DEV Community

Spotify Backstage has revolutionized Platform Engineering by centralizing the Developer Experience (DX) into Internal Developer Portals (IDPs). However, when you scale an IDP to serve thousands of developers in complex enterprise environments, concurrency issues, permission bottlenecks, and critical security vulnerabilities start to emerge.

Today, I want to share three advanced architectural patterns we designed to solve these problems at their root, along with our recent Open-Source contributions to the community.


1. SRE Watchdogs: Preventing "TCP Hangs" in Catalog Synchronization

The Problem:
When building a Custom Entity Provider to sync thousands of repositories from Azure DevOps or users from MS Graph/EntraID, external APIs can often exhibit instability. If the network ingestion process stalls (TCP Hangs), it blocks the Node.js Event Loop within Backstage, causing widespread unavailability and request queuing.

The Solution (Decorator Pattern & Mutex):
Instead of modifying the ingestion code directly, we applied the Decorator design pattern to wrap our providers with an SRE Watchdog. This "watchdog" injects a Mutex (mutual exclusion) and a strict Timeout (e.g., 15 minutes).

// SRE Watchdog Wrapper
export class ResilientEntityProviderWrapper implements EntityProvider {
  constructor(private readonly inner: EntityProvider, private readonly timeoutMs: number) {}

  async connect(connection: EntityProviderConnection): Promise<void> {
    // Safely initializes the connection
    await this.inner.connect(connection);
  }

  async refresh(logger: Logger): Promise<void> {
    // Injects Mutex and Timeout to prevent silent Azure API hangs
    return withTimeoutAndMutex(
      () => this.inner.refresh(logger), 
      this.timeoutMs, 
      "AzureDevOpsSyncTimeout"
    );
  }
}

Enter fullscreen mode Exit fullscreen mode

This guarantees that network bottlenecks or third-party API instability will never bring down the IDP.


2. Zero-Touch RBAC: From Static YAML to Dynamic Conditional Policies

The Problem:
Backstage utilizes a robust permissions framework, but the community standard frequently relies on creating static Roles within extensive YAML files. In a dynamic organization, manually maintaining the pairing between developers, squads, and software components simply does not scale.

The Solution (Push-Down SQL):
We designed a Zero-Touch RBAC architecture. We abolished manual configurations by replacing static identity checks with dynamic authorization conditional policies (createCatalogConditionalDecision).

Backstage now natively mirrors hierarchies from Azure Active Directory, dynamically mapping resource ownership at query time (Push-Down SQL). A user is granted or denied administrative access over a software entity based solely on their Identity Provider "Claims," resulting in zero infrastructure friction and automated governance.


3. Open Source Contribution: Zero-Leak Policy (Mitigating SSRF in the Scaffolder)

The Problem:
Within the Backstage ecosystem, the http:backstage:request template action (maintained by the excellent RoadieHQ team) is widely used for HTTP integrations. However, we noticed that it lacked native guardrails when templates received dynamic inputs, opening severe vulnerabilities to Server-Side Request Forgery (SSRF) or Confused Deputy attacks. A malicious user could exploit the Scaffolder to scan ports on the internal network or mutate confidential endpoints via restricted methods.

The Solution:
Today, I took the lead in patching this vector and submitted an official Pull Request to the community's Open Source repository.

We injected coreServices.rootConfig directly into the HTTP module's constructor and created a parameterized Zero-Leak Policy via app-config.yaml. Now, Platform Administrators can enforce a strict security Whitelist:

  • scaffolder.http.allowedMethods: To restrict accidental deletions (e.g., blocking DELETE).
  • scaffolder.http.allowedHosts: To guarantee that Scaffolder HTTP requests only reach authorized hosts, effectively isolating the network infrastructure.

Here is a glimpse of the architecture we injected into the action's handler:

// 🛡️ ZERO-LEAK POLICY: SSRF and Confused Deputy Mitigation
const allowedMethods = config?.getOptionalStringArray('scaffolder.http.allowedMethods');
const allowedHosts = config?.getOptionalStringArray('scaffolder.http.allowedHosts');

if (allowedMethods && !allowedMethods.includes(method)) {
  throw new Error(
    `Security Policy Violation: HTTP method '${method}' is not allowed. ` +
    `Allowed methods: ${allowedMethods.join(', ')}.`
  );
}

if (allowedHosts) {
  const requestUrl = new URL(input.path);
  if (!allowedHosts.includes(requestUrl.hostname)) {
    throw new Error(
      `Security Policy Violation: Host '${requestUrl.hostname}' is not in the allowed list.`
    );
  }
}

Enter fullscreen mode Exit fullscreen mode

# app-config.yaml Hardening
scaffolder:
  http:
    allowedMethods: ['GET', 'POST', 'PUT']
    allowedHosts: ['.dev.azure.com', 'api.myinternal.system']

Enter fullscreen mode Exit fullscreen mode


4. Giving Back to the Community: Open-Sourcing Our Modules to NPM

Beyond architectural improvements, we strongly believe in the open-source philosophy. To help other organizations struggling with similar challenges, we have decoupled our internal solutions and officially published them to the NPM registry!

You can check out our new standalone Backstage packages:


Conclusion

Implementing an IDP like Backstage is only the first step. The true challenge of Platform Engineering lies in ensuring that the platform operates continuously, invisibly, and inviolably under the highest standards of governance (SRE & CyberSec).

If you also work in Platform Engineering or want to debate resilient architectures in enterprise Node/React ecosystems, let's connect! Feel free to share your thoughts on how your teams handle permissions and resilience in your IDPs.

PlatformEngineering #Backstage #DevOps #SRE #CyberSecurity #OpenSource #NodeJS #Architecture