Skip to content

[bug] audience-segments: create_segment accepts empty criteria_hash — segment definition is unresolvable #647

@gboigwe

Description

@gboigwe

Summary

create_segment accepts any criteria_hash: String including an empty string. The criteria_hash field is documented as an IPFS hash of the targeting criteria. An empty hash means the segment has no resolvable definition — any consumer (targeting engine, privacy layer) that fetches the criteria from IPFS will get nothing. The segment can still have members added to it, creating a segment whose membership rules are unknown.

Location

contracts/audience-segments/src/lib.rs, create_segment

pub fn create_segment(env: Env, creator: Address, name: String, description: String,
    criteria_hash: String,  // ❌ empty string accepted
    is_public: bool,
) -> u64 {
    // no validation

Fix

if criteria_hash.len() == 0 {
    panic!("criteria_hash cannot be empty");
}

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working

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