theupdateframework / theupdateframework/rust-tuf

Current serde/shims don't parse Vec<u8>, only hex/base64/pem strings

Open
#86 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature :: Improvement Priority :: Low
Dominant language
Rust
Stars
198
Forks
39
Avg merge
9h 19m
Merged PRs (30d)
2

Description

This is would prevent us from having a serialization format that uses parses bytes directly (and not bytes-that-are-a-string (I think)). This should work:

struct Foo<Vec<u8>>

impl DeserializeOwned for Foo {
  fn deserialize<D: Deserializer<'de>>(de: D) -> ::std::result::Result<Self, D::Error> {
    let res: Vec<u8> = Deserialize::deserialize(de)
    match res {
      Ok(x) => Foo(x),
      Err(_) => {
        let x: String = Deserialize::deserialize(de)?;
        Foo(HEXLOWER.decode(x.as_bytes())?)
    }
  }
}

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 by locating the current serde shims and their hex, base64, and PEM string parsing. Check how direct Vec deserialization is handled, then add coverage showing the intended byte input and existing string formats still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
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.