File notes/Makefile changed (mode: 100644) (index efaa9fe..41648af) |
... |
... |
OPTIONSPANDOC:= --toc --filter pandoc-numbering --filter pandoc-citeproc --filte |
15 |
15 |
# Options common to all invokations of pandoc. Cf https://pandoc.org/MANUAL.html to understand them. |
# Options common to all invokations of pandoc. Cf https://pandoc.org/MANUAL.html to understand them. |
16 |
16 |
OPTIONSPANDOCODT:= $(OPTIONSPANDOC) --default-image-extension=svg |
OPTIONSPANDOCODT:= $(OPTIONSPANDOC) --default-image-extension=svg |
17 |
17 |
OPTIONSPANDOCHTML:= $(OPTIONSPANDOC) --css=style/style.css --toc-depth=1 --self-contained --default-image-extension=svg |
OPTIONSPANDOCHTML:= $(OPTIONSPANDOC) --css=style/style.css --toc-depth=1 --self-contained --default-image-extension=svg |
18 |
|
OPTIONSPANDOCPDF:= $(OPTIONPANDOC) --pdf-engine=xelatex --pdf-engine-opt=-shell-escape -V links-as-notes --default-image-extension=pdf |
|
|
18 |
|
OPTIONSPANDOCPDF:= $(OPTIONSPANDOC) --pdf-engine=xelatex --pdf-engine-opt=-shell-escape -V links-as-notes --default-image-extension=pdf |
19 |
19 |
# Options for (respectively) the odt, html and pdf outputs. |
# Options for (respectively) the odt, html and pdf outputs. |
20 |
20 |
.DEFAULT_GOAL:= all |
.DEFAULT_GOAL:= all |
21 |
21 |
# By default, we construct all the files. |
# By default, we construct all the files. |
|
... |
... |
JAVA_CODE = code/java/*.java |
36 |
36 |
# This must be run before compiling the pdf. |
# This must be run before compiling the pdf. |
37 |
37 |
|
|
38 |
38 |
.PHONY: fig $(FIG_SOURCE) |
.PHONY: fig $(FIG_SOURCE) |
39 |
|
fig : $(FIG_SOURCE) |
|
|
39 |
|
fig: $(FIG_SOURCE) |
40 |
40 |
$(FIG_SOURCE): |
$(FIG_SOURCE): |
41 |
41 |
latexmk -silent -cd -pdf $@ |
latexmk -silent -cd -pdf $@ |
42 |
42 |
# latexmk automates and simplifies the latex compilation of the figures. |
# latexmk automates and simplifies the latex compilation of the figures. |
|
... |
... |
odt: lectures_notes.md |
73 |
73 |
pdf: lectures_notes.md |
pdf: lectures_notes.md |
74 |
74 |
pandoc $(OPTIONSPANDOCPDF) -o lectures_notes.pdf $< |
pandoc $(OPTIONSPANDOCPDF) -o lectures_notes.pdf $< |
75 |
75 |
|
|
76 |
|
|
|
77 |
|
# Rule to compile to mediawiki |
|
78 |
|
# This rule is not tested nor used. |
|
79 |
|
|
|
80 |
|
#mediawiki: lectures_notes.md |
|
81 |
|
# pandoc $(OPTIONSPANDOC) --default-image-extension=svg --to mediawiki -o lectures_notes.mw $< |
|
82 |
|
|
|
83 |
|
|
|
84 |
76 |
### |
### |
85 |
77 |
# Rule for the example.md file, to test your installation. |
# Rule for the example.md file, to test your installation. |
86 |
78 |
### |
### |
|
... |
... |
temp: temp.md |
110 |
102 |
.PHONY: all |
.PHONY: all |
111 |
103 |
all: pdf odt html aux |
all: pdf odt html aux |
112 |
104 |
|
|
|
105 |
|
### |
113 |
106 |
# "Phony" rule to indent properly the latex files |
# "Phony" rule to indent properly the latex files |
114 |
|
.PHONY: clean_latex $(FIG_SOURCE) |
|
115 |
|
clean_latex: $(FIG_SOURCE) |
|
116 |
|
$(FIG_SOURCE): |
|
117 |
|
latexindent -w -s $@ |
|
|
107 |
|
### |
|
108 |
|
|
|
109 |
|
#.PHONY: clean_latex $(FIG_SOURCE) |
|
110 |
|
#clean_latex: $(FIG_SOURCE) |
|
111 |
|
#$(FIG_SOURCE): |
|
112 |
|
# latexindent -w -s $@ |
118 |
113 |
|
|
119 |
114 |
### |
### |
120 |
115 |
# "Phony" rule to beautify the java code |
# "Phony" rule to beautify the java code |
File notes/lectures_notes.md changed (mode: 100644) (index a759d19..5e1e6c1) |
... |
... |
Technological measure of protections exist, and should be used. For instance, |
8414 |
8414 |
mysqldump --all-databases - u testuser -p password - h localhost > dump.sql |
mysqldump --all-databases - u testuser -p password - h localhost > dump.sql |
8415 |
8415 |
``` |
``` |
8416 |
8416 |
- Use encryption, salting _and_ hashing when it comes to password and other sensitive data. |
- Use encryption, salting _and_ hashing when it comes to password and other sensitive data. |
|
8417 |
|
- **Do not** let the users connect directly to your database, even through a piece of software you wrote (refer e.g. to <https://security.stackexchange.com/q/229954> for a discussion on why this is not a good idea). |
8417 |
8418 |
|
|
8418 |
8419 |
If you are not familiar with the concepts of salting and hashing, you can consult e.g. <https://crackstation.net/hashing-security.htm>. |
If you are not familiar with the concepts of salting and hashing, you can consult e.g. <https://crackstation.net/hashing-security.htm>. |
8419 |
8420 |
In a nutshell, this is a measure of prevention to protect your users against weak passwords, and to make sure that only an encrypted version of their password will be stored in your database. |
In a nutshell, this is a measure of prevention to protect your users against weak passwords, and to make sure that only an encrypted version of their password will be stored in your database. |
|
... |
... |
Finally, `code/java/SimpleInjection03.java` shows how to use proper statements t |
8495 |
8496 |
### Protections |
### Protections |
8496 |
8497 |
|
|
8497 |
8498 |
Possible protections from sql injections (-like) includes: |
Possible protections from sql injections (-like) includes: |
|
8499 |
|
|
8498 |
8500 |
#. Prepared statements (a.k.a. stored procedures), |
#. Prepared statements (a.k.a. stored procedures), |
8499 |
8501 |
#. White list input validation, |
#. White list input validation, |
8500 |
8502 |
#. Escaping (AT YOUR OWN RISK). |
#. Escaping (AT YOUR OWN RISK). |
|
... |
... |
Solution to [%D %n (%T)](#problem:insecure_java) |
8612 |
8614 |
- Not asking explicitly for a secure connection is probably not a good idea. Using the default port can sometimes be problematic as well. |
- Not asking explicitly for a secure connection is probably not a good idea. Using the default port can sometimes be problematic as well. |
8613 |
8615 |
- Reading a figure as a string is a bad idea, since the user can try to manipulate the content of that field. The datatype read in the application should match the datatype we are trying to get. |
- Reading a figure as a string is a bad idea, since the user can try to manipulate the content of that field. The datatype read in the application should match the datatype we are trying to get. |
8614 |
8616 |
- Having `admin` / `admin` as a login / password is unforgivable. They should be changed. And, at least, the application should not connect to the database with admin rights! |
- Having `admin` / `admin` as a login / password is unforgivable. They should be changed. And, at least, the application should not connect to the database with admin rights! |
8615 |
|
- Giving the credentials in the source code is not a good idea. The application should connect to another application, hosted on the the server-side, that performs the connection to the database. |
|
|
8617 |
|
- Giving the credentials in the source code is not a good idea. The application should connect to another application, hosted on the the server-side, that performs the connection to the database. Refer e.g. to <https://security.stackexchange.com/q/229954> for explanations on why users should not be allowed to connect directly to your database. |
8616 |
8618 |
- Not using prepared statement, is a huge mistake. This can lead to `SQL` injection like the one we saw above. |
- Not using prepared statement, is a huge mistake. This can lead to `SQL` injection like the one we saw above. |
8617 |
8619 |
|
|
8618 |
8620 |
|
|