Skip to content

Commit ebcb2ae

Browse files
committed
Merge branch 'main' into playwright-1.49
2 parents 537c757 + e0033ca commit ebcb2ae

File tree

148 files changed

+624
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+624
-501
lines changed

.github/workflows/js-hazards.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
name: JS Rooting Hazards
3+
4+
# Controls when the workflow will run
5+
on:
6+
# Triggers the workflow on push or pull request events but only for the main branch
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
16+
jobs:
17+
18+
# This workflow contains a single job called "build"
19+
build:
20+
21+
name: 'JS Rooting Hazard Analysis'
22+
23+
# The type of runner that the job will run on
24+
runs-on: ubuntu-22.04
25+
26+
# Steps represent a sequence of tasks that will be executed as part of the job
27+
steps:
28+
- name: Free Disk Space (Ubuntu)
29+
uses: jlumbroso/free-disk-space@main
30+
with:
31+
tool-cache: true
32+
android: true
33+
dotnet: true
34+
haskell: true
35+
large-packages: true
36+
docker-images: true
37+
swap-storage: true
38+
39+
40+
- name: Install Dependencies
41+
run: |
42+
sudo apt-get update
43+
sudo apt-get install -y \
44+
curl \
45+
python3 \
46+
python3-pip \
47+
python3-venv \
48+
tar \
49+
zip \
50+
unzip \
51+
git
52+
sudo apt-get install -y --no-install-recommends ffmpeg libasound2 libatk1.0-0 libcairo-gobject2 libcairo2 libdbus-1-3 libdbus-glib-1-2 libfontconfig1 libfreetype6 libgdk-pixbuf-2.0-0 libglib2.0-0 libgtk-3-0 libpango-1.0-0 libpangocairo-1.0-0 libx11-6 libx11-xcb1 libxcb-shm0 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxtst6 xvfb fonts-noto-color-emoji fonts-unifont xfonts-cyrillic xfonts-scalable fonts-liberation fonts-ipafont-gothic fonts-wqy-zenhei fonts-tlwg-loma-otf fonts-freefont-ttf
53+
python3 -m pip install setuptools
54+
55+
56+
- name: Checkout release branch
57+
uses: actions/checkout@v4
58+
with:
59+
fetch-depth: 1
60+
61+
- name: Bootstrap
62+
run: |
63+
./mach --no-interactive bootstrap --application-choice=js
64+
65+
- name: Bootstrap Hazard Analysis
66+
run: |
67+
./mach hazards bootstrap
68+
69+
- name: Build Shell
70+
run: |
71+
./mach hazards build-shell
72+
73+
- name: Gather GC Info
74+
run: |
75+
./mach hazards gather --project=js
76+
77+
- name: Analyze JS Hazards
78+
run: |
79+
./mach hazards analyze --project=js
80+
81+
- name: Show Summary
82+
run: |
83+
cat ./haz-js/hazards.txt >> $GITHUB_STEP_SUMMARY
84+
#- name: Upload Report
85+
# uses: actions/upload-artifact@v4 # upload test results
86+
# with:
87+
# name: rooting-hazards
88+
# path: haz-js/hazards.txt

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ This is the repository for project "Foxhound", a Firefox fork capable of trackin
66

77
Taint tracking makes it possible to automatically detect client-side cross-site-scripting flaws in websites by marking certain attacker-controlled strings (e.g. `location.hash`) as tainted and notifying the user when tainted data reaches a set of predefined sinks (e.g. `eval()`, `.innerHTML`, ...).
88

9-
Foxhound has been successfully used for a wide range of academic studies (e.g., the [publications](https://github.com/SAP/project-foxhound/wiki/Publications) listed in the Wiki) as well as for security testing in industrial use cases.
9+
:trophy: Foxhound has been rated the **best tool** for [Dynamic Security Analysis of JavaScript](https://www.dais.unive.it/~calzavara/papers/www25.pdf) by independent researchers! In their study, Foxhound **outperformed 17 other tools** in all of the categories considered, namely *compatibility* (95%), *transparency* (97%), *coverage* (94%) and *performance* (1.4x). To quote the paper:
10+
11+
>
12+
> The only effective solution given the current state of the art is Project Foxhound.
13+
>
14+
15+
In addition, Foxhound has been successfully used for a wide range of academic studies (e.g., the [publications](https://github.com/SAP/project-foxhound/wiki/Publications) listed in the Wiki) as well as for security testing in industrial use cases.
1016

1117
## Usage
1218

@@ -114,8 +120,8 @@ The JavaScript public API (jsapi.h) has been extended to support access to taint
114120
`JS_ReportTaintSink` which takes care of reporting a flow of tainted data into a predefined sink.
115121
In this case a message will be written to stdout and a custom JavaScript Event will be triggered that can then be processed by a Firefox extension.
116122

117-
All code related to taint tracking has been marked with a `// TaintFox` comment, making it easy to search for modifications in the source code.
118-
Finding the `location.hash` taint source becomes as easy as `git grep -n TaintFox | grep location.hash`.
123+
All code related to taint tracking has been marked with a `// Foxhound` comment, making it easy to search for modifications in the source code.
124+
Finding the `location.hash` taint source becomes as easy as `git grep -n Foxhound | grep location.hash`.
119125

120126
Taint information is available in JavaScript via the `.taint` property of string instances:
121127

dom/base/CharacterData.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void CharacterData::GetData(nsAString& aData) const {
143143
}
144144
}
145145

146-
// TaintFox: propagate taint when accessing text data from DOM nodes.
146+
// Foxhound: propagate taint when accessing text data from DOM nodes.
147147
aData.AssignTaint(mText.Taint());
148148

149149
}
@@ -181,7 +181,7 @@ void CharacterData::SubstringData(uint32_t aStart, uint32_t aCount,
181181
CopyASCIItoUTF16(Substring(data, data + amount), aReturn);
182182
}
183183

184-
// TaintFox: propagate taint.
184+
// Foxhound: propagate taint.
185185
aReturn.AssignTaint(mText.Taint().safeSubTaint(aStart, aStart + aCount));
186186
}
187187

dom/base/DOMParser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMParser)
6161
already_AddRefed<Document> DOMParser::ParseFromString(const nsAString& aStr,
6262
SupportedType aType,
6363
ErrorResult& aRv) {
64-
// TaintFox: Copy String so the TaintOperation shows up in the function trace
64+
// Foxhound: Copy String so the TaintOperation shows up in the function trace
6565
nsTDependentSubstring strCopy(aStr, 0);
6666
// TODO(david): Is this sound?
6767
nsTArray<nsString> args;

dom/base/Document.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6589,7 +6589,7 @@ void Document::GetReferrer(nsACString& aReferrer) const {
65896589

65906590
URLDecorationStripper::StripTrackingIdentifiers(referrer, aReferrer);
65916591

6592-
// TaintFox: document.referrer taint source.
6592+
// Foxhound: document.referrer taint source.
65936593
MarkTaintSource(aReferrer, "document.referrer");
65946594
}
65956595

@@ -6635,7 +6635,7 @@ void Document::GetCookie(nsAString& aCookie, ErrorResult& aRv) {
66356635
// because it assumes that the input is valid.
66366636
UTF_8_ENCODING->DecodeWithoutBOMHandling(cookie, aCookie);
66376637

6638-
// TaintFox: document.cookie source.
6638+
// Foxhound: document.cookie source.
66396639
MarkTaintSource(aCookie, "document.cookie");
66406640
}
66416641
}
@@ -6680,7 +6680,7 @@ void Document::SetCookie(const nsAString& aCookie, ErrorResult& aRv) {
66806680
return;
66816681
}
66826682

6683-
// TaintFox: document.cookie sink.
6683+
// Foxhound: document.cookie sink.
66846684
ReportTaintSink(aCookie, "document.cookie");
66856685

66866686
NS_ConvertUTF16toUTF8 cookie(aCookie);
@@ -10194,7 +10194,7 @@ void Document::WriteCommon(const nsAString& aText, bool aNewlineTerminate,
1019410194
}
1019510195
}
1019610196

10197-
// TaintFox: document.write and document.writeln sink.
10197+
// Foxhound: document.write and document.writeln sink.
1019810198
ReportTaintSink(aText, aNewlineTerminate ? "document.writeln" : "document.write");
1019910199

1020010200
static constexpr auto new_line = u"\n"_ns;
@@ -10277,7 +10277,7 @@ nsresult Document::GetDocumentURI(nsString& aDocumentURI) const {
1027710277

1027810278
CopyUTF8toUTF16(uri, aDocumentURI);
1027910279

10280-
// TaintFox: document.documentURI taint source.
10280+
// Foxhound: document.documentURI taint source.
1028110281
MarkTaintSource(aDocumentURI, "document.documentURI");
1028210282
} else {
1028310283
aDocumentURI.Truncate();
@@ -10305,7 +10305,7 @@ void Document::GetDocumentURIFromJS(nsString& aDocumentURI,
1030510305
}
1030610306
CopyUTF8toUTF16(uri, aDocumentURI);
1030710307

10308-
// TaintFox: document.documentURI taint source.
10308+
// Foxhound: document.documentURI taint source.
1030910309
MarkTaintSource(aDocumentURI, "document.documentURI");
1031010310
}
1031110311

dom/base/Element.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ namespace mozilla::dom {
234234

235235
// Note that mozjemalloc uses a 16 byte quantum, so 64, 80 and 128 are
236236
// bucket sizes.
237-
// Taintfox - originally ASSERT_NODE_SIZE(Element, 128, 80);
237+
// Foxhound - originally ASSERT_NODE_SIZE(Element, 128, 80);
238238
// We needed to add additional 8 bytes for taint operations
239239
ASSERT_NODE_SIZE(Element, 136, 80);
240240
ASSERT_NODE_SIZE(HTMLDivElement, 136, 80);
@@ -243,7 +243,7 @@ ASSERT_NODE_SIZE(HTMLParagraphElement, 136, 80);
243243
ASSERT_NODE_SIZE(HTMLPreElement, 136, 80);
244244
ASSERT_NODE_SIZE(HTMLSpanElement, 136, 80);
245245
ASSERT_NODE_SIZE(HTMLTableCellElement, 136, 80);
246-
// TaintFox:
246+
// Foxhound:
247247
// Original: ASSERT_NODE_SIZE(Text, 120, 64);
248248
// Text is now a taintable string, so contains an
249249
// additional pointer (ie 120 + 8 or 64 + 4 bytes)
@@ -2441,7 +2441,7 @@ void Element::SetEventHandler(nsAtom* aEventName, const nsAString& aValue,
24412441
return;
24422442
}
24432443

2444-
// TaintFox: Event handler sink.
2444+
// Foxhound: Event handler sink.
24452445
if (aValue.isTainted()) {
24462446
nsAutoString eventName;
24472447
aEventName->ToString(eventName);
@@ -2584,7 +2584,7 @@ nsresult Element::SetAttr(int32_t aNamespaceID, nsAtom* aName, nsAtom* aPrefix,
25842584
nsAttrValue oldValue;
25852585
bool oldValueSet;
25862586

2587-
// Taintfox: the script blocker below will prevent us from executing taint notifications!
2587+
// Foxhound: the script blocker below will prevent us from executing taint notifications!
25882588
// So add our own callback to check the taint, even if value is not changing
25892589
CheckTaintSinkSetAttr(aNamespaceID, aName, aValue);
25902590

@@ -2992,7 +2992,7 @@ bool Element::GetAttr(const nsAtom* aName, nsAString& aResult, bool doTainting)
29922992
return false;
29932993
}
29942994
val->ToString(aResult);
2995-
// Taintfox: getAttribute source
2995+
// Foxhound: getAttribute source
29962996
if (doTainting && aResult.Length() > 0) {
29972997
SetTaintSourceGetAttr(aName, aResult);
29982998
}
@@ -3007,7 +3007,7 @@ bool Element::GetAttr(int32_t aNameSpaceID, const nsAtom* aName,
30073007
return false;
30083008
}
30093009
val->ToString(aResult);
3010-
// Taintfox: getAttribute source
3010+
// Foxhound: getAttribute source
30113011
if (doTainting && aResult.Length() > 0) {
30123012
SetTaintSourceGetAttr(aName, aResult);
30133013
}
@@ -4036,7 +4036,7 @@ void Element::SetInnerHTML(const nsAString& aInnerHTML,
40364036
nsIPrincipal* aSubjectPrincipal,
40374037
ErrorResult& aError) {
40384038

4039-
// TaintFox: innerHTML sink - don't set for template elements
4039+
// Foxhound: innerHTML sink - don't set for template elements
40404040
if (!IsTemplateElement()) {
40414041
ReportTaintSink(aInnerHTML, "innerHTML", this);
40424042
}
@@ -4063,7 +4063,7 @@ void Element::SetOuterHTML(const nsAString& aOuterHTML, ErrorResult& aError) {
40634063
return;
40644064
}
40654065

4066-
// TaintFox: outerHTML sink.
4066+
// Foxhound: outerHTML sink.
40674067
ReportTaintSink(aOuterHTML, "outerHTML", this);
40684068

40694069
if (OwnerDoc()->IsHTMLDocument()) {
@@ -4113,7 +4113,7 @@ enum nsAdjacentPosition { eBeforeBegin, eAfterBegin, eBeforeEnd, eAfterEnd };
41134113

41144114
void Element::InsertAdjacentHTML(const nsAString& aPosition,
41154115
const nsAString& aText, ErrorResult& aError) {
4116-
// TaintFox: insertAdjacentHTML sink
4116+
// Foxhound: insertAdjacentHTML sink
41174117
ReportTaintSink(aText, "insertAdjacentHTML", this);
41184118

41194119
nsAdjacentPosition position;
@@ -4244,7 +4244,7 @@ void Element::InsertAdjacentText(const nsAString& aWhere,
42444244
const nsAString& aData, ErrorResult& aError) {
42454245
RefPtr<nsTextNode> textNode = OwnerDoc()->CreateTextNode(aData);
42464246

4247-
// TaintFox: insertAdjacentHTML sink
4247+
// Foxhound: insertAdjacentHTML sink
42484248
ReportTaintSink(aData, "insertAdjacentText", this);
42494249

42504250
InsertAdjacent(aWhere, textNode, aError);

dom/base/Element.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ class Element : public FragmentOrElement {
11671167
return false; // DOMString comes pre-emptied.
11681168
}
11691169
val->ToString(aResult);
1170-
// Taintfox element.getAttr source
1170+
// Foxhound: element.getAttr source
11711171
if (doTainting && aResult.Length() > 0) {
11721172
SetTaintSourceGetAttr(aName, aResult);
11731173
}
@@ -1182,7 +1182,7 @@ class Element : public FragmentOrElement {
11821182
return false; // DOMString comes pre-emptied.
11831183
}
11841184
val->ToString(aResult);
1185-
// Taintfox element.getAttr source
1185+
// Foxhound: element.getAttr source
11861186
if (doTainting && aResult.Length() > 0) {
11871187
SetTaintSourceGetAttr(aNameSpaceID, aName, aResult);
11881188
}
@@ -1198,7 +1198,7 @@ class Element : public FragmentOrElement {
11981198
const nsAttrValue* val = mAttrs.GetAttr(aName);
11991199
if (val) {
12001200
val->ToString(aResult);
1201-
// Taintfox element.getAttr source
1201+
// Foxhound element.getAttr source
12021202
if (doTainting && aResult.Length() > 0) {
12031203
SetTaintSourceGetAttr(aName, aResult);
12041204
}
@@ -1986,7 +1986,7 @@ class Element : public FragmentOrElement {
19861986
void SetTaintSourceGetAttr(int32_t aNameSpaceID, const nsAtom* aName,
19871987
DOMString& aResult) const;
19881988
/**
1989-
* Taintfox: this method can be overriden by child classes to mark
1989+
* Foxhound: this method can be overriden by child classes to mark
19901990
* certain attributes as taint sources.
19911991
*/
19921992
virtual void SetTaintSourceGetAttr(const nsAString& aName, DOMString& aResult) const;

dom/base/EventSource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ void EventSourceImpl::Init(nsIGlobalObject* aWindowGlobal,
635635
MOZ_ASSERT(aPrincipal);
636636
MOZ_ASSERT(ReadyState() == CONNECTING);
637637
mPrincipal = aPrincipal;
638-
// Taintfox: EventSource sink
638+
// Foxhound: EventSource sink
639639
ReportTaintSink(aURL, "EventSource");
640640
aRv = ParseURL(aURL);
641641
if (NS_WARN_IF(aRv.Failed())) {

0 commit comments

Comments
 (0)