Skip to content

security: Harden CI/CD and repo for open-source safety#458

Merged
davila7 merged 3 commits into
mainfrom
security/opensource-hardening
Mar 26, 2026
Merged

security: Harden CI/CD and repo for open-source safety#458
davila7 merged 3 commits into
mainfrom
security/opensource-hardening

Conversation

@davila7
Copy link
Copy Markdown
Owner

@davila7 davila7 commented Mar 26, 2026

Summary

  • --ignore-scripts added to all npm ci/npm install in CI workflows and predeploy script to prevent malicious postinstall scripts
  • Shell injection fix in discord-release-notification.yml — all GitHub event data now passes through env: vars, payload built with jq -n
  • Explicit permissions on all workflows following least-privilege principle (permissions: {}, contents: read, etc.)
  • Root .npmrc with ignore-scripts=true as default for contributors
  • .github/dependabot.yml for automated npm + GitHub Actions dependency updates
  • .github/CODEOWNERS protecting .github/, scripts/, API endpoints
  • .gitignore expanded with *.pem, *.key, credentials.json, service-account*.json

Test plan

  • Verify deploy.yml still deploys correctly (no npm install step affected)
  • Verify update-json-data.yml cron run succeeds with --ignore-scripts
  • Verify component-security-validation.yml can still comment on PRs with new permissions
  • Confirm Dependabot starts creating PRs after merge
  • Confirm CODEOWNERS requires review on protected paths

Summary by cubic

Strengthens CI/CD to reduce supply‑chain and injection risks, and refines the prompt-engineer component for clearer, safer use. Areas affected: components (cli-tool/components/) and CI workflows (.github/workflows/).

  • CI hardening: add --ignore-scripts across installs; safe Discord payload via env + jq; explicit least‑privilege permissions (incl. contents: read in deploy so checkout works); root .npmrc with ignore-scripts=true.
  • Repo hygiene: Dependabot for npm/Actions; CODEOWNERS for sensitive paths; expanded .gitignore for keys/creds.
  • Components: tighten prompt-engineer (clearer description; fixed Ordering + 1–5 Necessity; add XML/CoT checks; tools set to Read; add invocation + worked example; set model sonnet; stricter output rules).
  • Env/secrets: no new variables or secrets; reuses DISCORD_WEBHOOK_URL. No new components; catalog (docs/components.json) does not need regeneration.

Written for commit cead64b. Summary will update on new commits.

davila7 added 2 commits March 26, 2026 09:17
- Fix broken reasoning framework: complete Ordering field and Necessity scale
- Remove OpenAI attribution from description; add invocation example block
- Restrict tools to Read only (text-transformation agent needs no writes)
- Add XML Structure and CoT Opportunity dimensions to reasoning template
- Move meta-instruction NOTE out of output template, place as agent directive
- Fix stray markdown bold markers on Reasoning Before Conclusions guideline
- Integrate orphaned examples bullet into the Examples guideline line
- Add concrete worked example section (classify customer feedback)

Automated review cycle | Co-Authored-By: Claude Code <noreply@anthropic.com>
- Add --ignore-scripts to all npm ci/install in CI workflows and predeploy script
- Fix shell injection in discord-release-notification (use env vars + jq for payload)
- Add explicit permissions to all workflows (least privilege principle)
- Add root .npmrc with ignore-scripts=true
- Add .github/dependabot.yml for automated dependency security updates
- Add .github/CODEOWNERS to protect workflows, scripts, and API paths
- Expand .gitignore with *.pem, *.key, credentials.json patterns
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 26, 2026

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

Project Deployment Actions Updated (UTC)
aitmpl-dashboard Ready Ready Preview, Comment Mar 26, 2026 11:18pm
claude-code-templates Ready Ready Preview, Comment Mar 26, 2026 11:18pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Security Audit Report

Status: ❌ FAILED

Metric Count
Total Components 753
✅ Passed 360
❌ Failed 393
⚠️ Warnings 999

❌ Failed Components (Top 5)

