Documentation
¶
Overview ¶
Package outside makes text from outside safe to hand to a model: a release's name, a file's, anything fetched from a service anyone can write to.
What cannot be seen is the easiest place to hide an instruction, so Text takes out the characters that do not show or that change how the rest shows, and cuts what is left to a length. It does not judge the words: what is left is still a stranger's, data and not instructions.
Clean what is read, not what is handed back: a path or an id a later call takes must go back as it came, or it no longer finds the thing it names. A server's own words for what went wrong are from outside too and may quote an address with the server's own key on it; BlankAddresses is for those, not for a link a caller is to follow.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlankAddresses ¶ added in v0.6.2
BlankAddresses blanks what each address in text may carry a credential in: who it signs in as, every value after its "?", and what follows its "#". Host, path and parameter names stay. It is for a server's words about what went wrong, which quote the address it called with its key on the end; not for a link a caller is to use. An address inside brackets keeps its closing bracket; any other mark against its end goes with the value. A secret in the path has no rule to find it and is left.
func Text ¶
Text is s with what does not show taken out and cut to limit characters, ending in an ellipsis where cut; 0 or less is no limit. Out go the control characters (a tab or line break becomes a space), the format characters that are zero-width or steer the direction of text, the tag characters and variation selectors a message can hide in, and the fillers that show as nothing. Letters, marks and spaces of every script stay; an emoji loses the selector for its coloured form.
Types ¶
This section is empty.