Skip to content

fix(monitor): DNS monitor hostname and other monitors URL validations#6577

Merged
CommanderStorm merged 8 commits intolouislam:masterfrom
AnuragEkkati:fix/dns-wildcard-validator
Jan 4, 2026
Merged

fix(monitor): DNS monitor hostname and other monitors URL validations#6577
CommanderStorm merged 8 commits intolouislam:masterfrom
AnuragEkkati:fix/dns-wildcard-validator

Conversation

@AnuragEkkati
Copy link
Copy Markdown
Contributor

@AnuragEkkati AnuragEkkati commented Jan 3, 2026

📝 Summary of changes done and why they are done

  • DNS monitor hostname input will accept wildcard and rejects IP (Valid : *.testdns.co, Invalid : 8.8.8.8)
  • http, keyword, json-query, websocket, real-browser monitors will not accept wildcard hostnames in URL (Invalid : https://*.testdns.co/status)
  1. Used validator library methods to validate hostname and URL for the monitors form validating FQDN and IP (v4 and v6) fields.

  2. Cosmetic changes in the doc-string for hostNameRegexPattern in util-frontend.js

Testing

  1. Deployed uptime-kuma locally and tested the changes

Valid :

DNS
  • testdns.co
  • sub.testdns.co
HTTP/WSS

Invalid :

DNS
  • 8.8.8.8
HTTP/WSS
  • https://*.testdns.co
  • wss://*.testdns.co

📋 Related issues

Dependencies

validator : 13.15.26

AI Usage

I have relied on AI to review my code and let me know if there is any case I missed to cover. I used for a comprehensive list of hostnames and URL patterns to test if the changes work as expected.
LLM : Claude sonnet-4.5
IDE: Cursor AI

📄 Checklist

Please follow this checklist to avoid unnecessary back and forth (click to expand)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • [X ] 🔍 My code adheres to the style guidelines of this project.
  • 🦿 I have indicated where (if any) I used an LLM for the contributions
  • ✅ I ran ESLint and other code linters for modified files.
  • ⚠️ My changes generate no new warnings.
  • 🛠️ I have reviewed and tested my code.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 My code needed automated testing. I have added them (this is an optional task).
  • 📄 Documentation updates are included (if applicable).
  • 🔒 I have considered potential security impacts and mitigated risks.
  • 🧰 Dependency updates are listed and explained.

📷 Screenshots or Visual Changes

Monitor Before After
DNS Before After
DNS Before After
HTTP Before After
WSS Before After

Fixes Issue louislam#6444

Summary:
* DNS monitor hostname input will accept wildcard and rejects IP (Valid : *.testdns.co, Invalid : 8.8.8.8)
* http, keyword, json-query, websocket, real-browser monitors will not accept wildcard hostnames in URL (Invalid : https://*.testdns.co/status)
Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

Nice work, I have a few comments below, but nothing hard to implement.

type="text"
class="form-control"
:pattern="`${monitor.type === 'mqtt' ? mqttIpOrHostnameRegexPattern : ipOrHostnameRegexPattern}`"
:pattern="monitor.type === 'mqtt' ? mqttIpOrHostnameRegexPattern : (monitor.type === 'dns' ? null : ipOrHostnameRegexPattern)"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do we still need ipOrHostnameRegexPattern?
I think `validator does the same thing below aready, right?

Copy link
Copy Markdown
Contributor Author

@AnuragEkkati AnuragEkkati Jan 4, 2026

Choose a reason for hiding this comment

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

Yes. I will remove this regex patten and the function hostNameRegexPattern(mqtt) completely. I will move the validations to isInputValid() method.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice

@CommanderStorm CommanderStorm added the pr:please address review comments this PR needs a bit more work to be mergable label Jan 3, 2026
@CommanderStorm CommanderStorm marked this pull request as draft January 3, 2026 15:54
AnuragEkkati and others added 2 commits January 3, 2026 14:27
Co-authored-by: Frank Elsinga <frank@elsinga.de>
Co-authored-by: Frank Elsinga <frank@elsinga.de>
Copy link
Copy Markdown
Contributor Author

@AnuragEkkati AnuragEkkati left a comment

Choose a reason for hiding this comment

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

Provided comments for the review on how I am going to proceed with addressing them.

@AnuragEkkati AnuragEkkati marked this pull request as ready for review January 4, 2026 15:44
Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

Thanks, nice work on the cleanup 🎉

@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Jan 4, 2026
@AnuragEkkati
Copy link
Copy Markdown
Contributor Author

Thanks, nice work on the cleanup 🎉

Thanks for the opportunity.

@AnuragEkkati
Copy link
Copy Markdown
Contributor Author

I re-ran the e2e-tests and all of them passed. I am not able to find option to rerun the tests here. Please help.
Screenshot 2026-01-04 at 9 44 35 AM

@CommanderStorm
Copy link
Copy Markdown
Collaborator

not a test introduced in your PR, apparently a bit flaky.

@CommanderStorm CommanderStorm merged commit 9ce78dc into louislam:master Jan 4, 2026
35 of 36 checks passed
@CommanderStorm CommanderStorm removed the pr:please address review comments this PR needs a bit more work to be mergable label Jan 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DNS support Wildcard format in field

2 participants