test(nostr): unit test Blossom.buildServerListTags#614
Open
NicolaLS wants to merge 4 commits into
Open
Conversation
Contributor
Author
|
I guess pointing out the validation problem in this PR is not optimal but I noticed it when implementing these unit tests as I decided not to add url validation to the builder method because that would be unnecessary overhead, its quite far away from the UI/wire and should not own validation which is why I checked whether the components that do own it do it properly. |
Covers the builder's current contract: it rejects an empty server listand maps already-validated server URLs into BUD-03 server tags. Invalid URL strings are **intentionally** not tested here because URL validation is owned by the repository/viewmodel boundary before values reach this helper.
7ddc4d5 to
f9cd22b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
noticed a quality issue here:
wisp/app/src/main/kotlin/com/wisp/app/viewmodel/BlossomServersViewModel.kt
Lines 47 to 64 in 56c26c2
this function allows lots of bad stuff eg.
example com->https://example comHTTPS://example.com->https://HTTPS://example.comftp://example.com->https://ftp://example.comAlso allows fragments (
#) and query parameters (?) in url that can be an issue when appending/mediain the repository. It should be defined whether we allow something likehttps://example.com?query=a#fragmentand then append/medialike thishttps://example.com/media?query=a#fragmentor just don't allow it.Correct validation logic should be used for user input as well as when parsing kind 10063 events.