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

Avoiding issue when unable to add domain #885

Closed
wants to merge 3 commits into from

Conversation

NickyM
Copy link
Contributor

@NickyM NickyM commented Feb 22, 2024

We were experiencing HTTP 500 when trying to add the following domains:

  • solemaids.nl
  • solemaids.com.au

The getDomainExpirationDate function returned NULL. The mySQL column isnt nullable.
Returning mySQL min date instead.

Changed default getDomainExpirationDate value from NULL to MySQL min date to avoid errors when the system in certain situations is unable to lookup the domain expiration date.
Changed more NULL returns to "1000-01-01" i getDomainExpirationDate function.
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello & Welcome! :)

Thanks for taking the time to help improve ITFlow. We're excited to review your contributions - we'll review this PR as soon as we can!

Whilst you're waiting, please feel free to check out the forum.

Just so you know, all contributions to ITFlow are licensed under the GNU GPL. By contributing you grant us a perpetual & irrevocable license to include your work in ITFlow.

Copy link
Contributor

@o-psi o-psi left a comment

Choose a reason for hiding this comment

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

Other than the date, this looks great. Should help with the forum posts as well.

functions.php Outdated
@@ -373,10 +373,11 @@ function encryptLoginEntry($login_password_cleartext)
// Get domain expiration date
function getDomainExpirationDate($name)
{

$nullValue = "1000-01-01";
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be 1 January 1970 00:00:00, the start of the current epoch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just took mySQL min date, but thats an easy change.

Preferable it should be nullable, but I have no clue of any potential issues in the codebase if the value is null. Just changed that few lines as it was stopping me from moving our docs :D

Copy link
Contributor

Choose a reason for hiding this comment

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

I do not know the domain portion of this tool enough to say exactly. I think utc 0 is fine for now.

Changed defualt getDomainExpirationDate value from 1000-01-01 to 1970-01-01.
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@johnnyq
Copy link
Collaborator

johnnyq commented Feb 22, 2024

Hey @NickyM Thank you for the pull request however this should remain NULL as this will throw off our expire checks that we have throughout the code and will produce some unintended results. Basically the expire date should be NULL if no date is given.

@NickyM
Copy link
Contributor Author

NickyM commented Feb 22, 2024

@johnnyq - if it's NULL the server throws a HTTP 500 because the mySQL table isn't nullable.

@wrongecho
Copy link
Collaborator

Hey @NickyM!

Thanks for the PR :)

Some background: The format for domain whois data varies on each TLD. We use http://lookup.itflow.org:8080/ for domain expiration date parsing. This hosts a Python service, but doesn't seem to cover all TLDs currently.

If we add these to #869 we can look into fixing the upstream library at some point. I raised a PR recently as part of this post.

--

It looks like we need some better error handling to be honest. It shouldn't give you an error 500, it should just not parse the expiration date and fail gracefully. I'm not sure when this was changed to be "NULL" but given that it's a SQL DATE field that change probably wasn't the best either.

Personally, I'm not opposed to allowing NULL values for this field and properly storing the NULL as you've proposed. It's better than refusing to allow the domain altogether. Yes, it might break expiration alerts but that's easy enough to fix as well.

@wrongecho
Copy link
Collaborator

wrongecho commented Feb 22, 2024

Looking into this further, just running a command-line whois against .be, .nl and .com.au domains, I can't even see a expiry date in the whois data that is returned? Doesn't seem these not publicly shown for these TLDs, so will not look into any further at this time.

--

I've raised a separate PR to properly account for null values. Very similar to your PR @NickyM, but has some improved logic and should cover the cron bits off too.

If you get a moment, please play around on the PR Review page and see if you can break it?

@wrongecho
Copy link
Collaborator

PR #888 has now fixed this. Big thanks to @NickyM for raising this and collaborating towards a fix :)

@wrongecho wrongecho closed this Feb 23, 2024
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.

4 participants