rwf2 / Rocket

A web framework for Rust.

Home Page:https://rocket.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Possible Incompleteness

YichiZhang0613 opened this issue · comments

What kind of documentation problem are you reporting?

Technical Problem

Where is the issue found?

https://github.com/rwf2/Rocket/blob/master/core/lib/src/config/secret_key.rs

What's wrong?

I think the code should check master >= 64 bytes and material >= 32 bytes as comments mentioned.

    /// # Panics
    ///
    /// Panics if `master` < 64 bytes.
    pub fn from(master: &[u8]) -> SecretKey {
        SecretKey { key: Key::from(master), provided: true }
    }

    /// # Panics
    ///
    /// Panics if `material` < 32 bytes.
    pub fn derive_from(material: &[u8]) -> SecretKey {
        SecretKey { key: Key::derive_from(material), provided: true }
    }

System Checks

  • I confirmed that the issue still exists on master on GitHub.
  • I was unable to find a previous report of this problem.

I'm not sure what you're referring to as "incompleteness". This is the method's contract, and it's this way because we expect the caller to ensure that their input fulfills the contract.