Code Security & QA
November 17, 2026
12 min read
Pre-Deployment Code Auditing: SAST Tools, Workflows, and Checklists
#SAST#SonarQube#Code Quality#Cybersecurity#DevSecOps#CI/CD#Clean Code
Fixing a vulnerability or critical bug after deployment takes considerably more time and effort than resolving it during development. Pre-deployment auditing is an integral part of modern software engineering.
This guide outlines the four layers of code defense, common tooling, and a quick verification checklist.
1. Why inspect code before deployment?
- Prevent common security flaws like SQL injection, cross-site scripting (XSS), and broken access controls.
- Keep technical debt low so the codebase remains maintainable over time.
- Stop private API keys, connection strings, and tokens from being committed to Git.
- Catch runtime issues and build breakages before users encounter them.
2. Four layers of code defense
Layer 1: Local type checking and linting
- TypeScript: strict mode catches data contract discrepancies at compile time.
- ESLint: flags risky patterns such as missing effect dependencies, dead code, or unhandled promises.
- Prettier: standardizes formatting across team members so code reviews focus on logic rather than style.
Layer 2: Pre-commit git hooks
- Tools like Husky and lint-staged run automated checks before any commit is finalized.
- If type checks or lint rules fail, the commit is halted until the issue is addressed locally.
Layer 3: Static Application Security Testing (SAST)
SAST analyzes source code without executing runtime binaries:
- SonarQube: evaluates security vulnerabilities, reliability bugs, and maintainability metrics. Teams can enforce a Quality Gate (Grade A) to block non-compliant pull requests.
- Snyk: scans application code alongside Software Composition Analysis (SCA) for third-party libraries.
Layer 4: Secret scanning and dependency audits
- GitLeaks: checks diffs for high-entropy strings, passwords, and private tokens.
- npm audit: inspects dependencies against published CVE advisories.
3. Essential tooling matrix
- SAST and code quality: SonarQube and Snyk for static analysis and quality tracking.
- Secret scanning: GitLeaks or Secretlint for preventing credential leaks.
- Dependency audits: npm audit or Dependabot for dependency maintenance.
- Input validation: Zod or Pydantic for schema verification on all external inputs.
- CI automation: GitHub Actions or GitLab CI to run these checks on every pull request.
4. Verification sequence before git push
- Type check: run npx tsc --noEmit to confirm clean types.
- Lint check: run npm run lint to catch unused variables and code issues.
- Build check: run npm run build to verify that static and dynamic pages bundle correctly.
- Diff review: review git diff for stray debug logs or sensitive variables.
- CI check: confirm that continuous integration checks pass before merging into the main branch.
AH
Ahmed Humran
Senior Full-Stack & Odoo ERP Developer