Skip to content

Enhance "uriabsolute" validation #719

@angrycuban13

Description

@angrycuban13

Hello,

I started using PSFramework for a module I am writing, and I noticed an interesting "bug" (if you could call it that) - if you try to set one of your config settings as follows:

Set-PSFConfig -Module MyModule -Name URL -Value 'xy://' -Validation uriabsolute

It will still return $true because the validation scriptblock is only looking at IsAbsoluteUri and I guess the [uri] class in Powershell is quite permissive and uses :// as the separator so anything specified before that is treated as "correct".

I know I could write my own custom validation, but I did want to bring this up to your attention. Some potential fixes I can think of are:

  • Creating a Scheme allowlist of some sort for common URIs such as http, https, ftp, wss, etc.
  • Checking that Host is not empty

Just throwing some ideas out there, thank you for the great module!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions