Skip to content

Moderate sketch lab text on the backend#74073

Open
molly-moen wants to merge 6 commits into
stagingfrom
molly/moderate-sketch-text
Open

Moderate sketch lab text on the backend#74073
molly-moen wants to merge 6 commits into
stagingfrom
molly/moderate-sketch-text

Conversation

@molly-moen

@molly-moen molly-moen commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This PR filters user-provided text in sketch lab (text on shapes, in text boxes, and in alt text for images). For now this is mostly silent; users won't see that their project has been flagged unless they look at the share link in another account, in which case the canvas will be blank. Messaging the user and putting up an error in share will be done as a follow-up, as this is the first time we want to do this for lab2.

Previously we only supported filtering blockly projects, so this sets up a new pattern to support other json structures with user-provided text.

The vast majority of lines here are tests and test fixtures 😄

Temporary share view for a blocked project

Note the main.json is 404'ing. If the project is updated to no longer have profanity, the main.json loads.
Screenshot 2026-07-23 at 2 15 21 PM

Links

molly-moen and others added 5 commits July 23, 2026 12:51
The Sketch Lab share-filtering frontend (share dialog failure message,
privacy-profanity blocked view) now lives on the
molly/lab2-profanity-frontend branch. This branch keeps the backend
filtering only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds backend share-filtering support for Sketch Lab by extracting user-entered text from Sketch Lab’s structured (React Flow) source JSON and applying existing PII/profanity checks during sources access.

Changes:

  • Extend ShareFiltering to support structured sources via a Sketch Lab text extractor and include sketchlab in filtered project types.
  • Update legacy sources middleware to pass through structured source data for filtering (instead of skipping non-string sources).
  • Add unit/integration coverage plus recorded S3 VCR cassettes and Sketch Lab JSON fixtures.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
shared/test/fixtures/vcr/sources/policy_channel_api_sketchlab.yml VCR cassette for Sketch Lab policy-channel API flows.
shared/test/fixtures/vcr/sources/get_source_blocks_sketchlab_profanity_violations.yml VCR cassette covering Sketch Lab profanity-violation access behavior.
lib/test/cdo/test_share_filtering.rb Adds unit tests for Sketch Lab text extraction and filtering behavior.
lib/cdo/share_filtering.rb Adds Sketch Lab structured-source extraction and wires it into share failure detection.
dashboard/legacy/test/middleware/test_sources.rb Adds middleware tests validating Sketch Lab access restrictions under violations.
dashboard/legacy/test/fixtures/privacy-profanity/sketchlab-privacy-violation-source.json Sketch Lab source fixture containing a privacy violation string.
dashboard/legacy/test/fixtures/privacy-profanity/sketchlab-normal-source.json Sketch Lab source fixture representing clean content.
dashboard/legacy/middleware/helpers/profanity_privacy_helper.rb Stops assuming source must be a String; passes structured sources through to ShareFiltering.

Comment thread lib/cdo/share_filtering.rb
@molly-moen
molly-moen marked this pull request as ready for review July 23, 2026 21:21
@molly-moen
molly-moen requested a review from a team July 23, 2026 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants