Skip to main content

Security

OnlyFence handles sensitive cryptographic material. Security is a core design principle, not an afterthought.

Security Architecture

PrincipleImplementation
Encryption at restKeys encrypted with user password. Plaintext never touches disk.
No network transmissionPrivate keys and mnemonics are never sent over the network.
Session managementUnlock sessions are time-bounded and held in memory only.
Log filteringDedicated filter prevents secrets from being written to log files.
Local-only storageAll data stored in ~/.onlyfence/ with restricted file permissions.
Fail-closed oracleIf price data is unavailable, trades are rejected — not silently allowed.
Dry-run simulationEvery transaction is simulated before signing.
Full audit trailEvery trade attempt (approved or rejected) is logged.

Container Security

When deployed via Docker, additional hardening is applied:

FeatureDescription
Non-root userRuns as onlyfence user, never root
Read-only filesystemContainer root is immutable
No capabilitiesAll Linux capabilities dropped
No privilege escalationno-new-privileges enforced
Password via fileSecrets on tmpfs — never as env vars
Loopback-only TCPDaemon binds to 127.0.0.1
Process hardeningPR_SET_DUMPABLE=0 on Linux, PT_DENY_ATTACH on macOS

Threat Model

ThreatMitigation
Prompt injection (agent drains wallet)Token allowlist + spending limits
Compromised machine (keystore extracted)Encrypted keystore with password
Oracle manipulation (fake price)Fail-closed oracle with retry and cache TTL
Smart contract exploitDry-run simulation before signing
Unknown token swapToken allowlist enforcement

Reporting Vulnerabilities

Do not open a public GitHub issue for security vulnerabilities.

Report vulnerabilities privately via:

  1. GitHub Security Advisories (preferred): Report a vulnerability
  2. Email: [email protected]

Response Timeline

ActionTimeframe
AcknowledgmentWithin 48 hours
Initial assessmentWithin 5 days
Patch for critical issuesWithin 14 days
Public disclosureAfter fix is released

See SECURITY.md for the full policy.

Best Practices

  • Use a strong, unique password for your keystore
  • Keep OnlyFence up to date (fence update)
  • Set appropriate spending limits
  • Do not share your ~/.onlyfence/ directory
  • Lock your session when not in use: fence lock
  • Review the activity log regularly: fence query activity