Markdown OKF-Schema Studio

Behaviour SwRS-MDOKFSTUDIO-TOOLBAR-090

A link is an anchor, external, local or blocked

When a link request is followed or looked up, the extension SHALL classify it before any file access as an anchor, an external link or a relative or wiki path, and block it with a reason when it is an invalid anchor, a query-only target, an undecodable path, a scheme other than http, https or mailto, or an absolute path. The scheme is read on the raw link, and the host re-checks the parsed URI before opening it.

Another outcome at step 3 of path 1 in StRS-MDOKFSTUDIO-TOOLBAR-011, in the state “The tooltip names where the link leads”.

Scenarios 3

The situations the tests check; open one to read it.

nominalAccepted requests
RequestClass
#section-2anchor with that value (a # followed by at least one character and no space, # or ?)
https://example.test/docsexternal
MAILTO:a@b.cexternal (http, https and mailto in any letter case)
../docs/target.mdrelative, not blocked at this step
tmp/secret.mdrelative
other.md?view=1relative, keeps its query
refusalBlocked requests
RequestOutcome
#, #not a valid anchor, #a#bblocked with The preview anchor is invalid.
javascript:alert(1), file:///tmp/secretblocked with The navigation scheme is not allowed in the preview.
wiki:https://example.testblocked, because a wiki link is never external
https%3A/../../System/Applications/Calculator.app, mailto%3Aa@b.cblocked with The navigation scheme is not allowed in the preview. (the scheme is read on the raw link; a percent sign before the first colon is never external)
/tmp/secret, //example.testblocked with Absolute navigation targets are not allowed.
?x=1blocked with Query-only navigation targets are not valid file links.
%5Csecret, %00.md (backslash or NUL after decoding)blocked with The navigation target could not be decoded safely.
a%zz.md (malformed escape)blocked with The navigation target could not be decoded safely.

A blocked request causes no file access.

boundaryDecoding once
RequestOutcome
docs%20file.mdrelative with the path docs file.md
docs%2520file.mdrelative with the path docs%20file.md (the escaped percent is a literal percent in the file name, it is not decoded again)
100%25.mdrelative with the path 100%.md
a%2541.mdrelative with the path a%41.md
%255Csecretrelative with the path %5Csecret (only a backslash decoded from the link itself is refused)

Implemented in 3

Tested by 4