Skip to content

Strengthen security practices in FF website #24762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 10, 2025
Merged

Strengthen security practices in FF website #24762

merged 13 commits into from
Jun 10, 2025

Conversation

dannimad
Copy link
Contributor

@dannimad dannimad commented Jun 3, 2025

  1. Bringing back a couple of hashes to validate inline scripts in the docs build, as well as an extra step in the website deployment to validate them.
    The reason to bring these back is seeing some violations in our CREM board related to the couple of inline script docusaurus build generates which could be also the cause of M3 Strict CSP item not been resolved yet.
    This was originally removed since FF website being an static site was expelled from solving M2 Strict CSP item, but M3 S360 item could still be active as it is still seeing some violations. Adding this back should bring an extra layer of security to our website even though it's not strictly needed, remove some CREM violations and help us prepare our case with security team in case M3 keeps unsolved.

  2. Use DOMPurify to sanitize HTML strings in the website. Our default trusted types policy was just accepting any string as it comes. Now we are using DOMPurify to sanitize the strings before they are used in the website. Using the minified version of it to be able to set it up in a script prior to rendering and setting the policy.

Both changes have been tested in our staging environment but setting the header as Report Only again briefly to make sure everything works as expected in prod.

@Copilot Copilot AI review requested due to automatic review settings June 3, 2025 23:34
@github-actions github-actions bot added area: build Build related issues area: website base: main PRs targeted against main branch labels Jun 3, 2025
@dannimad dannimad requested a review from Abe27342 June 3, 2025 23:34
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR restores inline script hash validation in the docs build, adds a deployment step to enforce it, and switches CSP to report-only with updated hashes.

  • Adds a Bash task in the deployment pipeline to run script hash checks.
  • Introduces validateHashes.sh to extract and compare inline script hashes.
  • Updates staticwebapp.config.json to use CSP report-only with the new hashes.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tools/pipelines/deploy-website.yml Added an Azure Pipelines Bash task for hash checking.
docs/validateHashes.sh New script to extract and validate inline script hashes.
docs/static/staticwebapp.config.json Changed CSP header to report-only and updated hashes.

dannimad and others added 2 commits June 5, 2025 15:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dannimad dannimad closed this Jun 6, 2025
@dannimad dannimad reopened this Jun 6, 2025
Copy link
Contributor

🔗 No broken links found! ✅

Your attention to detail is admirable.

linkcheck output


> fluid-framework-docs-site@0.0.0 ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> fluid-framework-docs-site@0.0.0 serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> fluid-framework-docs-site@0.0.0 check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

Stats:
  224682 links
    1708 destination URLs
    1939 URLs ignored
       0 warnings
       0 errors


@dannimad dannimad changed the title Use hashes to validate inline scripts in docs build Strengthen security practices in FF website Jun 10, 2025
@dannimad dannimad merged commit 62554e4 into main Jun 10, 2025
56 checks passed
@dannimad dannimad deleted the hashes-inline branch June 10, 2025 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build Build related issues area: website base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants