Skip to content

gateway/blocks-backend: GetBlock should not perform IPLD decoding #673

@aschmahmann

Description

@aschmahmann

The gateway BlocksBackend's GetBlock function under the hood uses the dagservice's Get function which means it attempts to do an IPLD decoding of the block. This is not good because it means the gateway needs to understand the blocks codec in order to return it even when it doesn't really need to.

func (bb *BlocksBackend) GetBlock(ctx context.Context, path path.ImmutablePath) (ContentPathMetadata, files.File, error) {

nd, err := bb.dagService.Get(ctx, lastRoot)

As an example: rainbow does not support dag-jose and so sending a format=raw request to a rainbow gateway will fail even though it could pass.

A fix here is to use the blockservice directly instead of the dagservice for the GetBlock function's retrieval purposes after doing any path traversals required to get to the final block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: Good to have, but can wait until someone steps upkind/bugA bug in existing code (including security flaws)need/analysisNeeds further analysis before proceedingneed/maintainers-inputNeeds input from the current maintainer(s)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions