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

saveStatusPage socket handler does not use icon specified in payload if not base64-encoded #4749

Closed
1 task done
jmolnar-comparative opened this issue May 8, 2024 · 4 comments · Fixed by #4750
Closed
1 task done
Labels
area:api concearning the api or automation area:status-page Everything related to the status page bug Something isn't working

Comments

@jmolnar-comparative
Copy link
Contributor

📑 I have found these related issues/pull requests

I did not find any related issues

🛡️ Security Policy

Description

if (imgDataUrl.startsWith("data:")) {
if (! imgDataUrl.startsWith(header)) {
throw new Error("Only allowed PNG logo.");
}
const filename = `logo${statusPage.id}.png`;
// Convert to file
await ImageDataURI.outputFile(imgDataUrl, Database.uploadDir + filename);
config.logo = `/upload/${filename}?t=` + Date.now();
} else {
config.icon = imgDataUrl;
}
statusPage.slug = config.slug;
statusPage.title = config.title;
statusPage.description = config.description;
statusPage.icon = config.logo;

config.icon is never again referenced, only config.logo

👟 Reproduction steps

write to the status page socket handler with a payload like:

{
    "icon": "/path/to/an/icon.svg"
}

or similar.

👀 Expected behavior

Status page should use provided icon.

😓 Actual Behavior

Status page keeps using whatever icon it is already using

🐻 Uptime-Kuma Version

1.23.13

💻 Operating System and Arch

Debian bookworm aarch64

🌐 Browser

Google Chrome 124.0.6367.119

🖥️ Deployment Environment

  • Runtime: Docker 20.10.21 / nodejs 20
  • Database: sqlite/embedded
  • Filesystem used to store the database on: Debian/ext4 SSD
  • number of monitors: 1

📝 Relevant log output

No response

@jmolnar-comparative jmolnar-comparative added the bug Something isn't working label May 8, 2024
@CommanderStorm
Copy link
Collaborator

Yes that is a bug.
Thanks for digging into the code. Would you like to provide a PR => be attributed with this fix?
I am wondering: How did you come across this?

@CommanderStorm CommanderStorm added area:status-page Everything related to the status page area:api concearning the api or automation labels May 8, 2024
@jmolnar-comparative
Copy link
Contributor Author

I have a PR almost ready, I'm just currently confirming on my patched local that it's possible to use the URL variant at all.

Assuming I can work out some CORS issues, then I'm expecting I can provide a simple one-liner.

As to how I came across it: I am automating a from-scratch status page setup, so the UI-driven upload flow is a no-go for me. I also don't really like the base64 upload because then I have to pull the current image and check if the contents match since I want to report whether I am changing the icon. I'd rather use either a cross-origin URL or a path relative to the data volume (I'm using the docker deployment variant).

@jmolnar-comparative
Copy link
Contributor Author

I don't care about the attribution though; this is not my personal account

@jmolnar-comparative
Copy link
Contributor Author

Confirmed that things work fine if I do this simple fix: #4750

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api concearning the api or automation area:status-page Everything related to the status page bug Something isn't working
Projects
None yet
2 participants