hexpm / hexpm/hex_core

Ensure API params have binary keys

Open
#71 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Erlang
Stars
105
Forks
34
Avg merge
1d 4h
Merged PRs (30d)
6

Description

In some cases we manually use binary keys:

https://github.com/hexpm/hex_core/blob/v0.6.1/src/hex_api_key.erl#L20:

Params = #{<<"name">> => Name, <<"permissions">> => Permissions},

but in some we allow user to pass the map:

https://github.com/hexpm/hex_core/blob/v0.6.1/src/hex_api_release.erl#L45

hex_api:post(Config, Path, Params).

And so the user may pass atom keys like we used to do here:

https://github.com/wojtekmach/mini_repo/commit/f6c8f397c05644f183dedcf99cdbda097cf1dd8f#diff-5008c7016636a9b7531bd02fa4abb5ffL52

We should ensure the params are always a map of binary keys.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the parameter construction in src/hex_api_key.erl and the user-supplied map passed through src/hex_api_release.erl to hex_api:post/3. Trace the request path to identify where key normalization belongs; done means every API parameter map sent through these paths uses binary keys, including maps supplied by users.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
api, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.