Andreas Gerstmayr
8b22481aec
User management: Use HMAC-SHA256 to generate time limit codes (password reset tokens) ( #42334 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: bergquist <carl.bergquist@gmail.com>
2022-08-18 16:01:09 +02:00
Jo
062d255124
Handle ioutil deprecations ( #53526 )
...
* replace ioutil.ReadFile -> os.ReadFile
* replace ioutil.ReadAll -> io.ReadAll
* replace ioutil.TempFile -> os.CreateTemp
* replace ioutil.NopCloser -> io.NopCloser
* replace ioutil.WriteFile -> os.WriteFile
* replace ioutil.TempDir -> os.MkdirTemp
* replace ioutil.Discard -> io.Discard
2022-08-10 15:37:51 +02:00
Matthew Jacobson
efa0d90093
Alerting: Fix Teams notifier not failing on 200 response with error ( #52254 )
...
Team's webhook API does not always use the status code to communicate errors.
There are cases where it returns 200 and an error message in the body.
For example, 429 - Too Many Requests or when the message is too large.
Instead, what we should be looking for is a response body = "1".
https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using?tabs=cURL#send-messages-using-curl-and-powershell
2022-07-14 13:15:18 -04:00
idafurjes
6c43eb0b4d
Split Create User ( #50502 )
...
* Split Create User
* Use new create user and User from package user
* Add service to wire
* Making create user work
* Replace user from user pkg
* One more
* Move Insert to orguser Service/Store
* Remove unnecessary conversion
* Cleaunp
* Fix Get User and add fakes
* Fixing get org id for user logic, adding fakes and other adjustments
* Add some tests for ourguser service and store
* Fix insert org logic
* Add comment about deprecation
* Fix after merge with main
* Move orguser service/store to org service/store
* Remove orguser from wire
* Unimplement new Create user and use User from pkg user
* Fix wire generation
* Fix lint
* Fix lint - use only User and CrateUserCommand from user pkg
* Remove User and CreateUserCommand from models
* Fix lint 2
2022-06-28 14:32:25 +02:00
Serge Zaitsev
ae9491c3a7
Chore: Make test tracer noop and return no errors ( #50797 )
2022-06-15 12:40:41 +02:00
Serge Zaitsev
0b55c41d05
Chore: Remove global bus variable ( #50765 )
...
* Chore: Remove global bus variable
* fix bus in tests
2022-06-14 16:07:41 +02:00
Kat Yang
31630edf0c
Chore: Remove Wrapf ( #50128 )
...
* Chore: Remove Wrapf
* Remove all Wrapf refs
* Remove last Wrapf ref
* Fix lint errors
* Remove Wrap and Wrapf definitions
* Remove unnecessary colon
2022-06-06 22:30:31 +02:00
Kristin Laemmert
bda3dd24e4
chore: remove golang.org/x/net/context in favor of stdlib ( #47532 )
...
This PR removes golang.org context imports under pkg/services/* and replaces them with the stdlib context.
Closes #44178
2022-04-11 08:46:21 -04:00
Serge Zaitsev
18e93c7077
Chore: Remove bus ( #47511 )
...
* Chore: Remove bus
* remove unused const
2022-04-08 16:15:06 +02:00
Santiago
4b1af6fb06
Fix empty contact point URLs when template parsing fails ( #47029 )
...
* fix empty URLs
* leave URL templating, use fallback
* better fix, new tests cases
* fix linting errors
2022-03-31 15:57:48 -03:00
Serge Zaitsev
4ce7978cd8
Chore: Remove bus from notification service ( #46813 )
...
* Chore: Remove bus from notification service
* fix signature
* fix function signature in tests
2022-03-22 09:04:30 +01:00
Alexander Weaver
703d7deeda
Alerting: Add integration tests for dual-stage email templating ( #43484 )
...
* Resolve merge conflicts
* Remove cruft from local exploration
* Move integration tests to intercept using new abstraction layer instead of channel
* Fix linter error after rebase
2022-03-01 10:49:49 -06:00
Kat Yang
f582e6c86a
Chore: Remove bus from password ( #44482 )
...
* Chore: Remove bus from password
* Refactor: Remove bus from password.go and adjust tests
* remove sqlstore dependency from notifications
* Chore: Remove bus from password
* Refactor: Remove bus from password.go and adjust tests
* remove sqlstore dependency (again)
* remove fmt printf
* fix dependencies in http server
* fix renamed method in tests
Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
2022-02-03 10:33:46 +01:00
idafurjes
12420260ef
Remove bus from org invite api ( #44530 )
...
* Remove bus from org invite api
* Fix lint
* Remove comment
2022-01-31 17:24:52 +01:00
Serge Zaitsev
84a5910e56
Chore: Remove bus from ngalert ( #44465 )
...
* pass notification service down to the notifiers
* add ns to all notifiers
* remove bus from ngalert notifiers
* use smaller interfaces for notificationservice
* attempt to fix the tests
* remove unused struct field
* simplify notification service mock
* trying to resolve issues in the tests
* make linter happy
* make linter even happier
* linter, you are annoying
2022-01-26 16:42:40 +01:00
Alexander Weaver
c68eefd398
Alerting: Add abstraction layer and testing hooks in front of SMTP dialer ( #43875 )
...
* Add abstraction layer above SMTP communication
* Fix issues with attachments and sync command
* Tests for bad SMTP behavior
* Separate tests between async and sync entry points. Test difference between them
* Return interface so Wire can properly map types
* Address feedback from George
2022-01-13 15:19:15 -06:00
idafurjes
65e60759fb
Rename AddEventListenerCtx to AddEventListener and PublishCtx to Publish ( #43566 )
2022-01-04 09:36:01 +01:00
idafurjes
8e6d6af744
Rename DispatchCtx to Dispatch ( #43563 )
2021-12-28 17:36:22 +01:00
idafurjes
7936c4c522
Rename AddHandlerCtx to AddHandler ( #43557 )
2021-12-28 16:08:07 +01:00
idafurjes
9880a843ed
Add context to notifications ( #42578 )
2021-12-01 17:56:08 +01:00
idafurjes
a65e0be110
Replace AddEventListener with AddEventListenerCtx and Publish with PublishCtx ( #42284 )
2021-11-29 14:23:24 +01:00
Katarina Yang
c4306f9b3e
Chore: add context to login ( #41316 )
...
* Chore: add context to login attempt file and tests
* Chore: add context
* Chore: add context to login and login tests
* Chore: continue adding context to login
* Chore: add context to login query
2021-11-08 15:53:51 +01:00
Serge Zaitsev
125e284da2
Chore: Refactor GoConvey in notification service package ( #40897 )
...
* refactor goconvey in notification service package
* avoid return after t.skip
2021-10-26 18:08:04 +02:00
Arve Knudsen
78596a6756
Migrate to Wire for dependency injection ( #32289 )
...
Fixes #30144
Co-authored-by: dsotirakis <sotirakis.dim@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: Ida Furjesova <ida.furjesova@grafana.com>
Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
Co-authored-by: Leon Sorokin <leeoniya@gmail.com>
Co-authored-by: Andrej Ocenas <mr.ocenas@gmail.com>
Co-authored-by: spinillos <selenepinillos@gmail.com>
Co-authored-by: Karl Persson <kalle.persson@grafana.com>
Co-authored-by: Leonard Gram <leo@xlson.com>
2021-08-25 15:11:22 +02:00
Djairho Geuens
4cadbba686
Email: Allow configuration of content types for email notifications ( #34530 )
...
* Alerting: Allow configuration of content types for email notifications
* Fix lint error
* Improves email templates
* Improve configuration documentation
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve code comments
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve configuration documentation
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve email template
* Remove unnecessary predeclaration
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Adds handling for unrecognized content type
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Move utility function outside of util package
* Fixes syntax
* Remove unused package
* Fix lint error
* improve email templates
* Fix test
* Alerting: Allow configuration of content types for email notifications
* Fix lint error
* Improves email templates
* Improve configuration documentation
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve code comments
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve configuration documentation
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
* Improve email template
* Remove unnecessary predeclaration
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Adds handling for unrecognized content type
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
* Move utility function outside of util package
* Fixes syntax
* Remove unused package
* Fix lint error
* improve email templates
* Fix test
* Fix comment style
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
* Fix template formatting
* Add test and improve error handling
* Fix test
* Fix formatting
* Fix formatting
* Improve documentation and regenerates txt template
* Update docs/sources/administration/configuration.md
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
Co-authored-by: Djairho Geuens <djairho.geuens@ae.be>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Ganesh Vernekar <15064823+codesome@users.noreply.github.com>
Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
2021-07-19 13:31:51 +03:00
Carl Bergquist
06dc2b24bf
dont consider invalid email address a failed email ( #33671 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-05-04 12:07:50 +02:00
Carl Bergquist
58a325a4e4
Instrumentation: Add success rate metrics for email notifications ( #33359 )
...
Signed-off-by: bergquist <carl.bergquist@gmail.com>
2021-04-27 11:15:07 +02:00
Ganesh Vernekar
0b788b5ce8
AlertingNG: Notification channel for emails ( #31768 )
...
* Email notification channel in ngalert
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
* Use existing templating system
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
* Update template and add unit tests
Signed-off-by: Ganesh Vernekar <cs15btech11018@iith.ac.in>
2021-03-18 14:55:11 +00:00
Arve Knudsen
47f13abf7a
Backend: Migrate to using non-global configuration ( #31856 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2021-03-10 12:41:29 +01:00
Arve Knudsen
c2cad26ca9
Chore: Disable default golangci-lint filter ( #29751 )
...
* Disable default golangci-lint filter
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Chore: Fix linter warnings
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-15 09:32:06 +01:00
Arve Knudsen
3fdf4be529
Chore: Enable more go-ruleguard rules ( #29781 )
...
* Chore: Enable more go-ruleguard rules
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-14 15:51:59 +01:00
Arve Knudsen
ac09baae7d
Chore: Use Header.Set method instead of Header.Add ( #29804 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-12-14 15:13:01 +01:00
taciomcosta
10ff4eecef
Backend: fix IPv6 address parsing erroneous ( #28585 )
...
* Backend: Fix parsing of client IP address
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-25 07:55:22 +01:00
Will Browne
d796c61946
Security: Fixes minor security issue with alert notification webhooks that allowed GET & DELETE requests #29330
2020-11-24 10:42:54 +01:00
Arve Knudsen
7897c6b7d5
Chore: Fix staticcheck issues ( #28854 )
...
* Chore: Fix issues reported by staticcheck
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
* Undo changes
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 11:57:20 +01:00
Arve Knudsen
41d432b5ae
Chore: Enable whitespace linter ( #25903 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-06 20:17:28 +02:00
Arve Knudsen
d1e6214a4a
Chore: Enable scopelint Go linter ( #25896 )
...
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-29 17:04:38 +02:00
Mitsuhiro Tanda
9f82cd4713
Slack: Support use of chat.postMessage ( #25818 )
...
* set bearer token if token is provided
* update slack notification document
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-06-26 20:47:06 +02:00
Agnès Toulet
b5b019dfcf
Notifications: fix reply-to option for emails ( #25748 )
2020-06-22 18:56:49 +02:00
Arve Knudsen
07582a8e85
Chore: Fix various spelling errors in back-end code ( #25241 )
...
* Chore: Fix various spelling errors in back-end code
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>>
2020-06-01 17:11:25 +02:00
thameezb
16297da298
Email Notifications: Add StartTLSPolicy config flag ( #24574 )
2020-05-13 16:33:40 +02:00
Mario Trangoni
5116420e9a
Fix misspell issues ( #23905 )
...
* Fix misspell issues
See,
$ golangci-lint run --timeout 10m --disable-all -E misspell ./...
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
* Fix codespell issues
See,
$ codespell -S './.git*' -L 'uint,thru,pres,unknwon,serie,referer,uptodate,durationm'
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
* ci please?
* non-empty commit - ci?
* Trigger build
Co-authored-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Kyle Brandt <kyle@grafana.com>
2020-04-29 21:37:21 +02:00
Carl Bergquist
f9962eabff
chore: avoid aliasing imports in services ( #22499 )
2020-02-29 13:35:15 +01:00
Marcus Efraimsson
0f0772b629
Alerting: Adds support for sending a single email to all recipients in notification channel ( #21091 )
...
When an alert is sent by e-mail, the process sends an e-mail to
each recipient separately. This PR is a single delivery to all recipients.
For companies that use e-mail extensively, this is necessary in order
not to overload the sending queue.
Replaces #18013
Fixes #12650
Co-authored-by: Henrique Oliveira <holiiveira@users.noreply.github.com>
2020-01-10 16:06:33 +01:00
Arve Knudsen
2a78d2a61c
pkg/services: Check errors ( #19712 )
...
* pkg/services: Check errors
* pkg/services: Don't treat context.Canceled|context.DeadlineExceeded as error
2019-10-22 14:08:18 +02:00
Sofia Papagiannaki
de075e529d
Build: Fix potential case-insensitive import collision for github.com/Unknwon/com ( #18915 )
...
* update gopkg.in/macaron.v1
* update github.com/go-macaron/binding
* update github.com/go-macaron/session
* Substitute github.com/Unknwon/com with github.com/unknwon/com
* Clean up modules using `go mod tidy`
* Substitute github.com/Unknwon/bra with github.com/unknwon/bra
2019-09-09 14:22:06 +03:00
Oleg Gaidarenko
c5bca40566
Email: add reply-to and direct attachment ( #18715 )
...
* Add support for `Reply-To` header
* Allow direct attachment
Don't have tests yet, but they will follow
2019-08-26 16:44:18 +02:00
Carl Bergquist
c55e6016bf
backend: replace /pkg/errors with errutil ( #17065 )
2019-05-15 12:20:17 +02:00
Oleg Gaidarenko
29ad72f048
Chore: reintroduce gosec ( #17021 )
...
It seems gosec memory issue was recently fixed.
We should be good to go again
Ref securego/gosec#307
2019-05-13 14:56:36 +03:00
zhulongcheng
2fff8f77dc
move log package to /infra ( #17023 )
...
ref #14679
Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-13 08:45:54 +02:00