Skip to content

Encode dynamic route parameters in service paths #20

Description

@Lakes41

Summary

Safely encode dynamic URL path segments before they are interpolated into service endpoint paths.

Current Behaviour

Service methods build paths with string interpolation, such as /guilds/${guildId}/roles and /guilds/${guildId}/members/${walletAddress}/roles. If a dynamic value contains reserved URL characters, the request path can become malformed.

Expected Behaviour

Dynamic path values should be encoded with encodeURIComponent before being inserted into endpoint paths.

Suggested Implementation

Add a small internal helper for path segment encoding, then use it for guildId, walletAddress, and any other dynamic path segment. Keep query parameter handling separate.

Files or Areas Likely Affected

  • src/roles/roles.service.ts
  • src/guilds/guilds.service.ts
  • src/utils/
  • tests/services.test.ts

Acceptance Criteria

  • guildId values used in path segments are URL-encoded
  • walletAddress values used in path segments are URL-encoded
  • Existing endpoints still produce the same path for simple IDs
  • Tests cover at least one ID containing a reserved character such as /, #, or space

Additional Notes

This should not loosen validation. Inputs should still be validated before path construction.

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignbugSomething isn't working

Type

No type

Fields

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