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

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

Open
Tracked by #10547 ...
aschmahmann opened this issue Sep 17, 2024 · 1 comment
Open
Tracked by #10547 ...
Labels
kind/bug A bug in existing code (including security flaws) need/analysis Needs further analysis before proceeding need/maintainers-input Needs input from the current maintainer(s) P2 Medium: Good to have, but can wait until someone steps up

Comments

@aschmahmann
Copy link
Contributor

aschmahmann commented Sep 17, 2024

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.

@aschmahmann aschmahmann added the need/triage Needs initial labeling and prioritization label Sep 17, 2024
@lidel lidel changed the title gateway/blocks-backend: gateway/blocks-backend: GetBlock should not perform IPLD decoding Sep 18, 2024
@lidel lidel mentioned this issue Sep 18, 2024
34 tasks
@gammazero gammazero added need/analysis Needs further analysis before proceeding need/maintainers-input Needs input from the current maintainer(s) kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up and removed need/triage Needs initial labeling and prioritization labels Oct 29, 2024
@gammazero
Copy link
Contributor

gammazero commented Nov 5, 2024

Do we still need dagservice to determine if a directory is being read?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) need/analysis Needs further analysis before proceeding need/maintainers-input Needs input from the current maintainer(s) P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

No branches or pull requests

2 participants