HabrAugust 12, 2026🇷🇺Translated from Russian

Same-Origin Policy and CORS: How Browsers Enforce Web Security Boundaries

The fundamental question in web security is what stops a script on one website from reading sensitive information, such as a bank balance, from another site where the user is logged in. Technically nothing prevents the request itself from being sent, because the browser would attach the user’s cookies, making the request appear authenticated. However, the Same-Origin Policy built into every browser blocks the script from reading the response, thereby protecting user data across different sites.

An origin consists of exactly three components: protocol, domain, and port. Two URLs belong to the same origin only when all three match. For example, https://shop.ru/catalog and https://shop.ru/cart share the same origin, while http://shop.ru and https://shop.ru are treated as different origins. Even subdomains such as https://api.shop.ru constitute a separate origin from https://shop.ru, which frequently surprises developers building front-end applications that call their own APIs.

The policy states that code executing in one origin cannot read data from another origin. It does not prohibit loading foreign resources; it only prevents programmatic reading of their content. Images, fonts, analytics scripts, and embedded videos from other origins load and display normally. Attempting to draw such an image onto a <canvas> element and read its pixels is blocked. Similarly, an <iframe> can display a third-party page, yet JavaScript cannot inspect or extract data from that frame.

Foreign scripts loaded via <script> tags execute with the privileges of the including page because they become part of that origin’s code rather than remaining external data. This behavior enables libraries such as jQuery from CDNs but also introduces risk if the CDN is compromised. Developers therefore often host critical libraries themselves or apply subresource integrity hashes.

When an application must read data from another origin, for instance retrieving weather information from a public API, the Cross-Origin Resource Sharing (CORS) mechanism provides a controlled exception. The target server decides whether to allow the read by returning the header Access-Control-Allow-Origin. A value of * permits any origin, while a specific domain restricts access to that single origin. Without this header the browser discards the response before handing it to the calling script.

CORS operates exclusively inside the browser and does not protect servers against requests issued from tools such as curl or from other servers. Authentication and authorization checks on the server side remain the only effective controls for sensitive data. Even when a request is blocked by CORS, the request itself may still have reached the server and triggered side effects if it was a state-changing operation.

Browsers classify cross-origin requests as simple or non-simple. Simple requests (GET or POST with standard content types) are sent immediately. Non-simple requests trigger a preliminary OPTIONS preflight request so the server can declare which methods and headers it accepts before the actual request is issued.

Related articles

AntiMalwareOther

Security Vision 5 Strengthens Connectors, Analytics and Data Handling Features

Security Vision has released an update to its SV5 platform focused on improved integrations, deeper analytics and more flexible configuration management. The release introduces namespace configuration for the WMI connector to execute WQL queries at specified addresses, along with event compression during transmission in connector configurations. An updated librdkafka library now enables the Kafka connector to support SASL/SCRAM authentication for Kafka versions 4.0.0 and higher. Data transformation capabilities have been expanded to allow conversion of numbers between binary, octal and hexadecimal numeral systems, while the Formula transformation adds abs() and sqrt() functions. Linear and bar charts receive new scaling settings, and report generation through the portal has been moved to asynchronous mode to prevent interface freezing during long exports. Additional changes affect object cards, type and directory editors, module settings, graph icon management with mapping conditions converted to filters, and a dedicated section for correlation rules with a general view and editor. The audit log now records grouping changes separately for system and user directories, and the platform blocks execution of disabled connectors through workflows.

HabrOther

Building Secure MLOps Platforms in Air-Gapped Environments for DevOps Engineers

The article explains how DevOps engineers can construct a minimal yet complete MLOps platform inside a closed, air-gapped network without relying on any cloud services. It highlights the cultural gap between data scientists and DevOps teams and shows how MLOps practices such as data versioning, experiment tracking, and model registries bridge that gap. The architecture separates GPU training nodes from a Kubernetes serving cluster and uses open-source components including ArgoCD for GitOps, MLflow with PostgreSQL, MinIO, DVC, OpenBao, and External Secrets Operator. Special attention is given to secrets management with SOPS and age keys, image scanning with Trivy and Bandit, and secure Docker access via socket proxy on the training server. The setup avoids Kubeflow and HashiCorp Vault due to complexity and licensing concerns, favoring lighter, license-friendly alternatives suitable for isolated perimeters.

HabrOther

How the Modern Web and HTTPS Emerged from Simple Two-Computer Networks

The article traces the evolution of internet infrastructure from two friends connecting PCs with twisted-pair cable and assigning IP addresses to the global system of DNS, routing, and public-key certificates. It explains how early local networks expanded with switches, always-on servers, and domain names to solve the problem of changing IP addresses. As networks grew and interconnected through routers and ISPs, new risks of eavesdropping and traffic redirection appeared on open paths. The solution introduced centralized certificate authorities such as the fictional Sectigo that issue chained certificates rooted in pre-installed trust stores. The piece details the structure of certificates, key pairs, signing chains, and the browser validation process that enables encrypted HTTPS sessions. Written in accessible language with deliberate simplifications, the text serves as an educational overview rather than a technical manual.

AntiMalwareOther

Russian Neighbors Fined Over 200,000 Rubles for Defamatory Remarks in Apartment Building Chat as Supreme Court Upholds Ruling

Two women who participated in a shared apartment building chat have been ordered to pay more than 200,000 rubles in total after a court found their messages about a neighbor to be defamatory. The case began when residents complained about noisy tenants and escalated into mutual insults exchanged in the group chat, via SMS, and during phone calls. The apartment owner filed a lawsuit for protection of honor and dignity after police found no administrative violation in his actions as landlord. A linguistic expert determined that several public messages, while free of direct profanity, contained derogatory characterizations and implications of mental illness that could not be considered acceptable value judgments. The court awarded more than 100,000 rubles against one defendant and a slightly smaller sum against the second, taking into account the plaintiff's own conduct during the conflict. All appeals were rejected, including by the Supreme Court, establishing that even indirect humiliating statements about an identifiable person in a building chat can result in substantial financial liability.