Skip to content

Prevent creation of IPX function #1605

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

Closed
gualterandre opened this issue Sep 8, 2022 · 4 comments · Fixed by #1653
Closed

Prevent creation of IPX function #1605

gualterandre opened this issue Sep 8, 2022 · 4 comments · Fixed by #1653
Assignees
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality

Comments

@gualterandre
Copy link

Would it be possible to prevent the creation of the ipx function if one does not need it?

Currently, next-runtime is always creating this function but there could be some edge cases where this isn't necessary

image

@ericapisani
Copy link

More asking in order to help us triage this - is the presence of this in the cases where it isn't necessary leading to an undesirable outcome (functionally, monetarily, etc.) for some users?

@h3ku
Copy link

h3ku commented Sep 8, 2022

More asking in order to help us triage this - is the presence of this in the cases where it isn't necessary leading to an undesirable outcome (functionally, monetarily, etc.) for some users?

Having it enabled by default means that if a customer has a domain where anyone can upload files configured in next.config.js (Common behaviour since this usually contain CDN domains, like cloudflare or contentfull), a malicious user could upload a xss svg file to the CDN and then make the following request to the victim site.
http://domain/_ipx/w_32,q_32/https://images.ctfassets.net/id

Which would lead to an xss on domain.com

@ericapisani ericapisani self-assigned this Sep 9, 2022
@ericapisani ericapisani added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Sep 9, 2022
@shaungcheng-asana
Copy link

Hi @h3ku, I see you created a pull request to add an environment variable to disable _ipx: #1609 but the PR is closed and not merged. Do we still have plans to expose a env var perhaps as a workaround, etc?

@h3ku
Copy link

h3ku commented Sep 13, 2022

Hi @h3ku, I see you created a pull request to add an environment variable to disable _ipx: #1609 but the PR is closed and not merged. Do we still have plans to expose a env var perhaps as a workaround, etc?

Hey! Im not a maintainer of the package, I opened the pull request but it was not ideal since it would break some implementations.

In the end I end up using patch-package to disable the registration of the IPX function as a temporary solution while Netlify decides to give users the option to disable the function via an env var.
https://gist.github.com/h3ku/1a82585929fb33553bb29d430cecd771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants