Skip to content

Conversation

@3MethNi
Copy link
Owner

@3MethNi 3MethNi commented Jun 20, 2025

Why:

Closes:

What's being changed (if available, include any code snippets, screenshots, or gifs):

Check off the following:

  • A subject matter expert (SME) has reviewed the technical accuracy of the content in this PR. In most cases, the author can be the SME. Open source contributions may require an SME review from GitHub staff.
  • The changes in this PR meet the docs fundamentals that are required for all content.
  • All CI checks are passing and the changes look good in the review environment.

Upgraded V2 : VVIP Audit - CI/CD & Automated Security Certification

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

env:

กำหนดค่ากลางสำหรับทุกคลาวด์

GCP_PROJECT_ID: your-gcp-project-id
AWS_REGION: ap-southeast-1
AZURE_APP_NAME: vvip-audit-app
IMAGE_NAME: vvip-audit # ชื่อ Image กลาง

jobs:

--- Job 1: ตรวจสอบคุณภาพโค้ดพื้นฐาน ---

lint:
name: Lint Code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint code
run: npm run lint

--- Job 2: ประตูรักษาความปลอดภัยและออกใบรับรองอัตโนมัติ ---

security-audit:
name: Automated Security Certification
needs: lint
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v4

  - name: Run CodeQL Analysis (SAST)
    uses: github/codeql-action/analyze@v3
    with:
      language: 'javascript'

  - name: Run Snyk to check for vulnerabilities (SCA)
    uses: snyk/actions/node@master
    continue-on-error: true # ตั้งเป็น true เพื่อให้เห็นรายงาน แต่ไม่หยุด pipeline ทันที (ปรับเปลี่ยนได้)
    env:
      SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
    with:
      command: 'monitor'

  - name: Run TruffleHog to find secrets
    uses: trufflesecurity/trufflehog@main
    with:
      path:./
      base: ${{ github.event.before }}
      head: HEAD
      extra_args: --only-verified

--- Job 3: สร้างและสแกน Docker Image ---

build-and-push:
name: Build, Scan, and Push Docker Image
needs: security-audit
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4

  - name: Set up Docker Buildx
    uses: docker/setup-buildx-action@v3

  - name: Build Docker image
    id: docker_build
    uses: docker/build-push-action@v5
    with:
      context:.
      push: false # ยังไม่ push
      load: true # โหลด image เข้าสู่ runner เพื่อสแกน
      tags: ${{ env.IMAGE_NAME }}:${{ github.sha }}

  - name: Scan image for vulnerabilities with Trivy
    uses: aquasecurity/trivy-action@master
    with:
      image-ref: '${{ env.IMAGE_NAME }}:${{ github.sha }}'
      format: 'table'
      exit-code: '1' # ทำให้ pipeline fail หากพบช่องโหว่ระดับ CRITICAL
      ignore-unfixed: true
      vuln-type: 'os,library'
      severity: 'CRITICAL,HIGH'

  # (ส่วนของการ Login และ Push ไปยัง Registries ต่างๆ จะอยู่ตรงนี้)
  #... (นำโค้ดจากเวอร์ชันก่อนหน้ามาใส่)...
  # หลังจากสแกนผ่านแล้วจึงทำการ Push

--- Job 4: ปรับใช้ (Upload) สู่คลาวด์ ---

deploy:
name: Deploy to Cloud
needs: build-and-push
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
#... (ส่วนที่เหลือของ Job deploy เหมือนเดิม)...

git init
git add .
git commit -m "Initial VVIP Security Audit Project"
git remote add origin https://github.com/USERNAME/REPO.git
git branch -M main
git push -u origin main

docs-bot and others added 30 commits June 10, 2025 17:46
Co-authored-by: Chuan-kai Lin <[email protected]>
Co-authored-by: Copilot <[email protected]>
…6023)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: felicitymay <[email protected]>
Co-authored-by: Felicity Chapman <[email protected]>
Co-authored-by: nhu-do <[email protected]>
… to handle Copilot-authored PRs"""" (#56024)
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Tadas Labudis <[email protected]>
Co-authored-by: Ben Ahmady <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Sunbrye Ly <[email protected]>
Co-authored-by: sunbrye <[email protected]>
Co-authored-by: Jules Porter <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Adam Holt <[email protected]>
Co-authored-by: Sarita Iyer <[email protected]>
Co-authored-by: Sam Morrow <[email protected]>
Co-authored-by: Jules Porter <[email protected]>
Co-authored-by: Jules <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Adam Holt <[email protected]>
Co-authored-by: Sam Morrow <[email protected]>
Co-authored-by: Sunbrye Ly <[email protected]>
…(#56028)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
sophietheking and others added 28 commits June 19, 2025 13:30
… agent [Public Preview] (#56002)

Co-authored-by: hubwriter <[email protected]>
…be to 20250619-223112-g14de19c1f in the baseimages group (#56195)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#56014)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: am-stead <[email protected]>
Co-authored-by: elbrenn <[email protected]>
@3MethNi 3MethNi merged commit 4424ed3 into 3MethNi:main Jun 21, 2025
3 checks passed
Repository owner locked as spam and limited conversation to collaborators Jun 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.