-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize the article as per mangopdf
- Loading branch information
Showing
2 changed files
with
99 additions
and
108 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,31 +24,6 @@ example has been tested as an individual, and regularly used from the 'google wo | |
configured for the account or you can not make app passwords. | ||
|
||
|
||
* Ideas for improvement. | ||
|
||
** 1. Secret Storage mechanism. | ||
|
||
The application password needs to be stored somewhere, my advice is not to have it stored in plaintext. | ||
|
||
If your application is hosted on a containerized platform, you can pass it as environment variables, or | ||
some of them have secrets file. | ||
|
||
** 2. Preventing secret leaks. | ||
|
||
After the secret is loaded into memory, destroy the file or environment setting so it is harder for attackers | ||
to abuse the information. | ||
|
||
#+BEGIN_SRC lisp | ||
(setf (uiop:getenv "SOME_ENVIRONMENT_VARIABLE") "PASSWORD-REMOVED-FOR-SECURITY-REASONS") | ||
#+END_SRC | ||
|
||
When it is loaded, use [[https://github.com/rotatef/secret-values][Secret Values]] which will prevent passwords appearing in backtraces or logs. | ||
|
||
** 3. Preventing accidental/intention spamming. | ||
|
||
Your application may accidentally send out hundreds of mail if a function is run repeatedly accidentally. | ||
It is important that the program keep an accurate, reliable mechanism to know when a limits are abused. | ||
|
||
|
||
* The code: | ||
:LOGBOOK: | ||
|
@@ -60,14 +35,13 @@ example has been tested as an individual, and regularly used from the 'google wo | |
page as 4 sets of 4 characters, aka xxxx xxxx xxxx xxxx , however experience shows that there was no space required. | ||
|
||
#+BEGIN_SRC lisp | ||
|
||
(ql:quickload "cl-smtp") | ||
(ql:quickload "cl-mime") | ||
|
||
(defun email-report (&key to cc subject html) | ||
"Generic send SMTP mail with some TEXT to RECIEPIENTS" | ||
(let ((from "[email protected]") | ||
(login "[email protected]") | ||
(let ((login "[email protected]") | ||
(passwd (uiop:getenv "GMAIL_KEY"))) | ||
|
||
(cl-smtp:with-smtp-mail (out "smtp.gmail.com" to cc | ||
|
@@ -90,9 +64,32 @@ example has been tested as an individual, and regularly used from the 'google wo | |
:html html-content) | ||
#+END_SRC | ||
|
||
* Conclusion | ||
* Ideas for improvement. | ||
|
||
** 1. Secret Storage mechanism. | ||
|
||
The application password needs to be stored somewhere, my advice is not to have it stored in plaintext. | ||
|
||
If your application is hosted on a containerized platform, you can pass it as environment variables, or | ||
some of them have secrets file. | ||
|
||
** 2. Preventing secret leaks. | ||
|
||
After the secret is loaded into memory, destroy the file or environment setting so it is harder for attackers | ||
to abuse the information. | ||
|
||
This example works for both personal and google workspace accounts. | ||
#+BEGIN_SRC lisp | ||
(setf (uiop:getenv "SOME_ENVIRONMENT_VARIABLE") "PASSWORD-REMOVED-FOR-SECURITY-REASONS") | ||
#+END_SRC | ||
|
||
When it is loaded, use [[https://github.com/rotatef/secret-values][Secret Values]] which will prevent passwords appearing in backtraces or logs. | ||
|
||
** 3. Preventing accidental/intention spamming. | ||
|
||
Your application may accidentally send out hundreds of mail if a function is run repeatedly accidentally. | ||
It is important that the program keep an accurate, reliable mechanism to know when a limits are abused. | ||
|
||
* Conclusion | ||
|
||
|
||
|
||
|