new: dev exercise deck added

changes-actionable
iglocska 2019-09-26 09:14:57 +02:00
parent 00a9a76006
commit 58d29dbf2f
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
14 changed files with 2176 additions and 0 deletions

View File

@ -0,0 +1,68 @@
\relax
\providecommand\hyper@newdestlabel[2]{}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{1}{1/1}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {1}{1}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{2}{2/2}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {2}{2}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{3}{3/3}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {3}{3}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{4}{4/4}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {4}{4}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{5}{5/5}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {5}{5}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{6}{6/6}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {6}{6}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{7}{7/7}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {7}{7}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{8}{8/8}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {8}{8}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{9}{9/9}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {9}{9}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{10}{10/10}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {10}{10}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{11}{11/11}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {11}{11}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{12}{12/12}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {12}{12}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{13}{13/13}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {13}{13}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{14}{14/14}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {14}{14}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{15}{15/15}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {15}{15}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{16}{16/16}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {16}{16}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{17}{17/17}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {17}{17}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{18}{18/18}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {18}{18}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{19}{19/19}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {19}{19}}}
\@writefile{nav}{\headcommand {\slideentry {0}{0}{20}{20/20}{}{0}}}
\@writefile{nav}{\headcommand {\beamer@framepages {20}{20}}}
\@setckpt{content}{
\setcounter{page}{21}
\setcounter{equation}{0}
\setcounter{enumi}{0}
\setcounter{enumii}{0}
\setcounter{enumiii}{0}
\setcounter{enumiv}{0}
\setcounter{footnote}{0}
\setcounter{mpfootnote}{0}
\setcounter{beamerpauses}{1}
\setcounter{bookmark@seq@number}{0}
\setcounter{lecture}{0}
\setcounter{part}{0}
\setcounter{section}{0}
\setcounter{subsection}{0}
\setcounter{subsubsection}{0}
\setcounter{subsectionslide}{20}
\setcounter{framenumber}{19}
\setcounter{figure}{0}
\setcounter{table}{0}
\setcounter{parentequation}{0}
\setcounter{theorem}{0}
\setcounter{lstnumber}{1}
\setcounter{section@level}{0}
\setcounter{lstlisting}{0}
}

View File

