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

fix(gateway): panic on path without enough components #272

Merged
merged 1 commit into from
Apr 6, 2023
Merged

Conversation

hacdias
Copy link
Member

@hacdias hacdias commented Apr 6, 2023

Closes ipfs-inactive/bifrost-gateway#77. During the refactors we changed the way we resolved paths and introduced getPathRoots. I could have added this fix there. However, I decided to check for its validity earlier up.

{"127.0.0.1:8080", "/" + k.Cid().String(), http.StatusNotFound, "404 page not found\n"},
{"127.0.0.1:8080", "/ipfs/this-is-not-a-cid", http.StatusBadRequest, "failed to resolve /ipfs/this-is-not-a-cid: invalid path \"/ipfs/this-is-not-a-cid\": invalid CID: invalid cid: illegal base32 data at input byte 3\n"},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ This changes slightly because the path is validated earlier than before.

@codecov
Copy link

codecov bot commented Apr 6, 2023

Codecov Report

Merging #272 (50abf73) into main (322c51e) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #272      +/-   ##
==========================================
+ Coverage   47.98%   48.01%   +0.03%     
==========================================
  Files         270      270              
  Lines       33030    33034       +4     
==========================================
+ Hits        15850    15862      +12     
+ Misses      15504    15499       -5     
+ Partials     1676     1673       -3     
Impacted Files Coverage Δ
gateway/handler.go 56.40% <100.00%> (+0.35%) ⬆️

... and 12 files with indirect coverage changes

@hacdias hacdias marked this pull request as ready for review April 6, 2023 11:03
@hacdias hacdias requested a review from lidel as a code owner April 6, 2023 11:03
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@lidel lidel merged commit 999d939 into main Apr 6, 2023
@lidel lidel deleted the fix/gw-panic branch April 6, 2023 13:23
lidel added a commit to ipfs-inactive/bifrost-gateway that referenced this pull request Apr 6, 2023
lidel added a commit to ipfs-inactive/bifrost-gateway that referenced this pull request Apr 6, 2023
@lidel lidel mentioned this pull request Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

panic on staging: runtime error: slice bounds out of range [:-1]
2 participants