Skip to content

Agent-scoped token can override authorship to another local custodial agent #1284

Description

@zsculac

This was generated by AI during triage.

Summary

Agent-scoped API tokens may be able to request finalization/publishing as another local custodial agent by supplying a different authorAgentAddress in the request body.

Why This Matters

This is not a Solidity token-drain issue. It is a daemon/API authorization boundary issue.

Example:

Daemon has local custodial agents:
- Alice
- Bob

Caller authenticates with Alice's agent-scoped token.
Request body says authorAgentAddress = Bob.

If body author wins, daemon signs/finalizes as Bob.

That breaks identity attribution and can let one agent token act as another local custodial agent.

Code References

  • packages/cli/src/daemon/routes/knowledge-assets.ts
    • resolveFinalizeOptions uses explicit authorAgentAddress if present, otherwise falls back to token-derived agent address.
  • packages/cli/src/daemon/routes/memory.ts
    • shared-memory publish path has similar body/token authorship resolution logic.
  • packages/agent/src/dkg-agent-publish.ts
    • assertionFinalize can use a local custodial agent private key for authorAgentAddress.

Expected Behavior

If a request is authenticated with an agent-scoped token, finalization should either:

  • force authorship to that token's agent, or
  • reject any explicit authorAgentAddress that differs from the token's agent.

Actual Behavior

The route appears to allow explicit body authorAgentAddress to override token-derived identity before passing options to agent finalization.

Validation Needed

  • Add route-level tests:
    1. Register two local custodial agents.
    2. Authenticate with agent A token.
    3. Submit finalize/publish request with authorAgentAddress = B.
    4. Verify the request is rejected.

Suggested Fix Direction

In all agent-scoped token routes, if tokenAgentAddress != null, require:

authorAgentAddress absent OR authorAgentAddress == tokenAgentAddress

Apply consistently across KA create/finalize and shared-memory publish paths.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-verifyLikely fixed/stale or environment-specific — needs one targeted re-test before closingpre-mainnetMust land before mainnet launchpriority:highMust-fix: protocol correctness, security, economics, or headline flow broken

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions