forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multiple modules: extract deviceMemory / hardwareConcurrency to libra…
…ry, add codeQL warnings (prebid#12070) * Custom codeQL rules / hardwareConcurrency and deviceMemory * move deviceMemory / hardwareConcurrency to a library * reuse library code for deviceMemory & co
- Loading branch information
Showing
10 changed files
with
86 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ paths: | |
- src | ||
- modules | ||
- libraries | ||
queries: | ||
- name: Prebid queries | ||
uses: ./.github/codeql/queries |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @id prebid/device-memory | ||
* @name Access to navigator.deviceMemory | ||
* @kind problem | ||
* @problem.severity warning | ||
* @description Finds uses of deviceMemory | ||
*/ | ||
|
||
import prebid | ||
|
||
from SourceNode nav | ||
where | ||
nav = windowPropertyRead("navigator") | ||
select nav.getAPropertyRead("deviceMemory"), "deviceMemory is an indicator of fingerprinting" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* @id prebid/hardware-concurrency | ||
* @name Access to navigator.hardwareConcurrency | ||
* @kind problem | ||
* @problem.severity warning | ||
* @description Finds uses of hardwareConcurrency | ||
*/ | ||
|
||
import prebid | ||
|
||
from SourceNode nav | ||
where | ||
nav = windowPropertyRead("navigator") | ||
select nav.getAPropertyRead("hardwareConcurrency"), "hardwareConcurrency is an indicator of fingerprinting" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import javascript | ||
import DataFlow | ||
|
||
SourceNode otherWindow() { | ||
result = globalVarRef("top") or | ||
result = globalVarRef("self") or | ||
result = globalVarRef("parent") or | ||
result = globalVarRef("frames").getAPropertyRead() or | ||
result = DOM::documentRef().getAPropertyRead("defaultView") | ||
} | ||
|
||
SourceNode connectedWindow(SourceNode win) { | ||
result = win.getAPropertyRead("self") or | ||
result = win.getAPropertyRead("top") or | ||
result = win.getAPropertyRead("parent") or | ||
result = win.getAPropertyRead("frames").getAPropertyRead() or | ||
result = win.getAPropertyRead("document").getAPropertyRead("defaultView") | ||
} | ||
|
||
SourceNode relatedWindow(SourceNode win) { | ||
result = connectedWindow(win) or | ||
result = relatedWindow+(connectedWindow(win)) | ||
} | ||
|
||
SourceNode anyWindow() { | ||
result = otherWindow() or | ||
result = relatedWindow(otherWindow()) | ||
} | ||
|
||
/* | ||
Matches uses of property `prop` done on any window object. | ||
*/ | ||
SourceNode windowPropertyRead(string prop) { | ||
result = globalVarRef(prop) or | ||
result = anyWindow().getAPropertyRead(prop) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
library: false | ||
warnOnImplicitThis: false | ||
name: queries | ||
version: 0.0.1 | ||
dependencies: | ||
codeql/javascript-all: ^1.1.1 | ||
codeql/javascript-queries: ^1.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ export function getDM(win = window) { | |
dm = undefined; | ||
} | ||
return dm; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters