Skip to content

feat(integrations): split GitHub sanitized inputs check into two automations#2683

Merged
tofikwest merged 2 commits intomainfrom
feat/split-sanitized-inputs-check
Apr 27, 2026
Merged

feat(integrations): split GitHub sanitized inputs check into two automations#2683
tofikwest merged 2 commits intomainfrom
feat/split-sanitized-inputs-check

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest commented Apr 27, 2026

Summary

Splits the combined "Sanitized Inputs & Code Scanning" GitHub check (one card with two sub-results) into two separate IntegrationCheck automations so each renders as its own card in the integrations UI.

Before After
sanitized_inputs — "Sanitized Inputs & Code Scanning" (1 card, 2 sub-checks per repo) input_validation — "Input Validation"
code_scanning — "Code Scanning"

What changed

  • New packages/integration-platform/src/manifests/github/checks/input-validation.ts — scans package.json / requirements.txt / pyproject.toml / composer.json for validation libraries (zod, yup, joi, valibot, pydantic, etc.).
  • New packages/integration-platform/src/manifests/github/checks/code-scanning.ts — detects CodeQL default setup, custom CodeQL workflows, and third-party SARIF uploaders.
  • New validation-libraries.ts and code-scanning-detector.ts — small extracted modules so each check stays under the 300-line limit.
  • Deleted sanitized-inputs.ts (the original combined file).
  • Updated github/checks/index.ts and github/index.ts registrations.

Behavior preservation

  • Both new checks keep taskMapping: TASK_TEMPLATES.sanitizedInputs. The runner (run-task-integration-checks.ts) aggregates pass/fail across all checks per task — so the task auto-completes only when both checks pass for every repo, identical to the previous combined behavior.
  • All detection logic (regex patterns, GHAS fallback, monorepo tree walk) is moved verbatim — no rule changes.
  • Pass/fail messages and evidence shapes are unchanged for each sub-check.

