Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15380665
D20937.id49889.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D20937.id49889.diff
View Options
diff --git a/src/applications/phriction/markup/PhrictionRemarkupRule.php b/src/applications/phriction/markup/PhrictionRemarkupRule.php
--- a/src/applications/phriction/markup/PhrictionRemarkupRule.php
+++ b/src/applications/phriction/markup/PhrictionRemarkupRule.php
@@ -16,8 +16,23 @@
}
public function markupDocumentLink(array $matches) {
+ $name = trim(idx($matches, 2, ''));
+ if (empty($matches[2])) {
+ $name = null;
+ }
+
+ $path = trim($matches[1]);
+
+ if (!$this->isFlatText($name)) {
+ return $matches[0];
+ }
+
+ if (!$this->isFlatText($path)) {
+ return $matches[0];
+ }
+
// If the link contains an anchor, separate that off first.
- $parts = explode('#', trim($matches[1]), 2);
+ $parts = explode('#', $path, 2);
if (count($parts) == 2) {
$link = $parts[0];
$anchor = $parts[1];
@@ -48,11 +63,6 @@
}
}
- $name = trim(idx($matches, 2, ''));
- if (empty($matches[2])) {
- $name = null;
- }
-
// Link is now used for slug detection, so append a slash if one
// is needed.
$link = rtrim($link, '/').'/';
diff --git a/src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php b/src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php
--- a/src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php
+++ b/src/infrastructure/markup/markuprule/PhutilRemarkupDocumentLinkRule.php
@@ -136,6 +136,14 @@
$uri = trim($matches[1]);
$name = trim(idx($matches, 2));
+ if (!$this->isFlatText($uri)) {
+ return $matches[0];
+ }
+
+ if (!$this->isFlatText($name)) {
+ return $matches[0];
+ }
+
// If whatever is being linked to begins with "/" or "#", or has "://",
// or is "mailto:" or "tel:", treat it as a URI instead of a wiki page.
$is_uri = preg_match('@(^/)|(://)|(^#)|(^(?:mailto|tel):)@', $uri);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 15, 4:01 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7570187
Default Alt Text
D20937.id49889.diff (1 KB)
Attached To
Mode
D20937: Fix an XSS issue with certain high-priority remarkup rules embedded inside lower-priority link rules
Attached
Detach File
Event Timeline
Log In to Comment