@ -0,0 +1,261 @@
% DO NOT COMPILE THIS FILE DIRECTLY!
% This is included by the other .tex files.
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Let's try to develop a feature together}
\begin{itemize}
\item Idea: Users should have the option to set alert filters for the publish alert e-mails
\item By default receive all alerts as before
\item If a filter is set, check if the alert is interesting for us or not
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{How to ensure that the feature is useful for the community at large?}
\begin{itemize}
\item Always try to think in reusable systems instead of fixing a single issue
\begin{itemize}
\item Much higher chance of getting a PR merged if it doesn't just cover your specific use-case
\item Try to stay two steps ahead, see how your feature can be reused for other tasks
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{User settings - a long overdue feature}
\begin{itemize}
\item Allow users to set preferences for certain views
\item For high level users, all the technical details are sometimes wasted
\item Simply not being interested in certain types of data points
\item Non-standard MISP deployments (island only MISP instances, etc)
\item User pre-sets for certain settings
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Objectives of the feature}
\begin{itemize}
\item User should be able to do the following with filter rules:
\begin{itemize}
\item set
\item get
\item remove
\item index
\end{itemize}
\item Filter rules should be flexible - we do not want to anticipate all possible settings in advance
\item Ensure that the system is easy to extend and reuse
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Before we start with anything...}
\begin{itemize}
\item Update our MISP instance (git pull origin 2.4)
\item Fork github.com/MISP/MISP (via the github interface)
\item Add a new remote to our fork:
\begin{itemize}
\item via username/password auth: git remote add my\_fork https://github.com/iglocska/MISP
\item via ssh: git remote add my\_fork git\@github.com:iglocska/MISP.git
\end{itemize}
\item Generally a good idea to work on a new branch: git checkout -b dev\_exercise
\item Enable debug in MISP
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Implementation}
\begin{itemize}
\item Storage:
\begin{itemize}
\item Single key/value table for all settings
\item Each user should be able to set a single instance of a key
\item Values could possible become complex, let's use JSON!
\item Add timestamping for traceability
\item Consider which fields we might want to look-up frequently for indexing
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{The database changes we need}
\begin{itemize}
\item The table structure:
\begin{itemize}
\item id int(11) auto increment //primary key
\item key varchar(100) //add index!
\item value text //json
\item user\_id int(11) //add index!
\item timestamp int(11) //add index!
\end{itemize}
\item Tie it to into the upgrade system (app/Model/AppModel.php)
\item Test our upgrade process! Check the output in the audit logs
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Checklist}
\begin{itemize}
\item Outline of the changes needed:
\begin{itemize}
\item New Controller (UserSettingsController.php)
\item New Model (UserSetting.php)
\item New Views (setSetting, index)
\item Add new controller actions to ACL
\item Update the e-mail alert system to use the functionality
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Create the new Model skeleton}
\begin{itemize}
\item location: /var/www/MISP/app/Model/UserSetting.php
\item Create basic skeleton
\item Add model relationships (hasMany/BelongsTo)
\item Use the hooking functionality to deal with the JSON field (beforeSave(), beforeFind())
\item Add a function that can be used to check if a user should get an alert based on filters (checkPublishFilter())
\item Add a function to check if a user can access/modify a setting (checkAccess())
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Create the Controller skeleton}
\begin{itemize}
\item location: /var/www/MISP/app/Model/UserSetting.php
\item Create basic skeleton
\item Set pagination rules
\item Define CRUD functions (exceptionally, we diverge here from the norm)
\begin{itemize}
\item setSetting()
\item getSetting()
\item index()
\item delete()
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Start with an API only approach at first}
\begin{itemize}
\item setSetting():
\begin{itemize}
\item Accepted methods: ADD / POST
\item Separate handling of API / UI
\item POST should create/update an entry
\item GET should describe the API
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{getSetting / index}
\begin{itemize}
\item getSetting():
\begin{itemize}
\item Accepted methods: GET
\item Retrieves a single setting based on either ID or setting key and user\_id
\item Encode the data depending on API/UI
\end{itemize}
\begin{itemize}
\item Accepted methods: GET
\item List all settings
\item Filter user scope on demand
\item Filter available scopes based on role
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{delete}
\begin{itemize}
\item delete():
\begin{itemize}
\item Accepted methods: POST / DELETE
\item Deletes a single entry based on ID or setting key
\item Encode the data depending on API/UI
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Add the ACL functionalities}
\begin{itemize}
\item Tie functions into checkAccess():
\begin{itemize}
\item Check if user is allowed to execute actions and throw exceptions if not
\item Add it to: setSetting() / getSetting() / delete()
\end{itemize}
\item Consider that:
\begin{itemize}
\item Site admins have full reign
\item Org admins can manage their own users
\item Everyone else can self-manage
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Test the functionalities}
\begin{itemize}
\item Use the REST client
\item Expectations
\begin{itemize}
\item GET on /setSetting and /delete describing our endpoints
\item POST /setSetting with {"key": "publish\_filter", "value": {"Event.tags":"\%sofacy\%"}} should return newly added or modified filter
\item GET on /index should list our entries, GET on /getSetting should show an individual entry
\item DELETE on /delete should delete the entry
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Start adding the UI components}
\begin{itemize}
\item We now have a rudimentary CRUD, let's add some simple UI views
\begin{itemize}
\item setSetting as a simple form
\item index should use the parametrised generators (IndexTable)
\item Add both views to the menu systems (side-menu, global menu)
\item Don't forget about sanitisation and translations!
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Add the checkPublishFilter() function to the e-mailing}
\begin{itemize}
\item Trace the code path of the e-mail sending to understand the process
\item Decide on the best place to inject our check
\item Don't break the flow of the process!
\item What do we have access to at this point? What format are they in?
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Test if our code works correctly}
\begin{itemize}
\item Do we see any notices / errors?
\item Is our code easily accessible?
\item Consider other roles! Can users/org admins do things we don't want them to do?
\item Is our code-base breaking the default behaviour?
\item Is our update script working as expected?
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Push our code to our fork and create a pull request}
\begin{itemize}
\item git status to check what changed / got added
\item git add /path/to/file to add files we want to commit
\item git commit (format: is "new/fix/chg: [topic] My description"
\item git push my\_fork
\item Create pull request from the github interface
\item Wait for Travis to run, update the code if needed
\end{itemize}
\end{frame}

BIN
a.8-dev-hands-on/logo-circl.pdf Executable file

Binary file not shown.

BIN
a.8-dev-hands-on/misp.pdf Normal file

Binary file not shown.

BIN
a.8-dev-hands-on/misplogo.pdf Executable file

Binary file not shown.

View File

@ -0,0 +1,27 @@
\relax
\providecommand\hyper@newdestlabel[2]{}
\providecommand\BKM@entry[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\providecommand\HyField@AuxAddToCoFields[2]{}
\@input{content.aux}
\providecommand \oddpage@label [2]{}
\pgfsyspdfmark {pgfid1}{1398509}{16987808}
\@writefile{nav}{\headcommand {\beamer@partpages {1}{20}}}
\@writefile{nav}{\headcommand {\beamer@subsectionpages {1}{20}}}
\@writefile{nav}{\headcommand {\beamer@sectionpages {1}{20}}}
\@writefile{nav}{\headcommand {\beamer@documentpages {20}}}
\@writefile{nav}{\headcommand {\gdef \inserttotalframenumber {19}}}

1748
a.8-dev-hands-on/slide.log Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
\headcommand {\slideentry {0}{0}{1}{1/1}{}{0}}
\headcommand {\beamer@framepages {1}{1}}
\headcommand {\slideentry {0}{0}{2}{2/2}{}{0}}
\headcommand {\beamer@framepages {2}{2}}
\headcommand {\slideentry {0}{0}{3}{3/3}{}{0}}
\headcommand {\beamer@framepages {3}{3}}
\headcommand {\slideentry {0}{0}{4}{4/4}{}{0}}
\headcommand {\beamer@framepages {4}{4}}
\headcommand {\slideentry {0}{0}{5}{5/5}{}{0}}
\headcommand {\beamer@framepages {5}{5}}
\headcommand {\slideentry {0}{0}{6}{6/6}{}{0}}
\headcommand {\beamer@framepages {6}{6}}
\headcommand {\slideentry {0}{0}{7}{7/7}{}{0}}
\headcommand {\beamer@framepages {7}{7}}
\headcommand {\slideentry {0}{0}{8}{8/8}{}{0}}
\headcommand {\beamer@framepages {8}{8}}
\headcommand {\slideentry {0}{0}{9}{9/9}{}{0}}
\headcommand {\beamer@framepages {9}{9}}
\headcommand {\slideentry {0}{0}{10}{10/10}{}{0}}
\headcommand {\beamer@framepages {10}{10}}
\headcommand {\slideentry {0}{0}{11}{11/11}{}{0}}
\headcommand {\beamer@framepages {11}{11}}
\headcommand {\slideentry {0}{0}{12}{12/12}{}{0}}
\headcommand {\beamer@framepages {12}{12}}
\headcommand {\slideentry {0}{0}{13}{13/13}{}{0}}
\headcommand {\beamer@framepages {13}{13}}
\headcommand {\slideentry {0}{0}{14}{14/14}{}{0}}
\headcommand {\beamer@framepages {14}{14}}
\headcommand {\slideentry {0}{0}{15}{15/15}{}{0}}
\headcommand {\beamer@framepages {15}{15}}
\headcommand {\slideentry {0}{0}{16}{16/16}{}{0}}
\headcommand {\beamer@framepages {16}{16}}
\headcommand {\slideentry {0}{0}{17}{17/17}{}{0}}
\headcommand {\beamer@framepages {17}{17}}
\headcommand {\slideentry {0}{0}{18}{18/18}{}{0}}
\headcommand {\beamer@framepages {18}{18}}
\headcommand {\slideentry {0}{0}{19}{19/19}{}{0}}
\headcommand {\beamer@framepages {19}{19}}
\headcommand {\slideentry {0}{0}{20}{20/20}{}{0}}
\headcommand {\beamer@framepages {20}{20}}
\headcommand {\beamer@partpages {1}{20}}
\headcommand {\beamer@subsectionpages {1}{20}}
\headcommand {\beamer@sectionpages {1}{20}}
\headcommand {\beamer@documentpages {20}}
\headcommand {\gdef \inserttotalframenumber {19}}

View File

BIN
a.8-dev-hands-on/slide.pdf Normal file

Binary file not shown.

View File

View File

@ -0,0 +1,27 @@
\documentclass{beamer}
\usetheme[numbering=progressbar]{focus}
\definecolor{main}{RGB}{47, 161, 219}
\definecolor{textcolor}{RGB}{128, 128, 128}
\definecolor{background}{RGB}{240, 247, 255}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{listings}
\usepackage{adjustbox}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes,arrows}
%\usepackage[T1]{fontenc}
%\usepackage[scaled]{beramono}
\author{\small{\input{../includes/authors.txt}}}
\title{MISP core development hands-on exercise}
\subtitle{Building a small nifty feature for the MISP core}
\institute{\includegraphics[scale=0.5]{misplogo.pdf}}
\titlegraphic{\includegraphics[scale=0.85]{misp.pdf}}
\date{\input{../includes/location.txt}}
\begin{document}
\include{content}
\end{document}

View File

BIN
a.8-dev-hands-on/x-isac-logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB