Skip to content

You secure a Stash mount by choosing what it can reach and who can read it. Stash reads each source with the credentials that you give it, and writes what it reads as files on the host. Each agent that can read the mount point sees what those credentials can read.

This page covers the credentials, the files, and the write-back of a mount, and what Stash leaves to the sources.

Give the mount only the access its agents may use

Section titled “Give the mount only the access its agents may use”

A mount is a view of its sources. The source and the identity that the mount uses decide which records the mount can get. Give the mount a role that its agents may use, and no more.

SourceIAM actions
agentcore-memory, readbedrock-agentcore:ListMemoryRecords, GetMemoryRecord, RetrieveMemoryRecords
agentcore-memory, write.trajectoryAlso bedrock-agentcore:CreateEvent
agentcore-memory, write.notesAlso bedrock-agentcore:BatchCreateMemoryRecords, BatchUpdateMemoryRecords
A Gateway source with SigV4bedrock-agentcore:InvokeGateway

The config narrows what a mount fetches, with namespaces, target, and template variables such as ${actorId}. These keys aren’t a security boundary. Set the boundary in the IAM policy or the store.

Send each credential only where it belongs

Section titled “Send each credential only where it belongs”

A source signs only with what its auth names. With no auth, it sends no credential.

auth = { sigv4 = { profile = "ops-reader" } } # one AWS profile
auth = { bearer = { file = "/home/me/.config/stash/token" } } # a token file
auth = { none = {} } # no credential
  • The config holds a variable name or a file path, never the secret.
  • A bearer token in env is fixed when the daemon starts. A token in file is read for each request, so a script can rotate it. Give the file mode 600, and write it atomically.
  • A header value in headers is always env or file, never text.

Know where the daemon gets its credentials

Section titled “Know where the daemon gets its credentials”

The daemon takes its environment once, from the command that starts it: stash create, stash daemon start, or stash usage-analytics. A later command doesn’t change it. To change credentials, run stash daemon stop and start the daemon again in the new environment.

Static and environment keys don’t refresh while the daemon runs. For a daemon that runs for hours, use SSO, an assumed role, credential_process, or an instance role. The daemon refreshes these before they expire.

A local MCP server or a plugin gets only PATH, HOME, USER, LOGNAME, SHELL, TERM, LANG, TMPDIR, and the proxy variables of the daemon. It doesn’t get the AWS keys or tokens in the daemon’s environment. Pass each variable that it needs in env.

The program still runs as your user, so it can read each file that you can read, such as ~/.aws/credentials. Run only a server or plugin that you trust.

Stash doesn’t know whether a tool only reads. It calls each tool of an MCP or Gateway source with the input that the agent gives it. Keep tools that change data under the policy of the server or the Gateway, or leave them out of the mount.

Stash doesn’t get or refresh OAuth tokens for a remote MCP server. Give it a bearer token in a file, and refresh the file with your own tool. Stash reads the file for each request.

  • Stash writes each file of a source with mode 0444, so an agent can’t edit it. A shell of the same user can still delete it.
  • Stash creates the control root with mode 0700. Its socket answers only your user.
  • Keep the mount point and the data root, ~/.stash by default, away from other local users. Stash runs for one user on single-tenant compute: a laptop, a container, or an AgentCore Runtime session.

On AgentCore Runtime, each session has its own home and mount. See Deploy on AgentCore Runtime.

write.trajectory sends each turn: the words, each tool call, and each tool result. A tool result holds all the text that the tool returned, for example the whole text of a file that the agent read. Write back only to a memory that may hold the files and the command output of the session.

The notes of a mount have no access control of their own. Each agent that can read the mount point reads each note. A copy of a note in a source, through write.notes, gets the access control of that source.

  • No fine-grained access control. Per-user and per-agent access belong to the store, AgentCore Gateway, Identity, and Policy.
  • No shared context between users. Share context through a source, such as AgentCore Memory, and its access control.
  • No governance. Stash shows what its credentials can read. It isn’t a policy layer.
  • No retention of its own. Retention and deletion of records stay with the source. stash delete --remove-data removes only the local copy.