Skip to content

fix: replace hardcoded DB password in project template config#166

Open
saaa99999999 wants to merge 1 commit into
go-kratos:mainfrom
saaa99999999:fix/default-hardcoded-db-creds
Open

fix: replace hardcoded DB password in project template config#166
saaa99999999 wants to merge 1 commit into
go-kratos:mainfrom
saaa99999999:fix/default-hardcoded-db-creds

Conversation

@saaa99999999

@saaa99999999 saaa99999999 commented May 23, 2026

Copy link
Copy Markdown

Summary

The project template config ships with a hardcoded MySQL root password. Every project created with kratos new inherits these credentials.

What was there

configs/config.yaml — the template checked into the repo:

data:
  database:
    driver: mysql
    source: root:root@tcp(127.0.0.1:3306)/test?parseTime=true&loc=Local

root:root is embedded in the DSN string. New projects start with these credentials unless the developer explicitly overwrites them.

What changed

Replaced with an env var placeholder:

data:
  database:
    driver: mysql
    source: ${DB_DSN:root@tcp(127.0.0.1:3306)/test?parseTime=true&loc=Local}

The host/port/db defaults are preserved but the password is no longer hardcoded in the template.

See also: CWE-798

- configs/config.yaml: replaced hardcoded "root:root" MySQL credentials with
  ${DB_DSN} placeholder

This is the official Kratos project template used by every new Kratos project.
The default config contains a hardcoded database password that new projects
inherit unless explicitly changed.
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant