Skip to content

[Bug]: ownPublicKey() is not cryptographically safe #418

@acedward

Description

@acedward

Prerequisites

What are the steps to reproduce this issue?

In Ownable.compact

  export circuit assertOnlyOwner(): [] {
    Initializable_assertInitialized();
    const caller = ownPublicKey();
    assert(caller == _owner.left, "Ownable: caller is not the owner");
  }

What happens?

ownPublicKey() is a witness call that provides user information.
This value is not constrained to the prover's actual key.
Therefore any value can be passed.

What were you expecting to happen?

Use hash(secret) instead for ownership.

Paste any relevant logs, error output, etc.

Additional context

No response

Code Reproduction URL

No response

Version

0.29.0 (Default)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bugs or reports that are very likely to be bugs.

    Type

    No type

    Projects

    Status

    Complete/Stable Release

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions