Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug] App passwords that start with "+" or "-0" are changed in the .env file

Aperta
#14,179 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@wanghe-fit2cloud ci sta già lavorando.

Dal 26/10/2026.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend

Direzione di ricerca

The bug is in agent/utils/env/env.go where Marshal and MarshalWithOrder write values with %d after strconv.Atoi parses them. Read those functions and change the logic so strings with a leading '+' or '-0' are emitted quoted. Done means the app .env shows PANEL_DB_ROOT_PASSWORD='+123456' unaltered.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: optimization
1Panel Version

Current dev-v2 (commit c4b76a8).

Problem Description

When you install an app or edit its parameters, 1Panel rewrites values that look like signed integers in the app's .env file. For example, the password +123456 is written as PANEL_DB_ROOT_PASSWORD=123456, and -0123 is written as -123. 1Panel still stores and shows the original value, but the container starts with the changed one, so you cannot log in with the password you entered.

This is the same problem as #4949, where values with a leading 0 lost their zeros. That case is fixed, but values with a leading + or with -0 still change.

Steps to Reproduce
  1. Install MySQL (or another app with a password parameter) from the app store.
  2. Set the root password to +123456.
  3. Open the app's .env file under /opt/1panel/apps/mysql/<name>/.env.
The expected correct result

PANEL_DB_ROOT_PASSWORD='+123456'

Related log output

PANEL_DB_ROOT_PASSWORD=123456

Additional Information

The cause is in agent/utils/env/env.go. Marshal and MarshalWithOrder write a value unquoted with %d whenever strconv.Atoi parses it, and Atoi accepts +123456 and -0123.

Lingua principale
Go
Stelle
37.3k
Fork
3.4k
Merge medio
10h 3m
PR unite (30g)
97

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di 1Panel-dev/1Panel

Tutte le issue di 1Panel-dev/1Panel

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.