Skip to content

Commit

Permalink
Add detection for WebMidi and Window Placement APIs (#162)
Browse files Browse the repository at this point in the history
* allow binding to a specific IP

* Detect more harmful APIs
  • Loading branch information
muodov authored Jul 10, 2023
1 parent 84a0190 commit 65341bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions features/harmful-apis/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ const tests = [
return ('hid' in navigator);
}
},
{
id: 'web-midi-api',
run: () => {
return ('requestMIDIAccess' in navigator);
}
},
{
id: 'accelerometer-api',
run: () => {
Expand Down Expand Up @@ -220,6 +226,12 @@ const tests = [
run: () => {
return ('joinAdInterestGroup' in navigator) || ('runAdAuction' in navigator);
}
},
{
id: 'window-placement-api',
run: () => {
return ('screen' in window && 'isExtended' in window.screen);
}
}
];

Expand Down
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const express = require('express');
const ws = require('ws');
const app = express();
const port = process.env.PORT || 3000;
const host = process.env.HOST || '127.0.0.1';
const url = require('url');
const cmd = require('node-cmd');
const crypto = require('crypto');
Expand All @@ -20,8 +21,8 @@ function fullUrl (req) {

// Start the HTTP server. On Glitch the proxy will forward both HTTP and HTTPS
// traffic to this server.
const listener = app.listen(port, () => {
console.log(`HTTP Server listening at port ${listener.address().port}`);
const listener = app.listen(port, host, () => {
console.log(`HTTP Server listening at ${listener.address().address}:${listener.address().port}`);
});

// Start HTTPS server for https://first-party.example and https://third-party.example
Expand Down

0 comments on commit 65341bf

Please sign in to comment.