Niv Sardi commited on
Commit
95698cf
1 Parent(s): 9f5528c

add info and code to get certs in browser

Browse files

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>

Files changed (3) hide show
  1. README.org +5 -0
  2. detect.js +24 -0
  3. manifest.json +9 -1
README.org CHANGED
@@ -13,3 +13,8 @@ http://www.bcra.gov.ar/SistemasFinancierosYdePagos/Proveedores-servicios-de-pago
13
  http://www.bcra.gov.ar/SistemasFinancierosYdePagos/Proveedores-servicios-de-billeteras-digitales-Interoperables.asp
14
 
15
  http://www.bcra.gob.ar/SistemasFinancierosYdePagos/Entidades_financieras.asp
 
 
 
 
 
 
13
  http://www.bcra.gov.ar/SistemasFinancierosYdePagos/Proveedores-servicios-de-billeteras-digitales-Interoperables.asp
14
 
15
  http://www.bcra.gob.ar/SistemasFinancierosYdePagos/Entidades_financieras.asp
16
+
17
+ * certs in browsers
18
+ https://stackoverflow.com/questions/6566545/is-there-any-way-to-access-certificate-information-from-a-chrome-extension
19
+ https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest#accessing_security_information
20
+ https://chromium-review.googlesource.com/c/chromium/src/+/644858
detect.js CHANGED
@@ -1,5 +1,29 @@
1
  let run = () => {
 
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  }
5
 
 
1
  let run = () => {
2
+ console.log(`\n\nTLS browser extension loaded`)
3
 
4
+ // https://developer.chrome.com/extensions/match_patterns
5
+ var ALL_SITES = { urls: ['<all_urls>'] }
6
+
7
+ // Mozilla doesn't use tlsInfo in extraInfoSpec
8
+ var extraInfoSpec = ['blocking'];
9
+
10
+ // https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/webRequest/onHeadersReceived
11
+ browser.webRequest.onHeadersReceived.addListener(async function(details) {
12
+ console.log(`\n\nGot a request for ${details.url} with ID ${details.requestId}`)
13
+
14
+ // Yeah this is a String, even though the content is a Number
15
+ var requestId = details.requestId
16
+
17
+ var securityInfo = await browser.webRequest.getSecurityInfo(requestId, {
18
+ certificateChain: true,
19
+ rawDER: false
20
+ });
21
+
22
+ console.log(`securityInfo: ${JSON.stringify(securityInfo, null, 2)}`)
23
+
24
+ }, ALL_SITES, extraInfoSpec)
25
+
26
+ console.log('Added listener')
27
 
28
  }
29
 
manifest.json CHANGED
@@ -1,7 +1,7 @@
1
  {
2
  "manifest_version": 2,
3
  "name": "Spoof detect",
4
- "version": "0.1",
5
  "icons": {
6
  "48": "icons/48.png"
7
  },
@@ -11,5 +11,13 @@
11
  "matches": ["<all_urls>"],
12
  "js": ["detect.js"]
13
  }
 
 
 
 
 
 
 
 
14
  ]
15
  }
 
1
  {
2
  "manifest_version": 2,
3
  "name": "Spoof detect",
4
+ "version": "0.0.1-alpha0",
5
  "icons": {
6
  "48": "icons/48.png"
7
  },
 
11
  "matches": ["<all_urls>"],
12
  "js": ["detect.js"]
13
  }
14
+ ],
15
+ "background": {
16
+ "scripts": ["detect.js"]
17
+ },
18
+ "permissions": [
19
+ "webRequest",
20
+ "webRequestBlocking",
21
+ "<all_urls>"
22
  ]
23
  }