Component Errors Warnings Score
vercel-edge-function 3 4 81/100
prompt-engineer 2 0 90/100
neon-expert 2 2 88/100
agent-overview 2 1 89/100
unused-code-cleaner 2 1 89/100

...and 388 more failed component(s)


📊 View Full Report for detailed error messages and all components

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 11 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="cli-tool/components/agents/data-ai/prompt-engineer.md">

<violation number="1" location="cli-tool/components/agents/data-ai/prompt-engineer.md:111">
P3: The example uses a fenced code block even though the guidelines now prohibit code blocks. This creates conflicting instructions and may lead the agent to emit code fences despite the rule.</violation>
</file>

<file name=".github/workflows/deploy.yml">

<violation number="1" location=".github/workflows/deploy.yml:9">
P2: `permissions: {}` removes repo access, so `actions/checkout` won't be able to read repository contents and the workflow will fail. Grant at least `contents: read` at the workflow level.</violation>
</file>

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

Comment thread .github/workflows/deploy.yml Outdated
Comment on lines +111 to +124
```
<reasoning>
- Simple Change: (no)
- Reasoning: (no)
- Structure: (no)
- Examples: (no)
- Complexity: (1) Task: (2) Necessity: (2) prompt lacks any schema or label definition
- XML Structure: (yes) wrapping the feedback input in <feedback> tags reduces ambiguity
- CoT Opportunity: (no) classification is direct enough without chain of thought
- Specificity: (1)
- Prioritization: [Specificity, Structure, Output Format]
- Conclusion: Define the label set, specify the input format, and require JSON output.
</reasoning>
```
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot Mar 26, 2026

Choose a reason for hiding this comment

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

P3: The example uses a fenced code block even though the guidelines now prohibit code blocks. This creates conflicting instructions and may lead the agent to emit code fences despite the rule.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At cli-tool/components/agents/data-ai/prompt-engineer.md, line 111:

<comment>The example uses a fenced code block even though the guidelines now prohibit code blocks. This creates conflicting instructions and may lead the agent to emit code fences despite the rule.</comment>

<file context>
@@ -65,10 +94,49 @@ The final prompt you output should adhere to the following structure below. Do n
+
+**Reasoning block:**
+
+```
+<reasoning>
+- Simple Change: (no)
</file context>
Suggested change
```
<reasoning>
- Simple Change: (no)
- Reasoning: (no)
- Structure: (no)
- Examples: (no)
- Complexity: (1) Task: (2) Necessity: (2) prompt lacks any schema or label definition
- XML Structure: (yes) wrapping the feedback input in <feedback> tags reduces ambiguity
- CoT Opportunity: (no) classification is direct enough without chain of thought
- Specificity: (1)
- Prioritization: [Specificity, Structure, Output Format]
- Conclusion: Define the label set, specify the input format, and require JSON output.
</reasoning>
```
<reasoning>
- Simple Change: (no)
- Reasoning: (no)
- Structure: (no)
- Examples: (no)
- Complexity: (1) Task: (2) Necessity: (2) prompt lacks any schema or label definition
- XML Structure: (yes) wrapping the feedback input in <feedback> tags reduces ambiguity
- CoT Opportunity: (no) classification is direct enough without chain of thought
- Specificity: (1)
- Prioritization: [Specificity, Structure, Output Format]
- Conclusion: Define the label set, specify the input format, and require JSON output.
</reasoning>
Fix with Cubic

Cubic correctly flagged that permissions: {} blocks actions/checkout.
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Security Audit Report

Status: ❌ FAILED

Metric Count
Total Components 755
✅ Passed 360
❌ Failed 395
⚠️ Warnings 999

❌ Failed Components (Top 5)

Component Errors Warnings Score
vercel-edge-function 3 4 81/100
prompt-engineer 2 0 90/100
neon-expert 2 2 88/100
agent-overview 2 1 89/100
unused-code-cleaner 2 1 89/100

...and 390 more failed component(s)


📊 View Full Report for detailed error messages and all components

@davila7 davila7 merged commit 0e06493 into main Mar 26, 2026
5 checks passed
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.

1 participant