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

Add option to CLI to check validity of profile files (without having to run a test) #417

Open
andreasschulze opened this issue Dec 18, 2024 · 2 comments
Labels
T-Feature Type: New feature in software or test case description
Milestone

Comments

@andreasschulze
Copy link

I'm building zonemaster and distribute some customized profile files.

For some reasons, these files got broken. This was detected very late in production.
So I would test at build time, if a given file is a valid profile. Something like --profile /path/to/file --test-profile would be helpful.

Or are there other options available today?

@matsduf matsduf added the T-Feature Type: New feature in software or test case description label Dec 18, 2024
@matsduf
Copy link
Contributor

matsduf commented Dec 18, 2024

@andreasschulze, it is a valid point. Today we do not have any direct validation tool, but the other day I created a customized profile, and made some error. When I tried to use it with zonemaster-cli with option --profile /path/to/profile-file it "crashed" and output a fairly helpful error message.

Maybe trying it with zonemaster-cli could be a work-around, or even a way to test. If you test some non-existing TLD such as xa or a domain with option --test basic01 it will be fairly quick. Maybe you can script this and read the exit code from zonemaster-cli.

If you have kept the faulty profile file, then please test it and report back if zonemaster-cli could catch the error.

@matsduf matsduf added T-Question Type: Incoming question T-Feature Type: New feature in software or test case description and removed T-Feature Type: New feature in software or test case description labels Dec 18, 2024
@andreasschulze
Copy link
Author

Thanks for the hint.

The following produce a determenistic result whether a profile is valid or not:

$ zonemaster-cli --no-progress --dump-profile > /default.profile
$ zonemaster-cli --no-progress --profile /default.profile --test basic01 xa.; echo $?
Loading profile from /default.profile.

Seconds Level    Message
======= ======== =======
   7.00 ERROR    "xa" does not exist as a DNS zone. Try to test "." instead.
0

with an 'invalid' profile:

# zonemaster-cli --no-progress --profile /etc/issue --test basic01 xa.; echo $?
Loading profile from /etc/issue.
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "Debian GNU/Linux 12 ...") at /usr/local/share/perl/5.36.0/Zonemaster/Engine/Profile.pm line 400.
1

This looks like a valid detection for broken profile files. For now, I'm fine with that.

@matsduf matsduf changed the title Feature: option to check validity of profile files Add option to CLI to check validity of profile files (without having to run a test) Dec 19, 2024
@matsduf matsduf removed the T-Question Type: Incoming question label Dec 19, 2024
@matsduf matsduf added this to the v2025.2 milestone Dec 19, 2024
@matsduf matsduf transferred this issue from zonemaster/zonemaster Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Feature Type: New feature in software or test case description
Projects
None yet
Development

No branches or pull requests

2 participants