T09 · Insecure Skill Coding Practices
- Location
references/templates/appsettings.md:14- Finding
Predictable Placeholder JWT Signing Key Is Accepted at Runtime
- Content
View full analysis
{ options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secret)), ValidateIssuer = false, ValidateAudience = false, }; }); services.AddAuthorization(); return services; } ``` ### Technical Analysis The generated `appsettings.json` contains a public, deterministic placeholder that is used directly as the symmetric HS256 JWT signing key. Runtime validation only checks whether the setting is null; it does not reject the known placeholder or verify that the key came from an external secret provider. Because the placeholder is longer than 32 characters, it can also satisfy the template's `MinLength(32)` options validation. Consequently, a generated application may start successfully with this publicly known signing key if the operator forgets to override it. Anyone with access to the Skill template can reproduce the key and create JWTs with arbitrary identity claims. The generated controllers inherit `[Authorize]`, so a token signed with this ...[truncated 1379 chars]- Remediation
View remediation
