-
-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<ruffle-object | ||
data="/test_assets/example.swf" | ||
width="500" | ||
height="500" | ||
></ruffle-object> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Spoofing Test</title> | ||
</head> | ||
|
||
<body> | ||
<div id="test-container"> | ||
<object | ||
data="/test_assets/example.swf" | ||
width="500" | ||
height="500" | ||
></object> | ||
</div> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { openTest, injectRuffleAndWait } from "../../utils.js"; | ||
import { expect, use } from "chai"; | ||
import chaiHtml from "chai-html"; | ||
import fs from "fs"; | ||
|
||
use(chaiHtml); | ||
|
||
describe("Spoofing is not easily detectable", () => { | ||
it("loads the test", async () => { | ||
await openTest(browser, `polyfill/spoofing`); | ||
}); | ||
|
||
it("Polyfills", async () => { | ||
await injectRuffleAndWait(browser); | ||
await browser.$("<ruffle-object />").waitForExist(); | ||
|
||
const actual = await browser.$("#test-container").getHTML(false); | ||
const expected = fs.readFileSync( | ||
`${import.meta.dirname}/expected.html`, | ||
"utf8", | ||
); | ||
expect(actual).html.to.equal(expected); | ||
}); | ||
|
||
it("Spoofs navigator.plugins", async () => { | ||
let names = await browser.execute(() => { | ||
Check failure on line 26 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 26 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 26 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
let names = []; | ||
Check failure on line 27 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 27 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 27 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
for (let i = 0; i < navigator.plugins.length; i++) { | ||
names.push(navigator.plugins[i]!.name); | ||
} | ||
return names; | ||
}); | ||
expect(names).to.include("Shockwave Flash"); | ||
|
||
let instance = await browser.execute(() => { | ||
Check failure on line 35 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 35 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 35 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
return navigator.plugins instanceof PluginArray | ||
Check failure on line 36 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 36 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 36 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
}) | ||
Check failure on line 37 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 37 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 37 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
expect(instance).be.true; | ||
Check failure on line 38 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 38 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 38 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
}); | ||
|
||
it("Spoofs navigator.mimeTypes", async () => { | ||
let types = await browser.execute(() => { | ||
Check failure on line 42 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 42 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 42 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
let types = []; | ||
Check failure on line 43 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 43 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 43 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
for (let i = 0; i < navigator.mimeTypes.length; i++) { | ||
types.push(navigator.mimeTypes[i]!.type); | ||
} | ||
return types; | ||
}); | ||
expect(types).to.include("application/x-shockwave-flash"); | ||
|
||
let instance = await browser.execute(() => { | ||
Check failure on line 51 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 51 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 51 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
for (let i = 0; i < navigator.mimeTypes.length; i++) { | ||
if (!(navigator.mimeTypes[i] instanceof MimeType)) { | ||
return false; | ||
} | ||
} | ||
return navigator.mimeTypes instanceof MimeTypeArray; | ||
}) | ||
Check failure on line 58 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / ubuntu-24.04
Check failure on line 58 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 20 / windows-latest
Check failure on line 58 in web/packages/selfhosted/test/polyfill/spoofing/test.ts GitHub Actions / Test Node.js 22 / ubuntu-24.04
|
||
expect(instance).be.true; | ||
}); | ||
|
||
}); |