Audit I-02: Disclose LeprechaunNFT admin-mutable base URI (offchain metadata) #125
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:open_issues
agents
agent:security_audit
agent:verify
area
timecurve
arena
arena-v2
audit
block:feature_review
block:security
bug
contracts
design
devops
docs
documentation
enhancement
epic
feature
frontend
indexer
low priority
megaeth
operations
ops
performance
QA
qa checklist
referrals
removal
security
smart-contracts
tech-debt
testing
time-arena
timecurve
visual-qa
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
code/yieldomega#125
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Audit reference
audits/audit_smartcontract_1777813071.md— I-02: NFT metadata remains admin-mutableLeprechaunNFTsetBaseURIallows the admin (DEFAULT_ADMIN_ROLE) to change offchain metadata URI roots. OnchaintokenTraitsstorage remains authoritative for stored gameplay traits, but image/metadata JSON fetched viatokenURIcan change if the admin updatesbaseURI, so marketplace and wallet presentation can drift from what holders first saw.Product / security stance (this issue)
Admin mutability of
baseURIis intentional (e.g. hosting moves, CDN changes, corrected offchain JSON while preserving onchain trait tuples). Per the audit, the correct remediation path is not to imply immutability of offchain metadata: we must clearly disclose that administrators can update the metadata root so holders and integrators understand the trust model.Optional future work (out of scope unless product asks for immutability): URI freeze flag, per-series provenance commitment, or immutable token URIs — only if product decides offchain presentation must be frozen.
Recommended fix (disclosure-first)
LeprechaunNFT, document that:baseURI/_baseURIdrivetokenURIprefix for offchain JSON.setBaseURIis admin-only and intentionally mutable; trait gameplay authority stays in onchaintokenTraits, but visual/metadata JSON may change when the URI root changes.DEFAULT_ADMIN_ROLE/ governance expectations (contracts/PARAMETERS.md).tokenURImetadata, add concise copy that offchain metadata is served under an admin-configurable base URI (mirroring docs). UntilCollectionPageleavesUnderConstruction, this can be a doc + contract NatSpec MR with a TODO anchored toCollectionPage/surfaceContent.tscollection blurb.setBaseURI(e.g.BaseURIUpdated(string newBaseURI)or indexed hash) so indexers, block explorers, and integrators can audit URI changes without diffing storage; if added, extend indexer/event docs and regression tests accordingly.Regression tests (recommended)
Solidity (Foundry)
contracts/test/LeprechaunNFT.t.sol: existingtest_setBaseURIproves admin can change URI; add assertions thattokenURIreflects the new prefix for a minted token (if not already covered).setBaseURIemits with expected parameters and that non-admin calls still revert.baseURIbehavior documented and tested if product allows it (OpenZeppelintokenURIconcatenation — confirm valid URLs and EIP-721 expectations).Documentation / process
docs/product/leprechaun-nfts.mdcan answer: “Can the team change how my NFT looks on OpenSea without changing onchain traits?”Frontend (when disclosure copy lands in UI)
CollectionPage(or shared copy module) so it cannot be deleted silently./collection, assert presence of disclosure test id or copy (frontend/e2e— align withdocs/testing/strategy.md).Indexer (only if
BaseURIUpdatedor similar is implemented)Files likely to change (checklist)
contracts/src/LeprechaunNFT.solbaseURI,_baseURI,setBaseURI; optional eventcontracts/test/LeprechaunNFT.t.soltokenURIbehavior + optional emit testscontracts/PARAMETERS.mddocs/product/leprechaun-nfts.mdbaseURIdocs/testing/invariants-and-business-logic.mdcontracts/README.mddocs/README.mddocs/glossary.mddocs/architecture/overview.mdschemas/README.md,docs/schemas/README.mdbaseURIskills/collect-leprechaun-sets/SKILL.mdtokenTraitsfor authority; warntokenURIcan changefrontend/src/pages/CollectionPage.tsx,frontend/src/lib/surfaceContent.tsindexer/src/decoder.rs, migrations,docs/indexer/design.mdaudits/audit_smartcontract_1777813071.mdAcceptance criteria
DEFAULT_ADMIN_ROLEmay callsetBaseURI, changing the prefix used fortokenURI, whiletokenTraitsonchain fields remain the source of truth for encoded gameplay traits.LeprechaunNFTmatches the above;forge doc/ readers see mutability without opening the audit PDF.forge testgreen; Leprechaun tests cover URI update behavior (and emit, if implemented).Verification checklist — implementation MR
LeprechaunNFT.soland confirm NatSpec matches runtime behavior (onlyRole(DEFAULT_ADMIN_ROLE)onsetBaseURI).cd contracts && FOUNDRY_PROFILE=ci forge test --match-contract LeprechaunNFT -vv(or full suite perdocs/testing/strategy.md).docs/product/leprechaun-nfts.mdsubsection is linked fromdocs/README.mdmap if required by doc style.docs/testing/invariants-and-business-logic.mdLeprechaun table; ensure CI doc link check passes if the repo runs one.Verification checklist — post-merge / release
Verification checklist — auditor / reviewer quick pass
contracts/src/LeprechaunNFT.sol—setBaseURIdocumented as intentionally mutable admin control.docs/product/leprechaun-nfts.md— clear onchain vs offchain authority diagram or bullet list./cc Audit I-02 — remediation = disclosure (mutability intentional).
mentioned in commit
166fd6fa3amentioned in commit
3b9c911d4bMerged recovery (GitLab #125 disclosure) onto
main: LeprechaunsetBaseURI/ mutabletokenURIdocumentation,BaseURIUpdatedevent + tests (166fd6f), merged via3b9c911.Contract play doc + PARAMETERS + INV-LEP-125 + Collection UI disclosure aligned;
forge test/ frontend Vitest green at merge.Repo sync: working tree clean,
main=origin/main, no remaining stashes or local branches to merge.mentioned in issue #138