> For the complete documentation index, see [llms.txt](https://docs.eitherway.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eitherway.ai/documentation/ai-companion/security-foundation.md).

# Security Foundation

A more capable companion only matters if the platform underneath it is trustworthy.

That is why the AI Companion work has been moving alongside a broader security and infrastructure hardening pass across the live platform. The companion is not being built in isolation. It is being built on top of a safer default environment.

#### Recent platform work already live in production includes:

* tamper-resistant audit records for sensitive actions
* stronger, unified authentication across the platform
* access tokens kept only in browser memory, not written to disk
* secrets stored hashed at rest
* platform-wide rate limits to reduce abuse
* stricter isolation between previews and embedded widgets
* closure of older exposed or weak API paths
* stronger security awareness inside the code generation model itself

The point of this work is simple: autonomy without trust is not a product worth shipping.

The model layer behind code generation has also been updated to recognize and warn against a growing list of common security pitfalls.

#### That includes issues such as:

* cross-site scripting
* unsafe signature handling
* cross-origin access mistakes
* insecure token contract permissions
* unsafe automation patterns
* other known review blockers

The result should be fewer bad suggestions, fewer avoidable review failures, and output that is safer by default.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eitherway.ai/documentation/ai-companion/security-foundation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
