Skip to Content
Hashsecured v1.0 is released 🎉
CI/CDGitlab CI/CD Workflow

GitLab Security Scan Workflow

This workflow runs all phases of security scanning using the unified hashsecured_scan template. Each phase is independent and targets a specific stage of your application lifecycle.


Pre-phase: Static Application Security Testing (SAST)

Analyzes source code for vulnerabilities, hardcoded secrets, and compliance issues before build/deployment.

stages: - security_scan include: - project: 'clockhash-kiran/security-templates' file: '/hashsecured_scan.yml' pre_phase_scan: extends: .hashsecured_scan variables: PHASE: "pre" TARGET_URL: "gitlab.com/your-org/your-repo-name" USER_ID: "YOUR_USER_ID" PROJECT_ID: "YOUR_PROJECT_ID" API_TOKEN: "$HASHSECURED_API_TOKEN" BRANCH: "master" #Optional BREAK: "true" #Optional TOOLS: "semgrep,gitleaks" #Optional

Mid-phase: Container Scan

Scans container images for vulnerabilities before deployment.

mid_phase_scan: extends: .hashsecured_scan variables: PHASE: "mid" TARGET_URL: "nginx:latest" USER_ID: "YOUR_USER_ID" PROJECT_ID: "YOUR_PROJECT_ID" API_TOKEN: "$HASHSECURED_API_TOKEN"

Post-phase: Deployment Scan

Performs security checks against live deployments.

post_phase_scan: extends: .hashsecured_scan variables: PHASE: "post" TARGET_URL: "https://example.com" USER_ID: "YOUR_USER_ID" PROJECT_ID: "YOUR_PROJECT_ID" API_TOKEN: "$HASHSECURED_API_TOKEN"

Optional Parameters

ParameterTypePhaseDescriptionDefault
breaktrue/falseAllFail the pipeline if HIGH/CRITICAL vulnerabilities are foundtrue
toolsstring (comma-separated)AllOverride default tools for the phaseUses default tools for phase
branchstringPre-phaseBranch to scan for SASTmain
patstringPre-phasePersonal Access Token for private reposNone