What is the situation when the login credentials are partitioned by the top-level site when embedded by other sites?
When a page is embedded in another site, the login credentials are partitioned according to the top-level site, which means that the same set of credentials no longer shares global data, but is stored separately according to 'who is on top'. When accessing the site directly, what is read is the one at the top level of this site; when the page is embedded in someone else's site, reading and writing is done based on the one partitioned according to the top-level site of that site. The partitioning mechanism solves cross-site tracking, but the cost is that the embedded party can no longer share the login state of the main site.
What does partitioning break the same set of credentials into?
When not partitioned, credentials are stored according to the site's own affiliation, and it is the same copy regardless of where the request is initiated. After adding the partition attribute, the storage key becomes a combination of the top-level site and the site itself: it is one copy when the top level is A, another copy when the top level is B, and another copy when accessed directly. According to the official documentation, this attribute indicates that the credentials should use partitioned storage. It does not have the authority to add or delete any data, but only changes the isolation relationship between them.
Why must the security tag be included at the same time
The document emphasizes twice: If the partition attribute is set, the security tag must be set at the same time, and the partition credentials must be transmitted in a secure manner. The reason for the design premise of partitioning is an encrypted channel - it controls the timing of credentials being taken out in different contexts. If credentials can be transmitted over a plaintext connection, isolation loses its meaning. In addition to the security tag, the document also suggests using a prefix with the hostname to name the credentials, binding them to a specific host rather than a registered domain, to avoid another subdomain in the same domain mistakenly reading it. A complete statement must appear simultaneously with four items: cross-site transmission, security tag, path restriction, and partition attribute.
Three typical manifestations that cannot be read on the embedded page
These are cases of lost login status: After the page is embedded in a partner site, all the places that require login show as not logged in, because after partitioning, the top-level one read is from the partner site, which is usually empty. The second case is inconsistent status: At the same address, it is logged in when accessed directly, but when embedded, it jumps to the login page, with different data written on both sides. The third case is error in CSRF protection and status verification: A request is made with some credentials, but the verification is done according to another context. The common point of these three behaviors is that the problem only appears in the embedded environment, and cannot be reproduced when accessed locally directly.
Two things to confirm before the transformation
This issue is whether this credential should be shared or not. The common design goal of login credentials is 'who am I on my own site', and once it is handed over to the partitioning mechanism, it is equivalent to admitting that it is a different identity in different top-level environments.AnQiCMS authentication follows JWT, the transmission of login credentials and background permission verification are judged according to the site itself, and user management and VIP grouping determine what content different user groups can read - this design inherently assumes that identity belongs to the site rather than to the embedded context.The second thing is whether the embedded page needs login status. Most display-style embeddings do not require it, and making it unreadable is the correct behavior; when it is indeed needed, the correct solution is not to cancel the partition, but to switch to carrying one-time credentials by the top-level page or using an interface to retrieve data between servers.
| Scene | Performance after partitioning | Is it a problem | Direction of processing |
|---|---|---|---|
| Direct access to the site | Read the data at the top level of this site | Normal | No change needed |
| Embedded in display by other sites | Read the other data at the top level of the other party, usually empty | Normal | Maintain read-only display without requiring login |
| Write operation needs to be performed on the embedded page | Verification is performed according to another context, which is prone to failure | Is | Change to jump back to the site to complete |
| Hope to share the same data across contexts | The partition mechanism is inherently impossible | Is | Replace data with server-side interface, do not open the partition |
Common questions
Q: If we remove the partition attribute, can the embedded page read the login state? A: Technically it can, but the cost is to give up this isolation, allowing the same credentials to be taken across top-level contexts, which is contrary to the purpose of tightening browser tracking.
What is the relationship between partition and cross-site tag? Answer: Two things. The cross-site tag determines whether this data can be sent in cross-site requests, and the partition determines which storage copy is read when sending.
Why is it recommended to use a prefix with the hostname? Answer: To bind the credentials to a specific host rather than a registrable domain, to avoid other hosts in the same domain from reading it.