Skip to content

Commit

Permalink
Enable II on identity.internetcomputer.org (#1239)
Browse files Browse the repository at this point in the history
* Enable II on identity.internetcomputer.org

This updates the CSP rules to allow II to be served on
`https://identity.internetcomputer.org` in addition to
`https://identity.ic0.app`.

Note that the code now refers to
`https://identity.internetcomputer.org`. The test infrastructure is
also updated.

* 🤖 Selenium screenshots auto-update

* Refer to legacy URL in instructions

* 🤖 Selenium screenshots auto-update

* Reset screenshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
nmattia and github-actions[bot] authored Feb 17, 2023
1 parent 78d1bfa commit a1fd19d
Show file tree
Hide file tree
Showing 17 changed files with 124 additions and 107 deletions.
2 changes: 1 addition & 1 deletion docker-test-env/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Docker compose setup to run selenium tests with. The setup consists of the follo
* Forwards requests to the test app to `dfx` running on host.
* Forwards requests to the internet identity to the dev server running on host.
* Translates domains `<canister_id>.ic0.app` to the corresponding `<canister_id>.localhost` domains.
* Translates mapped domains (i.e. `identity.ic0.app`) to the corresponding `<canister_id>.localhost` domain.
* Translates mapped domains (i.e. `identity.internetcomputer.org`) to the corresponding `<canister_id>.localhost` domain.
* selenium container
* Runs chromium browser.
* Connects to nginx to access pages of the canister hosted on `dfx` or the dev server
Expand Down
2 changes: 1 addition & 1 deletion docker-test-env/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
aliases:
- ic0.app
# internet identity
- identity.ic0.app
- identity.internetcomputer.org
# test app, TEST_APP_CANISTER_ID is substituted by the start-selenium-env script
- TEST_APP_CANISTER_ID.ic0.app
- nice-name.com
Expand Down
33 changes: 0 additions & 33 deletions docker-test-env/reverse_proxy/certs/identity.ic0.app.crt

This file was deleted.

51 changes: 0 additions & 51 deletions docker-test-env/reverse_proxy/certs/identity.ic0.app.key

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
-----BEGIN CERTIF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4gl1aopp4DL6HVJ1wwIziMdt/lVl6z23U7t00Z
UsLhGj868nWpWeSarX9BTRvcgfIRWrbDqYJuRybzws+M0lSpXZynzNyuUf40sRxX
Bkzj4RZX86R55uaLyNAmbxaMrCX9iWgbM+3kkkAcvzpDnH+4lsTh1u/gbQb/Cott
ymkL9b6XO6vYhGBb5RBG12ZGDtfZukihJF8p0dYEu4tGlIVJeLejqZ7KBwIDAQAB
MA0GCSqGSIb3DQEBCwUAA4ICAQA6vOB92vnw8aR682PYKSvPsnRSXhk9qAzz8R2j
OPcc1Qc/RWJSll/JThWdZA595MvozYXAvOJgodAGPmCnq8lfoznImVrpX2qXr0g2
XVfsrp9hqPFJpMDkJYYaxzDaOEYSjECMLD+9PQTCXZ7WeFpv4CZejLpX7RTz0DsF
/KHGAtk9ucwewBeJ6cKOy6+bnqkkyM4nVDRlsrCw5aOOzoR1I0hqM68Bm8ZMfDoX
XuNwMT06qEm0ob6Zm9dEMpSD/m74QTgyguQNVq73XhEUBBjKR1XVg0e0wL1zLX+Q
GX4uQRWTw2nWME4SVKJbqJRBTD5k35a1YiF3hy9c6yMIa1dRj/HIM68E1BqFL2PC
jc786D/Vh9ONtVwTfBhB8ODa2GwPdlqG7rMfLQPaF2vQhZRO/lCJVm0MLv14m2IF
hQ+y6qs6d6Auv9eJRGQVIH7pR4dDsvE/sHvvx/O4RK8ydBG0JKE5FiPMwiIaiF/F
TK/qcJqiRgp4Bcn+ydQOMg6XyeWKLFByJ+TRajzZ3w7jYzMNtmn+HAyhWdJtQSVj
csw47OtW59XLk8G34Jl/bdtkCBsPHr46uGnIitIpwG4dGL+cI5XRIneJNuNm3lZN
WMDdIJOWDcGsImj7Ip6qawSbPr5hAWvY0jBT8vUa8LJ8GNutpww+eHEYyannt2Kg
JtO85w==
-----END CERTIFICATE-----
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-----BEGIN RSA PRIVATE KEY-----
MIIJKAIBAAKCAgEAlB8MdxjbtVmv+ok3kHGha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Ybw7
xtENAQuXxri3egupy1C77awrkBBB6mRiXxhOqWO2i6AYZGt8H2y9x5chmsAvM8b5
/7sHbw8qo22v1dbUgFRjoTKWIypPfloyjhMCUP3TDNNcQ8tCoBL5j0hOo2cZvuTa
GlOyRol/3FB5fm4c6BN0mylR1ODHyaNYAsESg7vDeLPkgLrl+Ro9OjHaILZhcTrI
IkY92leliNUkgmVkZAVgFG4pJdfppDFWsS4bYX3AjINxbCQpE6bI20aWVKxyFa2l
o9GFxQKCAQBlNQ8Hm0A+PFOCymH+/1oY46paCB8Frtbd4z8p4gHEYOEWPUHBgUBZ
EDblH+URzB4k0ewENW40slT2EDcTDyCTGooh4tapQ4+ak9RbbcF+rb/JAnn8skiD
oKBWT7/2cSwFIIIiBMkVLHGfunf3itF8IadpI+nMRTfXzkr5ZhzyRAlGSvbsw4xH
1kXt4F2cf7spWxHIoxmNMiqjiO0soCXVUtjJvL1khAtpKUXR4NfU4HNrZnsoemWa
r6frFICXDUwvmRYDLamii76AS8f8LLvhJLio/NujRDJEjFsOTnthLxn6+fpv27Zg
F19iykPyf+fH1r51ggecVxWGL14r1vkJAoIBAETj3xItvfc7G7cWtIEsjNRdB0w1
wPV1SI3he172TWu6Il+wFSeG9ymR8kKEJ/dbwDLqWDfZOt2LukgsQbfA4egSjRtl
eAUeb6+9V/jtlRFoGdaPer9ilZXEyUeAXY1vcbkfO/c6cA/4wbWGXBoYAylgJbu3
fxE3zlwonVyBor7L6Y3vYhJImdh37KbvWPmt8Pk7PI2ZfSTFrAefSSKA4dbRjl6S
xpmwcrK+DFwoULoMUGnMs3PsKiQW2eMfu3ZW8/JCClA9JWPsqCCWtHNSaM4PWlgx
W9P6Y2bSwTPGDKRN+zB8K2wWi3kR17H9fPu+uj4ZOZT1kJdy8Src2ET481o=
-----END RSA PRIVATE KEY-----
9 changes: 6 additions & 3 deletions docker-test-env/reverse_proxy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ http {
sendfile on;
keepalive_timeout 65;

# (a mock of) the IC's HTTP API endpoint
server {
listen 443 ssl;
server_name ic0.app;
Expand All @@ -26,12 +27,14 @@ http {
proxy_redirect off;
}
}

# (a mock of) the official internet identity server/domain, i.e. where the webapp is served
server {
listen 443 ssl;
server_name identity.ic0.app;
server_name identity.internetcomputer.org;

ssl_certificate /etc/nginx/certs/identity.ic0.app.crt;
ssl_certificate_key /etc/nginx/certs/identity.ic0.app.key;
ssl_certificate /etc/nginx/certs/identity.internetcomputer.org.crt;
ssl_certificate_key /etc/nginx/certs/identity.internetcomputer.org.key;

location / {
proxy_pass http://host.docker.internal:II_PORT;
Expand Down
2 changes: 1 addition & 1 deletion src/canister_tests/src/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ xr-spatial-tracking=()",

assert!(Regex::new(
"^default-src 'none';\
connect-src 'self' https://ic0.app https://\\*\\.ic0.app;\
connect-src 'self' https://identity.internetcomputer.org https://icp-api.io https://\\*\\.icp0.io https://ic0.app https://\\*\\.ic0.app;\
img-src 'self' data:;\
script-src 'sha256-[a-zA-Z0-9/=+]+' 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' https:;\
base-uri 'none';\
Expand Down
7 changes: 5 additions & 2 deletions src/frontend/src/banner.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { render, html, TemplateResult } from "lit-html";
import { anyFeatures } from "./features";
import { OFFICIAL_II_URL } from "./config";
import { OFFICIAL_II_URL, LEGACY_II_URL } from "./config";

// Show a warning banner if the build is not "official". This happens if either the build
// is a flavored build, or if the origin is not the official II URL.
Expand All @@ -14,7 +14,10 @@ export const showWarningIfNecessary = (): void => {
href="https://github.com/dfinity/internet-identity#build-features"
>more</a
>`);
} else if (window.location.origin !== OFFICIAL_II_URL) {
} else if (
window.location.origin !== OFFICIAL_II_URL &&
window.location.origin !== LEGACY_II_URL
) {
showWarning(html`This is not the official Internet Identity.
<a
class="features-warning-btn"
Expand Down
8 changes: 7 additions & 1 deletion src/frontend/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
/* Global configuration for II and constants */

// The official URL, without protocol
export const OFFICIAL_II_URL_NO_PROTOCOL = "identity.ic0.app";
export const OFFICIAL_II_URL_NO_PROTOCOL = "identity.internetcomputer.org";

// The URL where the official, production II is served
export const OFFICIAL_II_URL = "https://" + OFFICIAL_II_URL_NO_PROTOCOL;

// The legacy II URL, without protocol
export const LEGACY_II_URL_NO_PROTOCOL = "identity.ic0.app";

// The legacy production II URL
export const LEGACY_II_URL = "https://" + LEGACY_II_URL_NO_PROTOCOL;
4 changes: 2 additions & 2 deletions src/frontend/src/flows/addDevice/manage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { html, render } from "lit-html";
import { browserIcon, securityKeyIcon } from "../../../components/icons";
import { warnBox } from "../../../components/warnBox";
import { mainWindow } from "../../../components/mainWindow";
import { OFFICIAL_II_URL } from "../../../config";
import { LEGACY_II_URL } from "../../../config";

const pageContent = () => {
const pageContentSlot = html` <article>
Expand All @@ -11,7 +11,7 @@ const pageContent = () => {
additionalClasses: ["l-stack"],
title: "Security Warning",
message: html`Do not continue if you were prompted to do this by any
website other than <strong>${OFFICIAL_II_URL}</strong>!`,
website other than <strong>${LEGACY_II_URL}</strong>!`,
})}
<p class="t-lead l-stack">
What type of device do you want to add to your Internet Identity? Make
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "../../../../generated/internet_identity_types";
import { displayError } from "../../../components/displayError";
import { mainWindow } from "../../../components/mainWindow";
import { OFFICIAL_II_URL } from "../../../config";
import { LEGACY_II_URL } from "../../../config";

const pageContent = (userNumber: bigint) => {
const pageContentSlot = html`
Expand All @@ -25,7 +25,7 @@ const pageContent = (userNumber: bigint) => {
<li>
Open
<em class="c-tooltip">
<strong class="t-strong">${OFFICIAL_II_URL}</strong>
<strong class="t-strong">${LEGACY_II_URL}</strong>
<span class="c-tooltip__message c-card c-card--narrow">
Open this link on the device you want to add.
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
TentativeDeviceInfo,
} from "./registerTentativeDevice";
import { mainWindow } from "../../../components/mainWindow";
import { OFFICIAL_II_URL_NO_PROTOCOL } from "../../../config";
import { LEGACY_II_URL_NO_PROTOCOL } from "../../../config";

const pageContent = (userNumber: bigint) => {
const pageContentSlot = html` <article>
Expand All @@ -23,8 +23,8 @@ const pageContent = (userNumber: bigint) => {
<ol class="c-list c-list--numbered l-stack">
<li>
Log into
<strong class="t-strong">${OFFICIAL_II_URL_NO_PROTOCOL}</strong> with
your Identity Anchor (<strong class="t-strong">${userNumber}</strong>)
<strong class="t-strong">${LEGACY_II_URL_NO_PROTOCOL}</strong> with your
Identity Anchor (<strong class="t-strong">${userNumber}</strong>)
</li>
<li>
Once you are logged in, click “<strong class="t-string"
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/flows/registerDisabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { html, render } from "lit-html";
import { warnBox } from "../components/warnBox";
import { LoginFlowCanceled, cancel } from "../utils/flowResult";
import { mainWindow } from "../components/mainWindow";
import { OFFICIAL_II_URL } from "../config";
import { LEGACY_II_URL } from "../config";

const pageContent = (onCancel: () => void) => {
const pageContentSlot = html` <hgroup>
Expand All @@ -14,7 +14,7 @@ const pageContent = (onCancel: () => void) => {
message: html`<p class="t-paragraph t-lead">
To keep you safe, we disabled registration from this address. If you
want to securely create a new Internet Identity, visit:
<a class="t-link" href=${OFFICIAL_II_URL}>${OFFICIAL_II_URL}</a>.
<a class="t-link" href=${LEGACY_II_URL}>${LEGACY_II_URL}</a>.
</p>
<p class="t-paragraph">
If you were redirected here by another website, please inform the
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/test-e2e/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const TEST_APP_CANISTER_ID = test_app_canister_ids.test_app.local;
export const TEST_APP_CANONICAL_URL = `https://${TEST_APP_CANISTER_ID}.ic0.app`;
export const TEST_APP_NICE_URL = "https://nice-name.com";
export const REPLICA_URL = "https://ic0.app";
export const II_URL = "https://identity.ic0.app";
export const II_URL = "https://identity.internetcomputer.org";
export const ABOUT_URL = `${II_URL}/about`;

export const DEVICE_NAME1 = "Virtual WebAuthn device";
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/test-e2e/register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const TEST_APP_CANISTER_ID = test_app_canister_ids.test_app.local;
const TEST_APP_CANONICAL_URL = `https://${TEST_APP_CANISTER_ID}.ic0.app`;
const TEST_APP_NICE_URL = "https://nice-name.com";
const REPLICA_URL = "https://ic0.app";
const II_URL = "https://identity.ic0.app";
import { II_URL } from "./constants";
const ABOUT_URL = `${II_URL}/about`;

const DEVICE_NAME1 = "Virtual WebAuthn device";
Expand Down
Loading

0 comments on commit a1fd19d

Please sign in to comment.