I. Overview

%%{init: { 'theme': 'base', 'themeVariables': { 'edgeLabelBackground': '#fff' }}}%%
flowchart LR
    A["Source code vulnerabilities"] -- "SAST / DAST /\nSecure Coding" --> B["Sound, defect-free\nsoftware"]
    style A fill:#f9f9f9,stroke:#333,stroke-width:3px
    style B fill:#e1f5fe,stroke:#01579b,stroke-width:3px

Definition: Code security is the practice of analyzing the security weaknesses that can arise during software development and applying safe coding standards to build software free of vulnerabilities.

Features:
( Cost Reduction ) Removing security weaknesses at the early development stage minimizes the cost of fixing them after release.
( Proactive Defense ) Preemptively blocks well-known major vulnerabilities and attack techniques such as the OWASP Top 10.
( Software Trustworthiness ) Builds security into the software itself through adherence to safe coding standards.

II. Mechanism & Components

A. Analysis Architecture: SAST vs. DAST

flowchart LR
    A["Source code / binary"] --> B["SAST\n(Static Analysis)"]
    B --> C["Security weakness report\n(pre-execution)"]

    D["Running application\n(Staging / Prod)"] --> E["DAST\n(Dynamic Analysis)"]
    E --> F["Vulnerability report\n(runtime)"]

Key Point: The two approaches are distinguished as the white-box method (SAST), which analyzes source code directly, and the black-box method (DAST), which attempts attacks against a live, running system.

B. SAST vs. DAST Key Comparison

ComparisonStatic Analysis (SAST)Dynamic Analysis (DAST)
Analysis TargetSource code, binary (pre-execution)Running application (during execution)
Analysis MethodWhite-boxBlack-box
TimingDevelopment (Implementation) stageTesting/Production (Staging/Prod) stage
DetectsSyntax errors, secure-coding violations, logic errorsRuntime vulnerabilities, authentication errors, session management flaws
AdvantagesEarly detection (Shift-Left), root-cause identificationVerification against a real attack environment, low false-positive rate
DisadvantagesHigh false-positive rate, requires a buildCannot pinpoint location in source code, remediation happens after the fact

III. Advanced Topics & Comparison

Secure Coding Guidelines (the 7 Self-Assessment Categories from Korea’s Ministry of the Interior and Safety)

The software security weakness diagnosis guide published by Korea’s Ministry of the Interior and Safety is organized around the following 7 areas.

AreaKey Inspection ContentCountermeasure (Example)
1. Input Data Validation and RepresentationSQL injection, XSS, path manipulationUse Prepared Statements, filter input values
2. Security FeaturesAuthentication/authorization weaknesses, weak encryptionMulti-factor authentication (2FA), strong hash algorithms (SHA-256+)
3. Time and StateRace conditions, non-terminating loopsSynchronize shared resources, ensure proper resource release
4. Error HandlingSystem information exposure, improper exception handlingApply custom error pages, hide detailed logs
5. Code ErrorsNull pointer dereference, improper resource releaseAdd null checks, close resources in finally blocks
6. EncapsulationDebug code left in place, information exposurePrevent system information exposure, avoid public fields
7. API MisuseInsecure API calls, use of unsafe functionsUse recommended standard libraries and APIs

Last updated 18 Aug 2026, 00:00 UTC. history