内容驱动型 Web 应用后端的安全性
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
后端安全性也称为服务器端安全,是指用于保护 Web 应用的后端组件(包括服务器、服务器端核心、数据库和 API 端点)免受威胁和漏洞的影响的做法。安全性是 Web 应用开发的一个重要方面,因为它可以确保客户数据的机密性、完整性和可用性。
使用后端即服务产品的优势之一是,系统会为您完成大量威胁管理工作。但即使是最安全的后端,也可能因设置错误的用户权限等原因而不安全。
在开发内容驱动的 Web 应用时,利用编程技术、配置和设置最佳实践、工具、基础架构和服务来缓解潜在威胁或风险至关重要。OWASP 十大风险概述了当前和新兴的 Web 应用安全风险,以及如何在 Google Cloud 上缓解这些安全风险。
Web 应用防火墙
Web 应用防火墙 (WAF)(例如 Google Cloud Arrmor)是一种安全解决方案,旨在保护 Web 应用免受各种在线威胁(包括常见的 Web 漏洞和攻击)的侵害。它们充当外部请求与内部系统之间的层,通常直接集成在负载均衡或接收外部流量的端点上。它们根据允许或拒绝流量的安全政策监控和分析传入请求,从而阻止恶意请求和潜在威胁。WAF 通常与其他安全措施(包括常规安全测试、安全编码做法和网络安全控制)一起使用,以便为 Web 应用制定全面的安全策略。许多云服务提供商都提供可集成到 Web 应用托管环境中的 WAF 服务。
详细了解如何设置 Google Cloud Armor 来保护后端。
传入流量的代理层
传入代理层(通常称为反向代理)是一种位于客户端请求与 Web 服务器、应用或服务之间的网络安全组件。它代表其后面的服务器(充当中介)处理传入请求。它具有诸多优势,包括安全性、负载均衡、缓存和路由。
代管式代理(或 Facade)层是指外包给第三方提供商的网络基础架构组件,或监督组织代理服务器的部署、维护和操作的代管式服务。代管式代理层可增强网络安全性、优化性能,并提供额外的网络功能。利用代管式代理层,您可以分担与网络组件相关的运营和管理职责,从而减轻内部 IT 团队的负担。这些服务通常具有可扩缩性,并且可进行自定义以满足特定的安全性或合规性要求。
例如,对于可从外部访问的 API,Apigee 是一个云原生 API 管理平台,提供的功能可在流量到达后端之前管理流量、隔离请求以及强制执行安全政策。
服务最佳实践
考虑应用所用服务的安全最佳实践,并遵循其建议。例如,对于 Cloud Run,请务必对您的请求进行身份验证并保护您的云资源。对于 Cloud SQL,请按照最佳做法来配置、架构和管理数据。
Secret Manager 等密文管理系统可以处理应用密文(如 API 密钥、证书和加密密钥)的安全存储、管理和访问。这些服务可以通过连接器连接到您的其他后端服务,让您的后端系统可以安全地访问您的密文。
如果您在后端使用任何其他 API、SDK 或服务,也请研究并遵循其最佳实践。例如,如果您使用 Google Maps Platform 服务,请遵循处理 API 密钥和保护应用的推荐最佳实践。
监控和提醒(包括日志记录和审核访问)也是需要考虑的重要方面。
Google Cloud 安全性最佳实践提供了一般蓝图以及安全架构和应用设计的概览。Security Command Center 包含一套用于在 Google Cloud 上管理安全和风险的工具,其中包括用于识别错误配置、漏洞和其他风险的自动化工具。
开发最佳实践
请遵循用于实现后端的框架和语言的最佳做法。大多数流行的 Web 框架都发布了相关的指南和最佳实践。
不妨考虑在开发或构建流水线中使用自动化分析工具,以帮助识别潜在问题。
OWASP 网络安全性测试指南提供了一个专门针对 Web 应用的测试框架。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eBackend security focuses on safeguarding servers, databases, and APIs to protect sensitive data.\u003c/p\u003e\n"],["\u003cp\u003eUtilizing Web Application Firewalls (WAFs) and proxy layers enhances security by filtering malicious traffic and acting as intermediaries between clients and servers.\u003c/p\u003e\n"],["\u003cp\u003eImplementing service-specific security best practices, such as authentication and resource access control, is crucial for individual components of your backend infrastructure.\u003c/p\u003e\n"],["\u003cp\u003eEmploying a secret management system and adhering to development best practices, including secure coding and automated analysis, strengthens overall application security.\u003c/p\u003e\n"],["\u003cp\u003eContinuous monitoring, alerting, and leveraging security tools like Google Cloud's Security Command Center are essential for ongoing threat detection and mitigation.\u003c/p\u003e\n"]]],["Backend security involves safeguarding server-side components like servers, databases, and APIs. Key actions include implementing Web Application Firewalls (WAFs) like Google Cloud Armor, utilizing proxy layers for traffic management, and following service-specific security best practices. Secret management systems, such as Secret Manager, secure sensitive data. Monitoring, alerting, logging, auditing access, and development best practices, including the OWASP testing guide, are essential for risk mitigation.\n"],null,["# Security for content-driven web app backends\n\nBackend security, also known as server-side security, refers to the practices\nused to protect the backend components of a web application, including servers,\nserver-side core, database, and API endpoints from threats and vulnerabilities.\nSecurity is an essential aspect of web application development since it ensures\nconfidentiality, integrity, and availability of private customer data.\n\nOne of the advantages of using Backend as a Service products is that a lot of\nthe threat management work is being done for you. But even the most secure\nbackend can be made insecure by, for example, setting incorrect user\npermissions.\n\nWhen developing a content-driven web application, it is essential to utilize\nprogramming techniques, configuration and setup best practices, tooling,\ninfrastructure, and services to mitigate potential threats or risks. The [OWASP\nTop Ten](https://owasp.org/www-project-top-ten/) provides an\noverview of current and emerging web application security risks and [how they\ncan be mitigated on Google\nCloud](https://cloud.google.com/architecture/owasp-top-ten-mitigation).\n\nWeb Application Firewalls\n-------------------------\n\nA Web Application Firewall (WAF), such as [Google Cloud\nArmor](https://cloud.google.com/armor/docs/cloud-armor-overview), is a security\nsolution designed to protect web applications from a variety of online threats,\nincluding common web vulnerabilities and attacks. They act as a layer between\nexternal requests and your internal systems, often integrated directly at the\nload balancing or endpoint where external traffic is received. They monitor and\nanalyze incoming requests based on security policies that permit or deny\ntraffic, blocking malicious requests and potential threats. WAFs are often used\nwith other security measures, including regular security testing, secure coding\npractices, and network security controls, to create a comprehensive security\nstrategy for web applications. Many cloud providers offer WAF services that can\nbe integrated into web application hosting environments.\n\n[Learn more about setting up Google Cloud Armor to secure your\nbackend](https://cloud.google.com/armor/docs/how-to).\n\nProxy layer for incoming traffic\n--------------------------------\n\nAn incoming proxy layer, often referred to as a reverse proxy, is a network\nsecurity component that sits between client requests and web servers,\napplications, or services. It handles incoming requests on behalf of the servers\nbehind it, acting as an intermediary. It provides several benefits, including\nsecurity, load balancing, caching, and routing.\n\nManaged proxy (or facade) layers refer to a network infrastructure component\nthat is outsourced to a 3rd party provider or a managed service that oversees\nthe deployment, maintenance, and operation of proxy servers for an organization.\nManaged proxy layers enhance network security, optimize performance, and provide\nadditional networking functions. By utilizing managed proxy layers, you can\noffload the operational and administrative responsibilities associated with\nnetworking components, reducing the burden on in-house IT teams. These services\nare often scalable and can be customized to meet specific security or compliance\nrequirements.\n\nFor example, for an externally accessible API, [Apigee is a cloud-native API\nmanagement\nplatform](https://cloud.google.com/apigee/docs/api-platform/get-started/what-apigee)\nthat provides features to manage traffic, isolate requests, and enforce security\npolicies before traffic reaches the backend.\n\nService best practices\n----------------------\n\nConsider the security best practices for the services your application is using\nand follow its advice. For example, for Cloud Run make sure to [authenticate\nyour requests](https://cloud.google.com/run/docs/authenticating/overview) and\n[secure your cloud\nresources](https://cloud.google.com/run/docs/securing/managing-access). For\n[Cloud SQL follow the best\npractices](https://cloud.google.com/sql/docs/postgres/best-practices) for\nconfiguring, architecting and managing your data.\n\nA secret management system like [Secret\nManager](https://cloud.google.com/secret-manager/docs/overview) handles secure\nstorage, management and access to your application's secrets, such as API keys,\ncertificates and cryptographic keys. These services can be connected to your\nother backend services through connectors, allowing your backend systems to\naccess your secrets securely.\n\nIf you use any other APIs, SDKs or services in your backend, also research and\nfollow their best practices. For example, if you use a Google Maps Platform\nservice, follow the [recommended best practices for handling API keys and\nprotecting your\napplication](https://developers.google.com/maps/api-security-best-practices).\n\nMonitoring and alerting, including logging and auditing access are also\nimportant aspects to consider.\n\nThe [Google Cloud security best\npractices](https://cloud.google.com/security/best-practices) provide general\nblue prints and overviews over secure architecture and app designs. The\n[Security Command Center](https://cloud.google.com/security-command-center)\nincludes a suite of tools for security and risk management on Google Cloud,\nincluding automated tooling to identify misconfigurations, vulnerabilities and\nother risks.\n\nDevelopment best practices\n--------------------------\n\nFollow the best practices for the framework and language you use to implement\nthe backend. Most popular web frameworks have published guides and best\npractices to follow.\n\nConsider automated analysis tooling as part of your development or build\npipeline to help identify potential issues.\n\nThe [OWASP Web Security Testing\nGuide](https://owasp.org/www-project-web-security-testing-guide/)\nprovides a testing framework that is specifically targeted at web applications."]]