You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: replace dev_csp compile-time feature with init arg for frontend canister (dfinity#3683)
# Motivation
Replace the compile-time `dev_csp` Cargo feature flag on
`internet_identity_frontend` with a runtime `dev_csp: opt bool`
installation argument.
Previously, building the frontend with a relaxed Content Security Policy
(allowing HTTP connections for local development) required compiling a
separate wasm with `--features dev_csp`. This meant release builds could
not be reused for local testing without rebuilding.
Now, the same wasm binary can serve both production and development by
passing `dev_csp = opt true` in the canister init arg. When enabled:
- `connect-src` allows `http:` in addition to `https:`
- `upgrade-insecure-requests` directive is omitted
When omitted or set to `false`, the strict production CSP is used.
# Changes
- Add `dev_csp: Option<bool>` to `InternetIdentityFrontendArgs` (Rust)
- Add `dev_csp : opt bool` to `InternetIdentityFrontendInit` (Candid)
- Replace `#[cfg(feature = "dev_csp")]` checks in `main.rs` with
runtime boolean threaded through the CSP construction
- Remove `[features]` section from frontend `Cargo.toml`
- Remove `II_DEV_CSP` handling from `scripts/build` for frontend
- Remove `II_DEV_CSP=1` from frontend build command in `dfx.json`
- Add `dev_csp = opt true` to `local_test_arg.did`
| [Next PR](dfinity#3685) >
0 commit comments