ChainSafe / ChainSafe/open-creator-rails
Feature: Gate subscription view/status access to subscriber or asset owner
- Dominant language
- Solidity
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
**What**
Add access-gated methods for:
- viewing subscription details
- checking whether a subscription is active/expired
Access should be limited to:
- the subscriber tied to the subscription
- the asset owner (who can fetch any subscriber's subscription)
Use subscriber identity hashing as:
`subscriberHash = hash(subscriberId, subscriberAddress)`
Methods should accept unhashed `subscriberId` string IDs, then derive lookup keys by hashing `subscriberId` together with `msg.sender`.
**Why**
Subscription state can contain sensitive or user-specific information and should not be globally queryable by arbitrary callers. Restricting read/status access to the subscriber or asset owner improves privacy and authorization guarantees while preserving necessary operator visibility.
**How**
- Add/modify subscription read + status methods to enforce caller-based authorization.
- Accept `subscriberId` as input and derive `subscriberHash` from `hash(subscriberId, msg.sender)` for non-owner callers.
- Allow asset owner to query any subscriber subscription (owner bypass for cross-subscriber reads).
- Ensure active/expired checks use the same gated lookup semantics.
- Add clear revert behavior for unauthorized access and missing subscription states.
- Add/adjust tests for:
- subscriber can fetch own subscription via ID
- non-subscriber/non-owner is rejected
- asset owner can fetch any subscriber subscription
- active/expired checks follow same authorization and lookup rules
**Acceptance Criteria**
- Subscription view and active/expired status methods are access-gated.
- Subscriber lookup uses `subscriberId` + `msg.sender` hashing for caller-scoped access.
- Asset owner can query any subscriber's subscription successfully.
- Unauthorized callers cannot read or status-check unrelated subscriptions.
- Tests validate authorization, hashing-based lookup behavior, and edge cases.
**Estimation**
**Dependencies**
None currently identified.
Contributor guide
Research direction
Start by locating the subscription read and active/expired status methods and their existing tests. Trace how subscriberId, subscriberAddress, subscriberHash, msg.sender, and asset ownership are currently handled. Add coverage for subscriber, owner, and unauthorized callers, including missing and expired subscriptions; done means all acceptance criteria and authorization cases pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- authentication, blockchain, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100