This paper studies the optimal asset allocation problem of a defined contribution (DC) pension plan with a stochastic salary and value under a constraint within a stochastic volatility model. It is assumed that the financial market contains a risk-free asset and a risky asset whose price process satisfies the Stein–Stein stochastic volatility model. To comply with regulatory standards and offer a risk management tool, we integrate the dynamic versions of Value-at-Risk (VaR), Conditional Value-at-Risk (CVaR), and worst-case CVaR (wcCVaR) constraints into the DC pension fund management model. The salary is assumed to be stochastic and characterized by geometric Brownian motion. In the dynamic setting, a CVaR/wcCVaR constraint is equivalent to a VaR constraint under a higher confidence level. By using the Lagrange multiplier method and the dynamic programming method to maximize the constant absolute risk aversion (CARA) utility of terminal wealth, we obtain closed-form expressions of optimal investment strategies with and without a VaR constraint. Several numerical examples are provided to illustrate the impact of a dynamic VaR/CVaR/wcCVaR constraint and other parameters on the optimal strategy.