Skip to content

Commit

Permalink
Drop insecure flag
Browse files Browse the repository at this point in the history
  • Loading branch information
zapo committed Dec 4, 2024
1 parent 3f40cd4 commit 6eecf0d
Show file tree
Hide file tree
Showing 23 changed files with 4 additions and 33 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ deps:
export SDK_URI ?= https://localhost:8181/sdk.js
export DCN_HOST ?= sandbox.optable.co
export DCN_SITE ?= web-sdk-demo
export DCN_INSECURE ?= false
export DCN_INIT ?= true
export DCN_ID ?= optable
export ADS_HOST ?= ads.optable.co
Expand All @@ -38,7 +37,6 @@ DEMO_VARS:='\
DCN_HOST=$${DCN_HOST} \
DCN_SITE=$${DCN_SITE} \
DCN_ID=$${DCN_ID} \
DCN_INSECURE=$${DCN_INSECURE} \
DCN_INIT=$${DCN_INIT} \
ADS_SITE=$${ADS_SITE} \
ADS_HOST=$${ADS_HOST} \
Expand Down
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,7 @@ const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site" });

You can then call various SDK APIs on the instance as shown in the examples below. It's also possible to configure multiple instances of `OptableSDK` in order to connect to other (e.g., partner) DCNs and/or reference other configured web site slug IDs.

Note that all SDK communication with Optable DCNs is done over TLS. The only exception to this is if you instantiate the `OptableSDK` class with the `insecure` optional boolean parameter set to `true`. For example:

```js
const sdk = new OptableSDK({ host: "dcn.customer.com", site: "my-site", insecure: true });
```

Note that production DCNs only listen to TLS traffic. The `insecure: true` option is meant to be used by Optable developers running the DCN locally for testing. See [developer docs](https://github.com/Optable/optable-web-sdk/tree/master/docs) for other developer notes.
Note that all SDK communication with Optable DCNs is done over TLS.

### Identify API

Expand Down
1 change: 0 additions & 1 deletion demos/ads/protected-audience/advertiser.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: cookiesTransport,
});
})
Expand Down
1 change: 0 additions & 1 deletion demos/ads/protected-audience/publisher-gam.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: cookiesTransport,
});
})
Expand Down
1 change: 0 additions & 1 deletion demos/ads/protected-audience/publisher.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: cookiesTransport,
});
})
Expand Down
1 change: 0 additions & 1 deletion demos/ads/topics/publisher.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: cookiesTransport,
});
})
Expand Down
1 change: 0 additions & 1 deletion demos/react/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ module.exports = {
host: process.env.DCN_HOST,
initPassport: process.env.DCN_INIT === "true",
site: "${DCN_SITE}",
insecure: process.env.DCN_INSECURE === "true",
}),
}),
new HtmlWebpackPlugin({
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/identify.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
});
optable.instance.tryIdentifyFromParams();
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/nocookies/identify.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: false,
});
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/nocookies/profile.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: false,
});
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/nocookies/targeting/gam360-cached.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: false,
});
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/nocookies/targeting/gam360.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: false,
});
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/nocookies/targeting/prebid.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: false,
});
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/nocookies/witness.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
cookies: false,
});
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/profile.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
});
optable.instance.tryIdentifyFromParams();
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/targeting/gam360-cached.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
});
optable.instance.tryIdentifyFromParams();
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/targeting/gam360.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
});
optable.instance.tryIdentifyFromParams();
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/targeting/prebid.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
});
optable.instance.tryIdentifyFromParams();
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/uid2_token/login.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
});
optable.instance.tryIdentifyFromParams();
Expand Down
1 change: 0 additions & 1 deletion demos/vanilla/witness.html.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
host: "${DCN_HOST}",
initPassport: JSON.parse("${DCN_INIT}"),
site: "${DCN_SITE}",
insecure: JSON.parse("${DCN_INSECURE}"),
});
optable.instance.tryIdentifyFromParams();
Expand Down
2 changes: 0 additions & 2 deletions lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
type OptableConfig = {
host: string;
site: string;
insecure?: boolean;
cookies?: boolean;
initPassport?: boolean;
};

const DCN_DEFAULTS = {
insecure: false,
cookies: true,
initPassport: true,
};
Expand Down
2 changes: 1 addition & 1 deletion lib/core/network.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { default as buildInfo } from "../build.json";

describe("buildRequest", () => {
test("preserves path query string", () => {
const dcn = { cookies: true, host: "host", insecure: false, site: "site" };
const dcn = { cookies: true, host: "host", site: "site" };
const req = { method: "GET" };
const request = buildRequest("/path?query=string", dcn, req);

Expand Down
5 changes: 2 additions & 3 deletions lib/core/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { default as buildInfo } from "../build.json";
import { LocalStorage } from "./storage";

function buildRequest(path: string, config: Required<OptableConfig>, init?: RequestInit): Request {
const { site, host, insecure, cookies } = config;
const { site, host, cookies } = config;

const proto = insecure ? "http" : "https";
const url = new URL(`${site}${path}`, `${proto}://${host}`);
const url = new URL(`${site}${path}`, `https://${host}`);
url.searchParams.set("osdk", `web-${buildInfo.version}`);

if (cookies) {
Expand Down

0 comments on commit 6eecf0d

Please sign in to comment.