मुख्य सामग्री पर जाएँ
Skillpedia
टेस्टिंग35k · #8150

integrating-sast-into-github-actions-pipeline

यह क्या करती है

यह टूल GitHub पर आपके कोड में अपने आप सुरक्षा जाँच जोड़ देता है। कोड मंज़ूर होने से पहले यह आम कमज़ोरियाँ और गलतियाँ ढूँढता है, जिससे आपका प्रोजेक्ट सुरक्षित रहता है।

कब इस्तेमाल करें

  • ✓अपनी डेवलपमेंट प्रक्रिया में अपने आप कमज़ोरी पहचान जोड़ने के लिए।
  • ✓यह पक्का करने के लिए कि सभी प्रोजेक्ट एक जैसे सुरक्षा नियम मानें।
  • ✓जब SOC 2 या PCI DSS जैसे सुरक्षा मानकों के पालन का सबूत देना हो।

Skill का लिंक

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/integrating-sast-into-github-actions-pipeline/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/integrating-sast-into-github-actions-pipeline/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरे प्रोजेक्ट के लिए अपने आप सुरक्षा स्कैनिंग सेट करो।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह टूल दो मुख्य तकनीकों (CodeQL और Semgrep) का इस्तेमाल करता है, जो आपके कोड को ज्ञात समस्याओं के लिए जाँचती हैं। गंभीर समस्या वाला कोड आपकी मुख्य कोडबेस में merge होने से यह रोक सकता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Integrating SAST into GitHub Actions Pipeline

When to Use

  • When development teams need automated code-level vulnerability detection on every pull request
  • When security teams require consistent SAST enforcement across all repositories in an organization
  • When migrating from manual or periodic security reviews to continuous security testing
  • When compliance frameworks (SOC 2, PCI DSS, NIST SSDF) require evidence of automated code analysis
  • When multiple languages coexist in a monorepo and need unified scanning under one workflow

Do not use for runtime vulnerability detection (use DAST instead), for scanning third-party dependencies (use SCA tools like Snyk), or for infrastructure-as-code scanning (use Checkov or tfsec).

Prerequisites

  • GitHub repository with GitHub Actions enabled
  • GitHub Advanced Security license (required for CodeQL on private repos; free for public repos)
  • Semgrep account for managed rules and Semgrep App dashboard (free tier available)
  • Repository code in a supported language: Python, JavaScript/TypeScript, Java, C/C++, C#, Go, Ruby, Swift, Kotlin

Workflow

Step 1: Configure CodeQL Analysis Workflow

Create a CodeQL workflow that runs on pull requests and on a weekly schedule to catch vulnerabilities in existing code.

# .github/workflows/codeql-analysis.yml
name: "CodeQL Analysis"

on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]
  schedule:
    - cron: '30 2 * * 1'  # Weekly Monday 2:30 AM

jobs:
  analyze:
    name: Analyze (${{ matrix.language }})
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        language: ['javascript', 'python']

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Initialize CodeQL
        uses: github/codeql-action/init@v3
        with:
          languages: ${{ matrix.language }}
          queries: security-extended,security-and-quality

      - name: Autobuild
        uses: github/codeql-action/autobuild@v3

      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v3
        with:
          category: "/language:${{ matrix.language }}"

Step 2: Add Semgrep Scanning for Custom Rules

Semgrep complements CodeQL with faster scans and support for custom pattern-based rules. Configure it to upload SARIF results to the same GitHub Security tab.

# .github/workflows/semgrep.yml
name: "Semgrep SAST Scan"

on:
  pull_request:
    branches: [main, develop]
  push:
    branches: [main]

jobs:
  semgrep:
    name: Semgrep Scan
    runs-on: ubuntu-latest
    permissions:
      security-events: write
      contents: read

    container:
      image: semgrep/semgrep:latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Run Semgrep
        run: |
          semgrep ci \
            --config auto \
            --config p/owasp-top-ten \
            --config p/cwe-top-25 \
            --sarif --output semgrep-results.sarif \
            --severity ERROR \
            --error
        env:
          SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }}

      - name: Upload SARIF
        if: always()
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: semgrep-results.sarif
          category: semgrep

Step 3: Create Custom Semgrep Rules for Organization Patterns

Write organization-specific rules to catch patterns unique to your codebase, such as deprecated internal APIs or insecure configuration patterns.

# .semgrep/custom-rules.yml
rules:
  - id: hardcoded-database-url
    patterns:
      - pattern: |
          $DB_URL = "...$PROTO://...:...$PASS@..."
    message: |
      Hardcoded database connection string with credentials detected.
      Use environment variables or a secrets manager instead.
    languages: [python, javascript, typescript]
    severity: ERROR
    metadata:
      cwe: "CWE-798: Use of Hard-coded Credentials"
      owasp: "A07:2021 - Identification and Authentication Failures"

  - id: unsafe-deserialization
    patterns:
      - pattern-either:
          - pattern: pickle.loads(...)
          - pattern: yaml.load(..., Loader=yaml.Loader)
          - pattern: yaml.load(..., Loader=yaml.FullLoader)
    message: |
      Unsafe deserialization detected. Use safe alternatives to prevent

…
अक्सर पूछे जाने वाले सवाल

'False positives' क्या होते हैं?

ये ऐसी सुरक्षा चेतावनियाँ हैं जो टूल बनाता है, पर जो असल में समस्या नहीं होतीं। आप टूल को इन चेतावनियों को अनदेखा करने के लिए सेट कर सकते हैं।

क्या इसके लिए पैसे देने होते हैं?

सार्वजनिक (public) प्रोजेक्ट के लिए CodeQL मुफ़्त है। निजी (private) प्रोजेक्ट के लिए GitHub Advanced Security लाइसेंस चाहिए। Semgrep का एक मुफ़्त प्लान भी है।

कौन सी प्रोग्रामिंग भाषाएँ सपोर्ट होती हैं?

Python, JavaScript/TypeScript, Java, C/C++, C#, Go, Ruby, Swift और Kotlin।

जानकारी

लेखक का मूल विवरण

Integrates CodeQL and Semgrep SAST scanning into GitHub Actions, covering scans on pull requests/pushes, rule tuning to cut false positives, SARIF upload to GitHub Advanced Security, and merge-blocking quality gates for high-severity findings. Use when adding automated code vulnerability detection to CI, enforcing consistent SAST org-wide, or producing SOC 2/PCI DSS/NIST SSDF compliance evidence.

repo: mukul975/Anthropic-Cybersecurity-Skills

लोकप्रियता

GitHub स्टार
35k
रैंकिंग में स्थान
#8150
लाइसेंस
Apache-2.0
अपडेट की गई
31/8/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills