8000 validate QX asset name (qxissueasset) · Issue #58 · qubic/qubic-cli · GitHub
[go: up one dir, main page]

Skip to content

validate QX asset name (qxissueasset) #58

Open

Description

@Franziska-Mueller

Current behavior:
When creating a QX asset via qubic-cli (-qxissueasset) with a name with more than 7 characters or in lower case or with an already existing asset name, the QX issuance fee is paid but the asset is not issued.

Desired new behavior:

  • for more than 7 chars or lower case: implement a check in qubic-cli that returns a warning to the user (without trying to issue the asset, hence not paying any fee)
  • existing asset name: explicitly mention in help that it needs to be a new/unique asset name. Because every issuer has their own asset namespace we can assume the user knows which asset names they created before.

Activity

  1. moved this to 🏗 In progress in qubicon Jan 9, 2025
  2. moved this from 🏗 In progress to 📋 Backlog in qubicon Jan 9, 2025
  3. philippwerner commented on Jan 29, 2025

    @philippwerner
    Contributor

    Partially addressed in PR #64

  4. parthod0x commented on Oct 7, 2026

    @parthod0x
    Contributor

    Worth flagging a memory-safety angle on this: the missing asset-name length check
    isn't only a wasted-fee UX problem — a name longer than the buffer currently
    overflows it.

    Across qx.cpp, qswap.cpp and nostromo.cpp there are ~19 copies of the form

    char assetNameS1[8] = {0};
    memcpy(assetNameS1, assetName, strlen(assetName));   // no bound

    (and the assetNameU1[8] / &input.assetName / &v.asset.assetName variants).
    The destination is 8 bytes, but strlen(assetName) is unbounded, so a name
    longer than 8 chars writes past it. Confirmed with AddressSanitizer:
    stack-buffer-overflow, WRITE of size 11 for an 11-char name.

    Notably the safe pattern already exists in the codebase —
    asset_utils.cpp:307 does
    memcpy(&packet.req.byFilter.assetName, value.c_str(), std::min(size_t(7), value.length())).

    So there are two complementary fixes:

    1. The validation this issue asks for — reject a name > 7 chars (or not
      uppercase) up front, with a warning, before any fee is paid.
    2. Independently, bound those ~19 memcpy copies to the field size (as
      asset_utils.cpp already does), so a bad name can never corrupt memory even
      if it slips past validation.

    Opened #137 for (2) — the mechanical bounding of all 19 asset-name copies across qx.cpp, qswap.cpp and nostromo.cpp, routed through a copyAssetNameBounded() helper and ASAN-verified (the old pattern overflows with an 11-char name; the bounded version is clean). The up-front name validation this issue asks for is complementary. (The node-IP and proposal-URL copies were the same class of bug — those are in #134.)

  5. parthod0x commented on Oct 8, 2026

    @parthod0x
    Contributor

    Opened #137 for the memory-safety half (fix (2) from above): all 19 unbounded asset-name copies across qx.cpp, qswap.cpp and nostromo.cpp now route through a small copyAssetNameBounded() helper in asset_utils.h that caps the copy at the field size, mirroring the bounded copy asset_utils.cpp already uses. ASAN-verified: the old pattern overflows (WRITE of size 11 on an 8-byte buffer), the bounded version is clean. The up-front name validation this issue originally asks for is complementary and can go in alongside it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0