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: Possible Invalid 'X-Ipfs-Roots' Header #221

Closed
2 tasks
hacdias opened this issue Mar 22, 2023 · 0 comments · Fixed by #337
Closed
2 tasks

Gateway: Possible Invalid 'X-Ipfs-Roots' Header #221

hacdias opened this issue Mar 22, 2023 · 0 comments · Fixed by #337
Assignees
Labels
need/triage Needs initial labeling and prioritization topic/gateway Issues related to HTTP Gateway

Comments

@hacdias
Copy link
Member

hacdias commented Mar 22, 2023

Extracted from #176 (comment) to avoid blocking #176.

⚠️ since pathMetadata is based on maybeResolvedImPath, if the path is indeed resolved to the final /ipfs/cid, we will produce an invalid X-Ipfs-Roots header that does not include logical parents from immutableContentPath.

Example:

  • immutableContentPath/ipfs/cid/foo/bar
  • maybeResolvedImPath/ipfs/bar-cid
  • X-Ipfs-Roots
    • expected: cid, foo-cid, bar-cid
    • produced: bar-cid

Idea

Maybe some struct that gets passed around, like:

type requestData struct {
	// Defined for all requests.
	begin             time.Time
	logger            *zap.SugaredLogger
	contentPath       ipath.Path
	contentType       string
	contentTypeParams map[string]string

	// Defined for non IPNS Record requests.
	immutablePath ImmutablePath

	// Defined if resolution has already happened.
	pathMetadata *ContentPathMetadata
	resolvedPath *ImmutablePath
}

func (rq *requestData) maybeResolvedPath() ImmutablePath {
	if rq.resolvedPath != nil {
		return *rq.resolvedPath
	}
	return rq.immutablePath
}

Tasks

@hacdias hacdias added need/triage Needs initial labeling and prioritization topic/gateway Issues related to HTTP Gateway labels Mar 22, 2023
@lidel lidel moved this to 📋 Backlog in bifrost-gateway May 7, 2023
@hacdias hacdias removed this from bifrost-gateway Jun 6, 2023
@hacdias hacdias self-assigned this Jun 6, 2023
@hacdias hacdias moved this to 🥞 Todo in IPFS Shipyard Team Jun 6, 2023
@hacdias hacdias changed the title Possible Invalid 'X-Ipfs-Roots' Header Gateway: Possible Invalid 'X-Ipfs-Roots' Header Jun 6, 2023
@github-project-automation github-project-automation bot moved this from 🥞 Todo to 🎉 Done in IPFS Shipyard Team Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization topic/gateway Issues related to HTTP Gateway
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant