Skip to content

Certificate prefix search treats LIKE metacharacters as wildcards #319

Description

@euxaristia

Db::list_ref_certificates_by_prefix (used by the CLI for short-ID resolution) builds its match pattern by concatenating the caller's prefix with % and passing it to a LIKE clause.

Because the prefix itself is not escaped, any %, _, or \ characters it contains are interpreted as LIKE wildcards instead of literal characters. A prefix containing those characters can therefore match certificates outside the requested prefix, which makes short-ID resolution return over-broad or incorrect result sets.

Expected: prefix matching treats the prefix literally, so abc% only matches IDs that literally start with abc%.

Fix: escape %, _, and \ in the prefix and add an explicit ESCAPE '\' clause to the query.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugDefect fix — wrong or unsafe behaviorsev:mediumDegraded but workaround existssubsystem:identityDID/UCAN, http-sig auth, push authorizationsubsystem:storageBlob/object store, Arweave, IPFS, archives

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions