Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Convert slices to arrays instead of copy where possible #595

Merged
merged 4 commits into from
Jul 9, 2024

Commits on Jul 9, 2024

  1. object/id: Test decoding failures for invalid ID length

    Signed-off-by: Leonard Lyubich <[email protected]>
    cthulhu-rider committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    0e8b51c View commit details
    Browse the repository at this point in the history
  2. object/id: Fix silent swallowing of incorrect length on unmarshalling

    Previously, `Unmarshal`/`UnmarshalJSON` methods accepted any ID length:
     - those that were shorter were padded with zeros;
     - those that were longer were cut off.
    
    This behavior is not declared in the protocol, thus it was incorrect and
    could cover potential client/transport bugs. Now the length is strictly
    checked. In particular, corresponding unit test now passes.
    
    Signed-off-by: Leonard Lyubich <[email protected]>
    cthulhu-rider committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    bb7b006 View commit details
    Browse the repository at this point in the history
  3. eacl: Provide API converter checking container ID length

    `NewTableFromV2` function does not check the length accepts any
    container ID length:
    - those that were shorter were padded with zeros;
    - those that were longer were cut off.
    
    This behavior is incorrect because it goes against the NeoFS API
    protocol. However, it is not possible to fix the function backwards
    compatible since it does not return an error.
    
    Thus, a new `ReadFromV2` method is added (it is already widely used in
    the library). The method checks container ID format and returns an error.
    Consequently, now the eACL format is also correctly checked when
    decoding a bearer token and `ContainerService.GetExtendedACLResponse`
    protocol message by the API client.
    
    `NewTableFromV2` is marked buggy and deprecated, it's going to be purged
    for release later.
    
    Signed-off-by: Leonard Lyubich <[email protected]>
    cthulhu-rider committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    2cca6c7 View commit details
    Browse the repository at this point in the history
  4. *: Convert slices to arrays instead of copy where possible

    Became possible with Go 1.20.
    
    Signed-off-by: Leonard Lyubich <[email protected]>
    cthulhu-rider committed Jul 9, 2024
    Configuration menu
    Copy the full SHA
    d5a5fbc View commit details
    Browse the repository at this point in the history