fix: modernize website dependency security#2574
Conversation
AB#5469322 ## Summary Replace the legacy Yarn and Docusaurus 2 website toolchain with Node 20, npm, Docusaurus 3, and React 18. Add targeted dependency overrides, a portable SHA-512 package lock, MDX 3 compatibility handling and tests, and checksum verification for the pinned Codecov CLI. ## Prompting Intent The engineer asked for a deeply reviewed follow-up to the ADO pipeline repair that resolves the website/yarn.lock security backlog without reducing test coverage, introducing regressions, leaking credentials, or weakening supply-chain protections. ## Linked Sources - ADO Bug 5469322: https://dev.azure.com/msdata/A365/_workitems/edit/5469322 - Parent pipeline repair PR: microsoft#2573 - Component Governance build: https://msdata.visualstudio.com/A365/_build/results?buildId=228104679&view=results - Residual upstream advisory: GHSA-mh99-v99m-4gvg ## Rationale The legacy dependency graph could not be remediated safely with isolated transitive bumps, so the website was moved to the current supported Docusaurus and React generations. npm provides a deterministic lock and CI-native cache; the committed lock omits environment-specific registry URLs and verifies every registry artifact with SHA-512. A tested preprocessor preserves historical documentation while adapting only legacy MDX constructs outside fenced code. Codecov is pinned and checksum-verified rather than downloaded from a mutable latest URL. The remaining brace-expansion advisory has no compatible upstream fix and is limited to trusted static-server glob configuration, so no risky vendored fork or node_modules mutation was introduced. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey @ranadeepsingh 👋! We use semantic commit messages to streamline the release process. Examples of commit messages with semantic prefixes:
To test your commit locally, please follow our guild on building from source. |
|
/azp run |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
|
ADO validation note: |
AB#5469322 ## Summary Load only the Codecov token immediately before coverage upload instead of loading the complete build Key Vault before unit tests. Restore the readability spacing that was unintentionally removed from the legacy Helm Dockerfiles. ## Prompting Intent The engineer asked for a file-by-file review of the stacked pipeline changes, with particular attention to secret leakage, unnecessary changes, the conda cache condition, publishing log levels, and preservation of Dockerfile readability. ## Linked Sources - Website security bug: https://dev.azure.com/msdata/A365/_workitems/edit/5469322 - Pipeline repair bug: https://dev.azure.com/msdata/A365/_workitems/edit/5467636 - Stacked pull request: microsoft#2574 - Parent pipeline repair: microsoft#2573 - Full ADO validation: https://msdata.visualstudio.com/A365/_build/results?buildId=228133377&view=results ## Rationale The earlier Key Vault placement ensured Codecov could upload after a failed test, but it also made every vault secret available before arbitrary unit-test execution. A late AzureKeyVault task with succeededOrFailed preserves failure uploads while filtering access to codecov-token only. The Helm blank-line removals had no functional or warning-related benefit, so restoring them keeps the original visual grouping without changing image behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
321ed02
into
microsoft:rana/fix-ado-docker-auth
Related Issues/PRs
What changes are proposed in this pull request?
Issue
The legacy website used Yarn 1, Node 18, Docusaurus 2.4.1, and React 16. Its
yarn.lockproduced 112 Component Governance alerts, including two Criticalfindings. The lock also depended on an obsolete dependency graph that could not
be remediated safely with isolated transitive upgrades.
Fix
yarn.lockwith an npm v3 lock containing 1,298 SHA-512 integrityrecords and no internal registry or mutable
resolvedURLs.npm ci,tests, and the production build in website CI.
blocks, plus the required Prism renderer and historical-link updates.
local npm commands.
keep the upload token environment-only.
codecov-token, load it immediately before the PR-only upload, and retaincoverage uploads after failed tests with
succeededOrFailed().Security outcome
Component Governance task now reports one Low
string_decoder@1.3.0alertinherited through the current
webpack-dev-server -> spdydevelopment-onlypath.
vulnerable package is
brace-expansion@1.1.16(GHSA-mh99-v99m-4gvg),
which npm reports as
fixAvailable: false. It is inherited from the latestDocusaurus/serve-handler static-server path and receives only trusted
configured glob patterns; this PR avoids introducing an unmaintained fork or
install-time mutation to hide the advisory.
How is this patch tested?
npm testunder Node 20: 2 tests passed.npm run buildunder Node 20: Docusaurus production build passed.npm ls --all: dependency tree valid withfast-uri@3.1.4.python -m pytest -q scripts/test_bump_version.py: 177 tests passed.black --check --extend-exclude 'docs/' scripts/bump-version.py scripts/test_bump_version.pysbt scalastyle test:scalastyleand npm audit checks.
down from the original 112 alerts including two Critical findings.
Website Deploybuild passed from a fresh public-registry install.passed every website, style, build, publish, Python, R, CPU/GPU Databricks,
Fabric, and all but one unit job. The sole failure was one agent receiving an
azureedge.netcertificate formsdata.visualstudio.comwhile obtaining itsKey Vault OIDC token; the same Key Vault task passed in 61 sibling jobs.
passed, confirming the failure was transient infrastructure rather than a
code regression.
9a5e7d6f9fpassed GitHub Website Deploy, CodeQL,dependency review, YAML parsing, Black (178 files), Scala style, and
whitespace validation.
passed BuildDocker, conda setup, and all 40 unit-test matrix jobs on the
latest commit. The PR-only Codecov secret task remains intentionally
excluded from manual builds because
Build.Reasonis system-controlled.Does this PR change any dependencies?
Docusaurus 3.10.2, React 18.3.1, current math/Prism integrations, and patched
transitive dependency versions recorded in
website/package-lock.json.Does this PR add a new feature? If so, have you added samples on website?