docs(security): port security best practices 1:1 from portal#204
Conversation
Plan for security team reviewHi @dfinity/product-security — we'd like your input on this PR before it merges. Here's the context and what we're asking. What this PR doesThis is a 1:1 port of all security best practices from The only intentional deviations from a pure port are:
You are now added as CODEOWNER for all files in What we're asking from youPlease verify the ported content is correct and matches the portal source. We're keeping this PR in draft intentionally — it will not be merged until after a second cleanup PR (described below) is also approved. What comes next — cleanup PRAfter your approval of this PR, we'll create a second branch from
Merge sequence
|
51de28a to
14e63c9
Compare
…ces (#239) ## Summary Closes #235. Post-merge cleanup for PR #204 after PR #208 landed. - **`canister-control.md`**: SNS link → `docs/concepts/governance.md#the-service-nervous-system`; tokenomics/voting-power link → `docs/concepts/governance.md#neurons`; removed "See also" wiki bullet (no internal equivalent for SNS verification trust or swap trust content) - **`canister-upgrades.md`**: Removed wiki "current limitations" bullet for `pre_upgrade` bugs (no internal equivalent) - **`data-storage.md`**: Removed wiki "current limitations" bullet for long running upgrades and deserializer memory (no internal equivalent) - **`inter-canister-calls.md`**: Removed two wiki "current limitations" bullets for untrustworthy canisters and call graph loops (no internal equivalent) - **`data-integrity-and-authenticity.md`**: Asset certification Learn Hub link → `docs/guides/frontends/certification.md` Note: the rebase of `docs/security-port` on `main` is deferred — will be done as a final step before that PR merges. ## Sync recommendation hand-written (link fixes only; no content changes)
Replaces AI-generated security docs with verified portal content, adds 8 missing topic files, 2 new prerequisite pages, and fixes a confirmed double-spend bug in the inter-canister-calls guide. Changes: - Replace: inter-canister-calls.md, access-management.mdx, canister-upgrades.md, dos-prevention.md, data-integrity.md - Add: overview.md, data-storage.md, decentralization.md, https-outcalls.md, misc.md, observability.md, resources.md, formal-verification.md - Add: references/message-execution-properties.md (prerequisite referenced by inter-canister-calls.md) - Add: guides/canister-calls/idempotency.md (prerequisite for safe retry patterns in inter-canister calls) - Fix sidebar order conflicts (now matches portal ordering 1-14) - Fix MDX HTML comment syntax in access-management.mdx - Add security and reference diagram images to public/img/ - encryption.mdx flagged for separate security team review (new content not from portal, not changed here)
## Summary - **\"dapp\"/\"dapps\" → \"app\"/\"apps\"** across all 12 security guide files; repository names in URLs preserved (`nns-dapp`, `encrypted-notes-dapp`), link labels updated (`NNS app`, `encrypted notes`) - **\"smart contract(s)\" → \"canister(s)\"** in `decentralization.md`, including the section heading and the blockchains admonition note - **Em-dashes removed from `<!-- Upstream: -->` comments** in all 11 remaining files (`identity-and-access-management.mdx` was already fixed in a previous commit) - **Informal phrasing removed** in `data-integrity-and-authenticity.md`: \"we will club composite_query\" and \"best of both worlds\" - **Garbled sentence fixed** in `identity-and-access-management.mdx` (mobile II section): the original had a sentence fragment mid-paragraph from a copy-paste error - **\"DAO\" removed from prose** in `decentralization.md`; replaced with \"community governance\", \"governance framework\", and \"custom governance canister\" following the convention established in PR #208 - **\"decentralized governance system\" → \"governance framework\"** throughout `decentralization.md` - **`composite_query` description corrected** in `data-integrity-and-authenticity.md`: \"query call\" → \"query methods\" (composite_query is a method type, not a call type) - **\"off-chain\" → \"offchain\" / \"external\"** in `decentralization.md`; bare \"onchain\"/\"offchain\" category labels replaced with descriptive terms (\"external components\", \"hosted as canisters\") - **\"tamper-resistant\" → \"tamperproof\"** in `observability-and-monitoring.md` (one word, per brand guide) - **\"on-chain\" → \"stored in the canister\"** in `observability-and-monitoring.md` ## Sync recommendation `informed by dfinity/portal` — content is derived from the portal source but diverges intentionally for brand voice compliance; no sync back to portal is expected.
… usage (#236) ## Summary - **overview.md**: Update 3 ANSSI Rust guide links to the restructured URL paths (`introduction.html`, `unsafe/generalities.html`, `integer.html#chapter-integer`, `libraries.html#cargo-audit`) - **data-storage.md**: Remove abandoned `seniorjoinu/ic-stable-memory` library (unmaintained since May 2023) and its caution block; rephrase intro to single remaining library; update encrypted notes example link from defunct `motoko/encrypted-notes-dapp` to `rust/vetkeys/encrypted_notes_dapp_vetkd` - **decentralization.md**: Remove LaunchTrail reference (`spinner-cash/launchtrail`, abandoned June 2022); remove `basic_dao` example link (path no longer exists on master) - **canister-upgrades.md**: Update both `set_timer_interval` links from `ic-cdk/0.6.9` to `ic-cdk-timers/1.0.0` (function moved crates) - **data-integrity-and-authenticity.md**: Migrate JavaScript client-side verification example from deprecated `@dfinity/agent`, `@dfinity/candid`, `@dfinity/principal` to `@icp-sdk/core/agent`, `@icp-sdk/core/candid`, `@icp-sdk/core/principal`; update `HttpAgent`, `Certificate`, and `lookup_path` APIs to v5; fix pre-existing `start().await` bug ## Sync recommendation `sync from dfinity/portal building-apps/security/*` — changes are fixes on top of the ported content; upstream source does not yet reflect the updated SDK or fixed links.
- Replace both mermaid sequence diagrams with plantuml equivalents using the already-configured remark-plantuml plugin - Fix unity_ii_deeplink example links: main -> master branch
…ter-control (#237) ## Summary - Apply sentence case to all security guide page titles (matches portal convention and brand rules) - Add `sidebar.label: "Overview"` to overview page so navbar shows "Overview" while page title remains "Security overview" - Rename `decentralization.md` → `canister-control.md` (more accurate: covers SNS governance, canister trust verification, and untrusted asset loading) - Remove "Security" from individual page titles within the security section (the section heading already provides context, consistent with original portal structure) - Improve three descriptions: "endpoint verification" (was "validation"), "timer reinstatement after upgrades" (was "reinstatement"), added "mobile Internet Identity integration" to IAM description ## Sync recommendation hand-written (title/description metadata changes only; content unchanged)
…ces (#239) ## Summary Closes #235. Post-merge cleanup for PR #204 after PR #208 landed. - **`canister-control.md`**: SNS link → `docs/concepts/governance.md#the-service-nervous-system`; tokenomics/voting-power link → `docs/concepts/governance.md#neurons`; removed "See also" wiki bullet (no internal equivalent for SNS verification trust or swap trust content) - **`canister-upgrades.md`**: Removed wiki "current limitations" bullet for `pre_upgrade` bugs (no internal equivalent) - **`data-storage.md`**: Removed wiki "current limitations" bullet for long running upgrades and deserializer memory (no internal equivalent) - **`inter-canister-calls.md`**: Removed two wiki "current limitations" bullets for untrustworthy canisters and call graph loops (no internal equivalent) - **`data-integrity-and-authenticity.md`**: Asset certification Learn Hub link → `docs/guides/frontends/certification.md` Note: the rebase of `docs/security-port` on `main` is deferred — will be done as a final step before that PR merges. ## Sync recommendation hand-written (link fixes only; no content changes)
40d8bf8 to
a56e668
Compare
Summary
inter-canister-calls.md)dfinity/portal(building-apps/security/) 1:1 as the content baseoverview.md,data-storage.md,decentralization.md,https-outcalls.md,miscellaneous.md,observability-and-monitoring.md,formal-verification.mdresources.mdcontent intooverview.mdas a "Further reading" section (no value as a standalone thin page)access-management.mdx→identity-and-access-management.mdxdata-integrity.md→data-integrity-and-authenticity.mdobservability.md→observability-and-monitoring.mdmisc.md→miscellaneous.mdencryption.mdx(AI-generated, unreviewed; vetKeys encryption guide will be written from scratch separately)references/message-execution-properties.mdandguides/canister-calls/idempotency.mdretry_idempotency.pngimage with a PlantUML sequence diagram inidempotency.mdmo:base/HashMapCallerGuard ininter-canister-calls.mdtomo:core/Map(only code change beyond 1:1 port)Notes
@dfinity/agentreferences in the ported files are left as-is; updating to the new JS SDK is a separate follow-upinter-canister-calls.md: it suggested issuing a refund after receiving abounded_waiterror, where the transfer could still have gone throughconcepts/security.md(new architectural overview, not from portal) is kept as-is; flagged for separate security team reviewSync recommendation
sync from dfinity/portal building-apps/security/Tracked in: #203