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

Web OTA: check authentication result before accepting payload #1812

Merged
merged 1 commit into from
Jul 13, 2019

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Jul 7, 2019

Using HTTP upgrade method described in the wiki and omitting auth headers:
https://github.com/xoseperez/espurna/wiki/OTA

curl -XPOST  \
  -H "Content-Type: multipart/form-data" \
  -F "filename=@.pioenvs/esp8266-1m-ota/firmware.bin" \
  http://192.168.4.1/upgrade

Causes file handler to process OTA file and write it to flash and only then to go into the request handler, where it will issue auth error.

@mcspr
Copy link
Collaborator Author

mcspr commented Jul 13, 2019

TODO: use AsyncWebHandler::setAuthentication(username, password) instead of doing manual auth?
Per dff81d6, /ws is kept with ticker-based auth. Every other handler return value of _server->on(...)) needs to have setAuthentication.
Loosing log message and an easy ability to refresh the password. Password can be updated via change detection in the reload method and applied to local handlers ref storage. Or, handlers can be accessed by subclassing server class and accessing _handlers attr

@mcspr mcspr merged commit b454cc4 into xoseperez:dev Jul 13, 2019
@mcspr mcspr deleted the ota/upload-auth-check branch July 13, 2019 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant