Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grip service migration #171

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions apps/artemis-web/components/hijack-info/hijack-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ class HijackInfoComponent extends Component<any, any> {
const type = this.getEventType(hijackDataState["type"]);

try {
const resp = await fetch(`https://api.grip.caida.org/v1/json/events?event_type=${type}&asns=${asn}&pfxs=${prefix}`, {
const resp = await fetch(`http://${window.location.host}:8088/https://api.grip.inetintel.cc.gatech.edu/json/events?event_type=${type}&asns=${asn}&pfxs=${prefix}`, {
method: 'GET',
mode: 'cors',
cache: "default",
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
origin: 'localhost',
'x-requested-with': 'artemis'
},
});
const json = await resp.json();
Expand Down Expand Up @@ -310,7 +314,7 @@ class HijackInfoComponent extends Component<any, any> {
type="button"
className={`btn btn-primary
} btn-lg`}
onClick={() => window.open(`https://grip-dev.caida.org/events/${type}/${this.eventRef.current.value}`, "_blank")}
onClick={() => window.open(`https://grip.inetintel.cc.gatech.edu/events/${type}/${this.eventRef.current.value}`, "_blank")}
>
Go to GRIP event
</button>
Expand Down
10 changes: 6 additions & 4 deletions apps/artemis-web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,20 @@ module.exports = {
'https://localhost/api/graphql',
'http://localhost/api/graphql',
'https://demo.artemis-pc.duckdns.org/api/graphql',
'https://accounts.google.com/o/oauth2/v2/auth'
'https://accounts.google.com/o/oauth2/v2/auth',
'https://127.0.0.1:8088/https://api.grip.inetintel.cc.gatech.edu/',
'http://localhost:8088/https://api.grip.inetintel.cc.gatech.edu/'
],
frameAncestors: "'none",
// frameAncestors: "'none",
imgSrc: ["'self'", 'data:'],
objectSrc: "'none",
// objectSrc: "'none",
},
},
forceHTTPSRedirect: [
true,
{ maxAge: 60 * 60 * 24 * 4, includeSubDomains: true },
],
referrerPolicy: 'origin',
referrerPolicy: 'same-origin',
}),
},
];
Expand Down
1 change: 1 addition & 0 deletions apps/artemis-web/scripts/entrypoint
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
./wait-for -h ${MONGODB_HOST} -p ${MONGODB_PORT} -t 0
node query.js
node proxy.js&

if [ -z "$SERVICE_ACCOUNT_PATH" ]; then (yarn start:notification&); fi
NODE_ENV=production NEXT_PUBLIC_REVISION=$(git rev-parse HEAD) yarn run nx serve artemis-web --prod
12 changes: 12 additions & 0 deletions apps/artemis-web/scripts/proxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var host = process.env.HOST || '0.0.0.0';
// Listen on a specific port via the PORT environment variable
var port = process.env.PORT || 8088;

var cors_proxy = require('cors-anywhere');
cors_proxy.createServer({
originWhitelist: [], // Allow all origins
requireHeader: ['origin', 'x-requested-with'],
removeHeaders: ['cookie', 'cookie2']
}).listen(port, host, function() {
console.log('Running CORS Anywhere on ' + host + ':' + port);
});
1 change: 1 addition & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ services:
- .env
ports:
- 4200:4200
- 8088:8088
depends_on:
- mongodb
mongodb:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"chance": "^1.1.8",
"codemirror": "^5.63.3",
"cors": "^2.8.5",
"cors-anywhere": "^0.4.4",
"cross-fetch": "^3.1.4",
"diff_match_patch": "^0.1.1",
"draft-js": "^0.11.7",
Expand Down Expand Up @@ -144,4 +145,4 @@
"pre-push": "yarn run affected:test"
}
}
}
}
31 changes: 31 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6475,6 +6475,14 @@ core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==

cors-anywhere@^0.4.4:
version "0.4.4"
resolved "https://registry.yarnpkg.com/cors-anywhere/-/cors-anywhere-0.4.4.tgz#98892fcab55f408fff13a63e125135c18dc22ca8"
integrity sha512-8OBFwnzMgR4mNrAeAyOLB2EruS2z7u02of2bOu7i9kKYlZG+niS7CTHLPgEXKWW2NAOJWRry9RRCaL9lJRjNqg==
dependencies:
http-proxy "1.11.1"
proxy-from-env "0.0.1"

cors@^2.8.5:
version "2.8.5"
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
Expand Down Expand Up @@ -7839,6 +7847,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d"
integrity sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==

[email protected]:
version "1.2.0"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.2.0.tgz#1c86991d816ad1e504750e73874224ecf3bec508"
integrity sha512-DOFqA1MF46fmZl2xtzXR3MPCRsXqgoFqdXcrCVYM3JNnfUeHTm/fh/v/iU7gBFpwkuBmoJPAm5GuhdDfSEJMJA==

eventemitter3@^3.1.0:
version "3.1.2"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7"
Expand Down Expand Up @@ -8972,6 +8985,14 @@ http-proxy-middleware@^2.0.3:
is-plain-obj "^3.0.0"
micromatch "^4.0.2"

[email protected]:
version "1.11.1"
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.11.1.tgz#71df55757e802d58ea810df2244019dda05ae85d"
integrity sha512-qz7jZarkVG3G6GMq+4VRJPSN4NkIjL4VMTNhKGd8jc25BumeJjWWvnY3A7OkCGa8W1TTxbaK3dcE0ijFalITVA==
dependencies:
eventemitter3 "1.x.x"
requires-port "0.x.x"

http-proxy@^1.18.1:
version "1.18.1"
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549"
Expand Down Expand Up @@ -13001,6 +13022,11 @@ proxy-addr@~2.0.7:
forwarded "0.2.0"
ipaddr.js "1.9.1"

[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-0.0.1.tgz#b27c4946e9e6d5dbadb7598a6435d3014c4cfd49"
integrity sha512-B9Hnta3CATuMS0q6kt5hEezOPM+V3dgaRewkFtFoaRQYTVNsHqUvFXmndH06z3QO1ZdDnRELv5vfY6zAj/gG7A==

[email protected]:
version "1.0.0"
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee"
Expand Down Expand Up @@ -13557,6 +13583,11 @@ require-from-string@^2.0.2:
resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909"
integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==

[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-0.0.1.tgz#4b4414411d9df7c855995dd899a8c78a2951c16d"
integrity sha512-AzPDCliPoWDSvEVYRQmpzuPhGGEnPrQz9YiOEvn+UdB9ixBpw+4IOZWtwctmpzySLZTy7ynpn47V14H4yaowtA==

requires-port@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
Expand Down