-
Notifications
You must be signed in to change notification settings - Fork 14
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
Chore: Enable gosec #140
Chore: Enable gosec #140
Conversation
a318890
to
5f75152
Compare
5f75152
to
1a88449
Compare
} | ||
return nil | ||
} | ||
|
||
func (mt *MailTemplate) getText(path string, variables map[string]string) (string, error) { | ||
f, err := os.Open(path) | ||
f, err := templates.FS.Open(path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that this will embed templates. Not sure if it was planned to allow the user to override the templates at some point. But if we talk about cloud native, we might want to bring this into some kind of specialized bucket in the future anyways so it can be edited online. And embed the defaults so it can be populated and/or reset.
But this was the easiest way (other than ignoring) to keep gosec happy. Gosec triggers because you may give ..
in this path string
, breaking out of the expected "root". One way to fix this is to use path.Join(root, path.Clean(path))
such that it's anchored to root
, or the other is to give a virtual FS like done now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree about having the templates editable only, what about like exposing them to some great headless CMS like "Sanity".
1a88449
to
1667c7a
Compare
port, err := strconv.Atoi(os.Getenv("PORT")) | ||
if err != nil { | ||
panic(err) | ||
} | ||
config = &Config{ | ||
Port: port, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In go, ports are technically not limited to an int
(and beyond go). It's also perfectly valid to say :http
or other standardized names. At least I think this is the case, although I never tried it.
dbcbf10
to
67ee0ff
Compare
67ee0ff
to
d9d449b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@loboda4450 we still let something slip through 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eh, that's embarrassing....
Enable the gosec linter to get security related mistakes. It can be a bit prone to false positives, but at least will give us the opportunity to think about our choices.