Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,9 +735,22 @@ func (options *Options) ValidateOptions() error {
return errors.Wrapf(err, "Couldn't process resolver file \"%s\"", resolver)
}
for line := range chFile {
resolvers = append(resolvers, line)
line = strings.TrimSpace(line)
Copy link
Member

Choose a reason for hiding this comment

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

The issue seems unrelated to the file parsing, but rather to the file not existing on the file system (I guess maybe a typo from the user), as in fact it gets appended to the slice directly (previous line 741). The resolver file format (one resolver per line) is common to all tools, if we want to support comma separated resolvers on the same line within file, maybe we should move this to utils. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes sense. I'll open an issue in utils to track this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, just asked user to check the path and it seem this isn't a path issue #2350 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

looks like the issue persists even with this change. For some reason the path lead to a non-existing file check. Maybe we can try to enforce additional checks on the resolver arguments (ex. presence of \ or /) which are prohibited as qualified domain name, and warning out the user and using default resolvers in case or erroring out since a resolver file was requested (ex. curl has hard fail when -dns-server is used and fails, without automatic fallbacks, but maybe we should be more fault tolerant and ease automation). What do you think?

if line != "" && strings.Contains(line, ",") {
for item := range strings.SplitSeq(line, ",") {
item = strings.TrimSpace(item)
if item != "" {
resolvers = append(resolvers, item)
}
}
} else if line != "" {
resolvers = append(resolvers, line)
}
}
} else {
if strings.ContainsAny(resolver, `/\`) {
gologger.Warning().Msgf("Resolver argument \"%s\" looks like a file path but the file does not exist", resolver)
}
resolvers = append(resolvers, resolver)
}
}
Expand Down
Loading