Skip to content

Add support for signing ES requests#6

Open
bjfletcher wants to merge 9 commits into
GlynnPhillips:masterfrom
bjfletcher:aws
Open

Add support for signing ES requests#6
bjfletcher wants to merge 9 commits into
GlynnPhillips:masterfrom
bjfletcher:aws

Conversation

@bjfletcher
Copy link
Copy Markdown

Another new thing from this PR is that this runs Webpack on the background JS as well as the popup JS.

@bjfletcher
Copy link
Copy Markdown
Author

The AWS section looks like this:

image

Comment thread background.js
{urls: ["<all_urls>"]},
["blocking", "requestHeaders"]);

const isUrlValid = (url) => {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move these const declarations to the top of the file please? I feel it would make it more readable

Comment thread lib/aws-signer.js
var canonicalRequestHash = CryptoJS.SHA256(canonicalRequest);
log('Canonical Request Hash: ' + canonicalRequestHash);

var service = 'es';
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indents

Comment thread manifest.json
"webRequestBlocking",
"*://*.ft.com/",
"*://*.herokuapp.com/",
"*://next-elastic.ft.com/*",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indents

Comment thread manifest.json
"scripts": [
"background.js"
"public/background.js",
"lib/hmac-sha256.js"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be added to the Makefile for the build and publish commands. The lib folder wont exist at the moment.

Comment thread manifest.json
"*://*.ft.com/",
"*://*.herokuapp.com/",
"*://next-elastic.ft.com/*",
"*://search-next-elasticsearch-[a-z1-9]+.(eu-west-1|us-east-1).es.amazonaws.com/*",
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manifests do not support regex for url matches, instead they have their own limit pattern matching https://developer.chrome.com/extensions/match_patterns

I think we will have to support this in the same way that we support herokuapp.com domains with the additional check in background.js https://github.com/GlynnPhillips/vary-headers/pull/6/files#diff-f9b12bd72f40c9b8ed144484f0f12a5fR47https://github.com/GlynnPhillips/vary-headers/pull/6/files#diff-f9b12bd72f40c9b8ed144484f0f12a5fR47

Comment thread Makefile
webpack popup.js public/popup.js
webpack background.js public/background.js

package: build
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the new icons directory to this package command please

cp -f -a ./{public,icons,popup.html,background.js,styles.css} ./publish

Comment thread lib/aws-signer.js
* licensed under https://github.com/carsales/aws-request-signer/blob/c835ca69e74a5b5e7d6eee7aaab8bbd7fbcdff4d/LICENSE
* with many thanks to John Jones :+1:
*/

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate that this file is mainly a copy from elsewhere but could we please update it to make the code style in the rest of the repo. This is partly my bad for not yet adding proper liniting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants