mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Fix a number of potential security issues
This commit is contained in:
parent
b5bdaf3150
commit
7d8acf725d
@ -32,13 +32,8 @@ type Widget struct {
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
||||
apiKey := wtf.Config.UString(
|
||||
"wtf.mods.gitlab.apiKey",
|
||||
os.Getenv("WTF_GITLAB_TOKEN"),
|
||||
)
|
||||
|
||||
baseURL := wtf.Config.UString("wtf.mods.gitlab.domain")
|
||||
gitlab := glb.NewClient(nil, apiKey)
|
||||
gitlab := glb.NewClient(nil, apiKey())
|
||||
|
||||
if baseURL != "" {
|
||||
gitlab.SetBaseURL(baseURL)
|
||||
@ -92,6 +87,13 @@ func (widget *Widget) Prev() {
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func apiKey() string {
|
||||
return wtf.Config.UString(
|
||||
"wtf.mods.gitlab.apiKey",
|
||||
os.Getenv("WTF_GITLAB_TOKEN"),
|
||||
)
|
||||
}
|
||||
|
||||
func (widget *Widget) buildProjectCollection(projectData map[string]interface{}) []*GitlabProject {
|
||||
gitlabProjects := []*GitlabProject{}
|
||||
|
||||
|
@ -36,7 +36,7 @@ func Log(msg string) {
|
||||
return
|
||||
}
|
||||
|
||||
f, err := os.OpenFile(logFilePath(), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
f, err := os.OpenFile(logFilePath(), os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)
|
||||
if err != nil {
|
||||
log.Fatalf("error opening file: %v", err)
|
||||
}
|
||||
|
5
main.go
5
main.go
@ -130,7 +130,10 @@ func refreshAllWidgets() {
|
||||
}
|
||||
|
||||
func setTerm() {
|
||||
os.Setenv("TERM", Config.UString("wtf.term", os.Getenv("TERM")))
|
||||
err := os.Setenv("TERM", Config.UString("wtf.term", os.Getenv("TERM")))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func watchForConfigChanges(app *tview.Application, configFilePath string, grid *tview.Grid, pages *tview.Pages) {
|
||||
|
@ -13,8 +13,6 @@ import (
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
const APIEnvToken = "WTF_TRAVIS_API_TOKEN"
|
||||
|
||||
func BuildsFor() (*Builds, error) {
|
||||
builds := &Builds{}
|
||||
|
||||
@ -74,7 +72,7 @@ func travisRequest(path string) (*http.Response, error) {
|
||||
func apiToken() string {
|
||||
return wtf.Config.UString(
|
||||
"wtf.mods.travisci.apiKey",
|
||||
os.Getenv(APIEnvToken),
|
||||
os.Getenv("WTF_TRAVIS_API_TOKEN"),
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user