Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phabricator Update #2

Merged
merged 30 commits into from
Jan 29, 2020
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2adc36b
Correctly identify more SSH private key problems as "formatting" or "…
Nov 9, 2019
e86aae9
Surface edits to "Text" panels on dashboards as remarkup edits
Nov 13, 2019
1996b0c
Update the "owner can always view/edit" policy exception rule
Nov 19, 2019
de66a8e
Remove "stronger/weaker" policy color hints from object headers
Nov 19, 2019
959504a
When predicting object policies for project milestones, adjust object…
Nov 19, 2019
d58eddc
When predicting project membership during edits, predict milestones w…
Nov 19, 2019
df0f5c6
Make repository identity email address association case-insensitive
Nov 14, 2019
a2b2c39
Distinguish between "Assigned" and "Effective" identity PHIDs more cl…
Nov 14, 2019
6afbb61
Remove "PhabricatorEventType::TYPE_DIFFUSION_LOOKUPUSER" event
Nov 14, 2019
0014d04
Consolidate repository identity resolution and detection code
Nov 14, 2019
18da346
Add additional flags to "bin/repository rebuild-identities" to improv…
Nov 14, 2019
d69a736
Use DestructionEngine to destroy UserEmail objects
Nov 14, 2019
89dcf97
Give "PhabricatorUserEmail" a PHID
Nov 14, 2019
a7aca50
Update repository identities after all mutations to users and email a…
Nov 14, 2019
63d84e0
Improve use of keys when iterating over commits in "bin/audit delete"…
Nov 19, 2019
374f8b1
Add a "--dry-run" flag to "bin/repository rebuild-identities"
Nov 19, 2019
2abf292
Fix an issue where editing paths in Owners packages could raise an er…
Nov 21, 2019
eb6df7a
Remove "phlog()" of exeptions during Conduit calls
Nov 22, 2019
1667acf
Implement "PolicyInterface" on "UserEmail" so "EmailQuery" can load t…
Nov 25, 2019
33c534f
Extend Config to full-width
Nov 25, 2019
4cd333b
Use same method to get object URI as used in DifferentialTransactionE…
Dec 9, 2019
54bcbda
Fix an XSS issue with certain high-priority remarkup rules embedded i…
Dec 13, 2019
767528c
Move search query parser/compiler classes to Phabricator
Jan 14, 2020
db6b4ca
Update deprecated array access syntax in Porter stemmer
Jan 14, 2020
138ba87
Guard call to "get_magic_quotes_gpc()" with "@" to silence PHP 7.4+ w…
Jan 14, 2020
f806528
Allow the Herald Rule Editor to apply generic "Edge" transactions
Jan 15, 2020
d0b01a4
Fix two issues with missing whitespace when elements stack on top of …
Jan 15, 2020
6ccb6a6
Update "git rev-parse" invocation to work in Git 2.25.0
Jan 16, 2020
6c45000
Add "Project tags added" and "Project tags removed" fields in Herald
Jan 21, 2020
b38449c
Implement an "Author's packages" Herald field for Differential
Jan 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix an XSS issue with certain high-priority remarkup rules embedded i…
…nside lower-priority link rules

Summary:
See <https://hackerone.com/reports/758002>. The link rules don't test that their parameters are flat text before using them in unsafe contexts.

Since almost all rules are lower-priority than these link rules, this behavior isn't obvious. However, two rules have broadly higher priority (monospaced text, and one variation of link rules has higher priority than the other), and the latter can be used to perform an XSS attack with input in the general form `()[ [[ ... | ... ]] ]` so that the inner link rule is evaluated first, then the outer link rule uses non-flat text in an unsafe way.

Test Plan:
Tested examples in HackerOne report. A simple example of broken (but not unsafe) behavior is:

```
[[ `x` | `y` ]]
```

Differential Revision: https://secure.phabricator.com/D20937
  • Loading branch information
epriestley committed Dec 13, 2019
commit 54bcbdaba94a3573e128c6498816dbfa41d3a9cb
22 changes: 16 additions & 6 deletions src/applications/phriction/markup/PhrictionRemarkupRule.php
Original file line number Diff line number Diff line change
@@ -16,8 +16,23 @@ public function apply($text) {
}

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 @@ public function markupDocumentLink(array $matches) {
}
}

$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, '/').'/';
Original file line number Diff line number Diff line change
@@ -136,6 +136,14 @@ public function markupDocumentLink(array $matches) {
$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);