Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why the global variables are simply recorded in the compiled binary? #19121

Closed
dongweigogo opened this issue Feb 16, 2017 · 2 comments
Closed

Comments

@dongweigogo
Copy link

go1.7, linux amd64

I set global variables for the username and the password.
var user="AnyUserIsOk"

var passwd="AnyWordIsOk"

func main() {

...  

}
When I compiled the code, the two strings appear in the binary file.

Value addr= code= ctxt: curg= m->p= p->m= varp=, not 390625<-chanGOROOTSCHED SignalString[]byte typeschan<-efenceerrno etypeshangupkilledAnyUserIsOkobjectsignalsinglestatusstringstructsweep systemuint16uint32uint64 (scan (scan) MB in Value> dying= locks= m->g0= nfree= s=nil
(PANIC=, goid=, sys: 19531259765625AnyWordIsOkChanDirGODEBUGSignal defer value=abortedcs float32float64fs gctracego1.7.4gs invalidpanic: r10 r11 r12 r13 r14 r15 r8 r9 rax rbp rbx rcx rdi rdx reflectrflags rip rsi rsp runningruntimesignal stoppedsyscalluintptrunknownwaiting goalÎ<94>= helpgc= is not mcount= minutes nalloc= newval= nfreed= packed= pointer stack=[, found , idle: 48828125NumFieldZONEINFO[signal

I think that is not good, at least not safe. Is there anyway to avoid this recording behavior?

@ALTree
Copy link
Member

ALTree commented Feb 16, 2017

Is there anyway to avoid this recording behavior?

Yes: don't put secrets in the source code of your program.

@ALTree
Copy link
Member

ALTree commented Feb 16, 2017

If you have further questions, please ask in one of the places listed here: https://github.com/golang/go/wiki/Questions; we only use the issue tracker for bugs and proposal.

@ALTree ALTree closed this as completed Feb 16, 2017
@golang golang locked and limited conversation to collaborators Feb 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants