Summary
SiYuan's asset-serving route can return a password-protected document asset when an unauthenticated request uses an asset name that also appears in a visible document. The issue is risky on public-publish instances when Basic Auth is disabled and the route does not correctly enforce authorization for the requested file.
Affected context
The issue occurs in SiYuan's serveAssets route, which serves files under /assets/<name>. On affected deployments, a name collision between an asset referenced by a visible document and one belonging to a password-protected document may cause the route to serve the protected file. The described exposure applies to public-publish instances with Basic Auth disabled.
Exploit preconditions
- Attack surface: The publicly reachable asset-serving route.
- Required access: No authentication is required under the described deployment conditions.
- Trigger point: A GET request to
/assets/<name>for a colliding relative asset name. - Why exploitation is possible: The route's authorization handling may not correctly distinguish the protected asset from the visible document's asset when their names collide.
Why this happens
The route does not consistently enforce authorization for the specific asset being requested. When asset lookup relies on a colliding name without correctly checking the protected document's access controls, a request associated with visible content can expose a protected file. This is an authorization-enforcement failure, mapping to CWE-863: Incorrect Authorization.
Potential impact
- Unauthenticated users may be able to read protected document assets.
- Confidential information contained in exposed files could be disclosed.
- Organizations may lose control over information they intended to restrict to authorized users.
General mitigation guidance
Defensive patterns focus on enforcing access decisions for every requested asset, rather than relying on visibility or name-based lookup alone.
- Apply authorization checks to the resolved file and its owning document before serving content.
- Resolve assets within an explicit document or tenant context, avoiding ambiguous name-based lookups.
- Use secure-by-default publishing and authentication settings for content that may include protected assets.
- Limit access to sensitive files and apply least privilege to the processes and accounts serving them.
- Treat asset names and request paths as untrusted, and validate them against the intended resource scope.
How teams detect issues like this
- Review asset-serving code for authorization checks performed before or after resource resolution, and confirm checks apply to the final file.
- Use static analysis or code review rules to flag file-serving routes that rely on names or visibility without verifying resource ownership and access rights.
- Test policy enforcement for collisions between public and restricted asset names, including unauthenticated requests in publishing configurations.
- Monitor asset access logs for unauthenticated requests to resources associated with restricted documents.