Migration notes

  • Existing IntegrationCheckRun records for sanitized_inputs become historical only; new runs use the new check IDs.
  • Per-task disable preferences in IntegrationConnection.metadata.disabledTaskChecks that listed sanitized_inputs are no longer applied — users will need to re-disable individual checks if desired (acceptable, since they're now finer-grained).

Test plan

  • Connect a GitHub integration and confirm two separate automation cards (Input Validation and Code Scanning) appear, each rendering its own pass/fail per selected repo.
  • Verify the "Sanitized Inputs" task auto-completes only when both automations pass across all repos.
  • Confirm the existing detection results match: a repo with zod + CodeQL passes both; a repo with neither fails both.
  • bun run --filter '@trycompai/integration-platform' typecheck && build clean (verified locally).

🤖 Generated with Claude Code


Summary by cubic

Split the combined GitHub “Sanitized Inputs & Code Scanning” check into two cards by keeping sanitized_inputs for input validation and adding code_scanning for CodeQL/SARIF detection. The “Sanitized Inputs” task still completes only when both checks pass across all repos.

  • New Features

    • Added code_scanning (detects CodeQL default setup, custom workflows, and third-party SARIF uploaders).
    • Updated sanitized_inputs to only scan for validation libraries in package.json, requirements.txt, pyproject.toml, and composer.json.
    • Registered both checks; both map to TASK_TEMPLATES.sanitizedInputs.
  • Migration

    • No migration needed: existing sanitized_inputs run records and disabledTaskChecks entries continue to work.
    • To disable scanning separately, disable code_scanning.

Written for commit 07739f8. Summary will update on new commits. Review in cubic

…mations

Splits the combined "Sanitized Inputs & Code Scanning" GitHub check into
two separate IntegrationChecks so each renders as its own card in the
integrations UI:

- input_validation - "Input Validation" - scans for validation libraries
  in package.json / requirements.txt / pyproject.toml / composer.json
- code_scanning - "Code Scanning" - detects CodeQL default setup,
  custom CodeQL workflows, or third-party SARIF uploaders

Both checks remain mapped to the existing sanitizedInputs task template;
the runner aggregates pass/fail across checks per task, so auto-completion
behavior is preserved (task only completes when both pass for every repo).

Detection logic is unchanged - the JS/PY/PHP package catalogs and the
CodeQL detection flow (default-setup API + workflow file fallback) move
verbatim into the new files. Shared catalogs are extracted to
validation-libraries.ts; CodeQL detection helpers are extracted to
code-scanning-detector.ts to keep each file under the 300-line limit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Apr 27, 2026 4:19pm
comp-framework-editor Ready Ready Preview, Comment Apr 27, 2026 4:19pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Apr 27, 2026 4:19pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 7 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/integration-platform/src/manifests/github/checks/code-scanning.ts">

<violation number="1" location="packages/integration-platform/src/manifests/github/checks/code-scanning.ts:60">
P2: A truncated repository tree is treated as a complete scan, which can produce false `not-configured` failures for repos that actually have code-scanning workflows.</violation>
</file>

<file name="packages/integration-platform/src/manifests/github/checks/input-validation.ts">

<violation number="1" location="packages/integration-platform/src/manifests/github/checks/input-validation.ts:219">
P1: Do not silently skip repositories when `/repos/{owner}/{repo}` fetch fails; this can incorrectly mark the check as successful without evaluating all selected repos.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

…ode-scanning

Reverts the previous split structure to a more conservative approach:
keep sanitized-inputs.ts (and its check id 'sanitized_inputs') and just
strip the code-scanning logic out of it. Code scanning becomes a single
new self-contained file (code-scanning.ts).

This preserves continuity for existing customers:
- IntegrationCheckRun records under 'sanitized_inputs' continue to be
  the same automation
- IntegrationConnection.metadata.disabledTaskChecks entries that
  reference 'sanitized_inputs' remain valid

Removes the helper modules (input-validation.ts, validation-libraries.ts,
code-scanning-detector.ts) introduced in the previous commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 6 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/integration-platform/src/manifests/github/checks/code-scanning.ts">

<violation number="1" location="packages/integration-platform/src/manifests/github/checks/code-scanning.ts:190">
P1: Private repos can be incorrectly marked as code-scanning enabled when GHAS is not enabled, because workflow detection returns `enabled` before the `ghas-required` branch.</violation>
</file>

<file name="packages/integration-platform/src/manifests/github/checks/sanitized-inputs.ts">

<violation number="1" location="packages/integration-platform/src/manifests/github/checks/sanitized-inputs.ts:79">
P2: The input-validation automation is still using the legacy `sanitized_inputs` ID/name. This prevents a clean split into distinct `input_validation` and `code_scanning` check identities.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.

@@ -109,9 +77,9 @@ const getFileName = (path: string): string => {

export const sanitizedInputsCheck: IntegrationCheck = {
id: 'sanitized_inputs',
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Apr 27, 2026

Choose a reason for hiding this comment

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

P2: The input-validation automation is still using the legacy sanitized_inputs ID/name. This prevents a clean split into distinct input_validation and code_scanning check identities.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/integration-platform/src/manifests/github/checks/sanitized-inputs.ts, line 79:

<comment>The input-validation automation is still using the legacy `sanitized_inputs` ID/name. This prevents a clean split into distinct `input_validation` and `code_scanning` check identities.</comment>

<file context>
@@ -43,88 +75,9 @@ const getFileName = (path: string): string => {
-  id: 'input_validation',
-  name: 'Input Validation',
+export const sanitizedInputsCheck: IntegrationCheck = {
+  id: 'sanitized_inputs',
+  name: 'Sanitized Inputs',
   description:
</file context>
Fix with Cubic

@tofikwest tofikwest merged commit 413088b into main Apr 27, 2026
11 checks passed
@tofikwest tofikwest deleted the feat/split-sanitized-inputs-check branch April 27, 2026 16:32
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.34.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants