1 00:00:00,480 --> 00:00:02,659 foreign 2 00:00:03,030 --> 00:00:07,209 [Music] 3 00:00:08,720 --> 00:00:11,880 before I get going I really want to 4 00:00:11,880 --> 00:00:14,880 appreciate Queenie and her crew let's 5 00:00:14,880 --> 00:00:16,500 let's give them a good hand for the job 6 00:00:16,500 --> 00:00:17,090 they are doing 7 00:00:17,090 --> 00:00:20,800 [Applause] 8 00:00:20,960 --> 00:00:24,300 it's hard work I know they love it but 9 00:00:24,300 --> 00:00:25,800 it really makes a big difference for us 10 00:00:25,800 --> 00:00:28,019 so thank you guys 11 00:00:28,019 --> 00:00:31,740 okay running system tests with active 12 00:00:31,740 --> 00:00:34,500 authentication authorization that's the 13 00:00:34,500 --> 00:00:38,520 theme of this talk so this story starts 14 00:00:38,520 --> 00:00:40,260 on a Monday 15 00:00:40,260 --> 00:00:42,480 I'm just into my second coffee cup 16 00:00:42,480 --> 00:00:45,000 getting ready to start the kind of new 17 00:00:45,000 --> 00:00:48,000 week and I got the new email someone has 18 00:00:48,000 --> 00:00:50,879 been crawling around our website hitting 19 00:00:50,879 --> 00:00:53,160 the well-known endpoint and the security 20 00:00:53,160 --> 00:00:56,579 XT there is a security researchers that 21 00:00:56,579 --> 00:00:58,920 kind of tells us that hey I've 22 00:00:58,920 --> 00:01:00,600 discovered this kind of stuff do you 23 00:01:00,600 --> 00:01:04,099 mind taking a look at it so during the 24 00:01:04,099 --> 00:01:06,299 post-mortems with the teams responsible 25 00:01:06,299 --> 00:01:07,860 for the 26 00:01:07,860 --> 00:01:10,080 the services we discover a few things 27 00:01:10,080 --> 00:01:12,540 this was a test system that was kind of 28 00:01:12,540 --> 00:01:14,420 open to the internet 29 00:01:14,420 --> 00:01:16,680 it has a lot of the kind of security 30 00:01:16,680 --> 00:01:19,619 features turned off and it contained a 31 00:01:19,619 --> 00:01:21,659 bit too much data typical data from 32 00:01:21,659 --> 00:01:22,680 production 33 00:01:22,680 --> 00:01:26,220 so we like we do in our app SEC team we 34 00:01:26,220 --> 00:01:28,080 start working together with the teams it 35 00:01:28,080 --> 00:01:30,240 seems to be a recurring issue and 36 00:01:30,240 --> 00:01:32,460 together with the teams we try to define 37 00:01:32,460 --> 00:01:35,159 a few patterns and examples and so on 38 00:01:35,159 --> 00:01:37,740 how we can yeah moving this kind of 39 00:01:37,740 --> 00:01:39,979 issue forward and making their their 40 00:01:39,979 --> 00:01:42,960 life easier so this is one of the 41 00:01:42,960 --> 00:01:45,240 stories I'm gonna tell you now how we 42 00:01:45,240 --> 00:01:47,640 are working with these things 43 00:01:47,640 --> 00:01:50,759 so the objectives for our teams is to 44 00:01:50,759 --> 00:01:53,159 encourage them to divert more effort 45 00:01:53,159 --> 00:01:56,220 onto system testing with authentication 46 00:01:56,220 --> 00:01:58,380 and authorization and all the other 47 00:01:58,380 --> 00:02:01,619 security features activated activated to 48 00:02:01,619 --> 00:02:03,720 me means like turn on like they are in 49 00:02:03,720 --> 00:02:05,579 production 50 00:02:05,579 --> 00:02:07,619 and those of you who are programmers 51 00:02:07,619 --> 00:02:09,419 like me you know how hard that really 52 00:02:09,419 --> 00:02:11,470 can be it's not an easy task 53 00:02:11,470 --> 00:02:12,959 [Music] 54 00:02:12,959 --> 00:02:15,300 so why do we pursue this kind of 55 00:02:15,300 --> 00:02:17,640 objective it will have and it has shown 56 00:02:17,640 --> 00:02:19,800 us to have an impact on mitigating 57 00:02:19,800 --> 00:02:22,200 well-known security risks I just kind of 58 00:02:22,200 --> 00:02:24,720 show a few ones of the August top 10 and 59 00:02:24,720 --> 00:02:27,120 the API top 10 you know them 60 00:02:27,120 --> 00:02:30,720 these risks are in our systems and what 61 00:02:30,720 --> 00:02:32,580 the patterns that we are showing we hope 62 00:02:32,580 --> 00:02:34,260 that some of our teams will mitigate 63 00:02:34,260 --> 00:02:36,680 those risks 64 00:02:36,680 --> 00:02:40,200 so a disclaimer before I continue the 65 00:02:40,200 --> 00:02:42,420 more I learn about the topic at hand the 66 00:02:42,420 --> 00:02:44,760 more I really really realize how complex 67 00:02:44,760 --> 00:02:47,760 it is I'm not an expert life is not 68 00:02:47,760 --> 00:02:50,940 simple all solutions have trade-offs and 69 00:02:50,940 --> 00:02:53,220 there are always always more than one 70 00:02:53,220 --> 00:02:57,239 solution and context matters a lot you 71 00:02:57,239 --> 00:02:59,220 can't just say like do this and do that 72 00:02:59,220 --> 00:03:01,860 to any kind of teams you have to take 73 00:03:01,860 --> 00:03:04,440 into consideration the context where 74 00:03:04,440 --> 00:03:06,780 they kind of live 75 00:03:06,780 --> 00:03:08,700 after this I will show a few code 76 00:03:08,700 --> 00:03:10,500 examples you will get access to the 77 00:03:10,500 --> 00:03:12,420 slides and the code and everything but 78 00:03:12,420 --> 00:03:14,400 please this code is not production 79 00:03:14,400 --> 00:03:16,620 quality I've used some part of the code 80 00:03:16,620 --> 00:03:19,560 to do some training on potentially bad 81 00:03:19,560 --> 00:03:21,720 patterns so don't put this stuff into 82 00:03:21,720 --> 00:03:23,940 production if you if you kind of decide 83 00:03:23,940 --> 00:03:25,620 to take a look at the code 84 00:03:25,620 --> 00:03:27,420 some of the patterns that we discuss 85 00:03:27,420 --> 00:03:29,879 here are kind of risky SOB course is 86 00:03:29,879 --> 00:03:32,459 about it and what I really recommend to 87 00:03:32,459 --> 00:03:34,500 our teams and to you guys whenever you 88 00:03:34,500 --> 00:03:37,560 have like a test system and your whole 89 00:03:37,560 --> 00:03:39,180 Channel software development lifecycle 90 00:03:39,180 --> 00:03:41,580 please do a threat model on it ask 91 00:03:41,580 --> 00:03:43,560 yourself what could potentially go wrong 92 00:03:43,560 --> 00:03:46,560 and so on for the SLC as well not only 93 00:03:46,560 --> 00:03:49,379 the end product including aggregate 94 00:03:49,379 --> 00:03:52,680 who am I I'm Lars an application 95 00:03:52,680 --> 00:03:54,959 security Advocate at equinox that's the 96 00:03:54,959 --> 00:03:56,580 Norwegian company 97 00:03:56,580 --> 00:03:59,280 I've been around for a while I have a 98 00:03:59,280 --> 00:04:01,319 smashing wife and three grown-up kids 99 00:04:01,319 --> 00:04:04,019 and yeah you get all the details here 100 00:04:04,019 --> 00:04:06,299 for where you can connect with LinkedIn 101 00:04:06,299 --> 00:04:08,340 Twitter and GitHub 102 00:04:08,340 --> 00:04:10,920 I think Twitter may be the most the best 103 00:04:10,920 --> 00:04:13,379 place or Gita 104 00:04:13,379 --> 00:04:15,180 outline what are we going to look at 105 00:04:15,180 --> 00:04:18,540 some observations then we're gonna take 106 00:04:18,540 --> 00:04:20,699 a look at the demo application 107 00:04:20,699 --> 00:04:23,040 super Advanced system we're going to 108 00:04:23,040 --> 00:04:25,620 discuss things that I've called test 109 00:04:25,620 --> 00:04:27,960 principles and Technical challenges and 110 00:04:27,960 --> 00:04:29,580 we're going to look into exploring one 111 00:04:29,580 --> 00:04:31,680 potential solution to solve some 112 00:04:31,680 --> 00:04:34,380 challenges wrapping it up and have a q a 113 00:04:34,380 --> 00:04:37,259 at the end and slides in code and all 114 00:04:37,259 --> 00:04:38,820 that kind of stuff will be available for 115 00:04:38,820 --> 00:04:41,400 you guys as you can play around with it 116 00:04:41,400 --> 00:04:43,919 as much as you want to 117 00:04:43,919 --> 00:04:44,699 um 118 00:04:44,699 --> 00:04:46,740 I like this kind of a quote in the end 119 00:04:46,740 --> 00:04:49,080 it's not mine I proudly stolen it 120 00:04:49,080 --> 00:04:51,300 somewhere and there is no end state for 121 00:04:51,300 --> 00:04:54,000 application security we just learn and 122 00:04:54,000 --> 00:04:55,740 improve and that's what I hope to you 123 00:04:55,740 --> 00:04:57,660 guys get out of this session as well 124 00:04:57,660 --> 00:04:59,820 maybe not everything is fit for your 125 00:04:59,820 --> 00:05:01,560 kind of context but maybe there are a 126 00:05:01,560 --> 00:05:02,880 few points that you can take away and 127 00:05:02,880 --> 00:05:04,620 bring back home and 128 00:05:04,620 --> 00:05:06,720 not necessarily Monday but whenever 129 00:05:06,720 --> 00:05:09,540 you're back home making the the life or 130 00:05:09,540 --> 00:05:12,120 your developers a bit more easy helping 131 00:05:12,120 --> 00:05:15,080 them become more secure 132 00:05:15,120 --> 00:05:17,520 so some observations that we have made 133 00:05:17,520 --> 00:05:20,220 from our postmortons And discussing with 134 00:05:20,220 --> 00:05:23,280 the devops developer teams and so on is 135 00:05:23,280 --> 00:05:24,840 as following 136 00:05:24,840 --> 00:05:28,740 our team reports and that 80 of our test 137 00:05:28,740 --> 00:05:31,259 effort is spent on typically unit 138 00:05:31,259 --> 00:05:33,539 testing we do very little of system 139 00:05:33,539 --> 00:05:37,080 testing we also see that authentication 140 00:05:37,080 --> 00:05:39,780 authorization are either mocked stubbed 141 00:05:39,780 --> 00:05:42,780 or disabled when testing that's not an 142 00:05:42,780 --> 00:05:45,539 unusual situation for many you I think 143 00:05:45,539 --> 00:05:47,880 we don't write a lot of security related 144 00:05:47,880 --> 00:05:50,940 tests we are to a large degree focusing 145 00:05:50,940 --> 00:05:52,979 on the happy path and the functional 146 00:05:52,979 --> 00:05:54,740 tests 147 00:05:54,740 --> 00:05:57,780 in testing security features are often 148 00:05:57,780 --> 00:06:01,259 disabled or mocked as many of you know 149 00:06:01,259 --> 00:06:04,800 and in modern systems quotes especially 150 00:06:04,800 --> 00:06:06,479 when we are hiring an into the cloud 151 00:06:06,479 --> 00:06:09,720 which I guess most of us are and and 152 00:06:09,720 --> 00:06:13,979 security is Shifting left meaning that 153 00:06:13,979 --> 00:06:15,780 the development teams are getting more 154 00:06:15,780 --> 00:06:18,539 responsibility for the security both of 155 00:06:18,539 --> 00:06:21,000 the infrastructure for the pipelines and 156 00:06:21,000 --> 00:06:24,419 for the end product and so on we at 157 00:06:24,419 --> 00:06:26,940 least in my opinion should do a lot more 158 00:06:26,940 --> 00:06:29,160 system testing because we want to test 159 00:06:29,160 --> 00:06:31,440 everything as the system from the 160 00:06:31,440 --> 00:06:34,080 customer's business perspective but it's 161 00:06:34,080 --> 00:06:37,099 really really hard 162 00:06:38,759 --> 00:06:41,280 as multiple kind of perspectives not 163 00:06:41,280 --> 00:06:43,080 only the technical one which I'm going 164 00:06:43,080 --> 00:06:44,880 to focus on now I really acknowledge 165 00:06:44,880 --> 00:06:47,280 that things like personal skills and 166 00:06:47,280 --> 00:06:49,860 proficiency the team compositions the 167 00:06:49,860 --> 00:06:52,740 team capacity and not the least the 168 00:06:52,740 --> 00:06:54,840 culture in your team and and your 169 00:06:54,840 --> 00:06:56,160 company needs to be taken into 170 00:06:56,160 --> 00:06:58,139 consideration when you decide what to do 171 00:06:58,139 --> 00:07:00,180 they are super important we can't only 172 00:07:00,180 --> 00:07:02,400 do the technical stuff there's a lot 173 00:07:02,400 --> 00:07:05,580 more my context and my culture is 174 00:07:05,580 --> 00:07:07,500 primarily taken from the nordics in 175 00:07:07,500 --> 00:07:09,660 Europe so some of the stuff that I say 176 00:07:09,660 --> 00:07:12,180 may not make sense to you and maybe 177 00:07:12,180 --> 00:07:16,440 that's one of the explanations so 178 00:07:18,479 --> 00:07:20,639 um yeah the demo system that we're going 179 00:07:20,639 --> 00:07:24,419 to look at is something like 180 00:07:24,419 --> 00:07:28,139 this is a super modern application 181 00:07:28,139 --> 00:07:30,419 it's kind of basically giving you a Game 182 00:07:30,419 --> 00:07:32,460 of Thrones episodes so for the first 183 00:07:32,460 --> 00:07:34,039 season you'll get the list of episodes 184 00:07:34,039 --> 00:07:36,960 and you also get an awesome quotes from 185 00:07:36,960 --> 00:07:39,660 Game of Thrones at the end and you can 186 00:07:39,660 --> 00:07:43,620 read your mailbox from Outlook 187 00:07:43,620 --> 00:07:45,660 the architecture looks something like 188 00:07:45,660 --> 00:07:48,900 this how does this work 189 00:07:48,900 --> 00:07:51,859 not too bad 190 00:07:52,460 --> 00:07:55,680 something like this so um what happens 191 00:07:55,680 --> 00:07:58,560 is that we have a backend that's a 192 00:07:58,560 --> 00:08:00,080 client here 193 00:08:00,080 --> 00:08:02,639 which is kind of a serving the front end 194 00:08:02,639 --> 00:08:05,039 to the client that's a web thing the 195 00:08:05,039 --> 00:08:07,319 back-end client has a session store 196 00:08:07,319 --> 00:08:10,199 which is in our example is in memory it 197 00:08:10,199 --> 00:08:12,479 has a token cache file to manage like 198 00:08:12,479 --> 00:08:14,759 the the access tokens they gathered and 199 00:08:14,759 --> 00:08:16,800 we're using the front end for back-end 200 00:08:16,800 --> 00:08:19,139 pattern here so there are no tokens 201 00:08:19,139 --> 00:08:21,479 stored on the client and so on we have 202 00:08:21,479 --> 00:08:24,660 the episodes API it's like uh it's it's 203 00:08:24,660 --> 00:08:27,419 an API on its own and we also have the 204 00:08:27,419 --> 00:08:30,960 quotes API in our context we use Azure 205 00:08:30,960 --> 00:08:34,500 ad as the identity provider so as ready 206 00:08:34,500 --> 00:08:36,419 handles the entire authentication of the 207 00:08:36,419 --> 00:08:39,419 users the access stuff and so on and we 208 00:08:39,419 --> 00:08:41,399 also read information from the Microsoft 209 00:08:41,399 --> 00:08:44,580 graph that is typically the 210 00:08:44,580 --> 00:08:47,580 the the inbox and so on 211 00:08:47,580 --> 00:08:49,860 when we do the authentication and 212 00:08:49,860 --> 00:08:52,140 authorization we use open ID connects 213 00:08:52,140 --> 00:08:54,360 and a work tool to do that stuff and we 214 00:08:54,360 --> 00:08:56,399 are using the Microsoft authentication 215 00:08:56,399 --> 00:08:58,500 library on the client backend to 216 00:08:58,500 --> 00:09:01,380 facility those things 217 00:09:01,380 --> 00:09:03,060 um is the back end for front-end pattern 218 00:09:03,060 --> 00:09:05,459 which I mentioned and 219 00:09:05,459 --> 00:09:09,120 the basic flow is is so you can just get 220 00:09:09,120 --> 00:09:11,100 your heads around it or try to to 221 00:09:11,100 --> 00:09:13,860 visualize it is that when I hit the 222 00:09:13,860 --> 00:09:17,100 login in my clients it will hit that 223 00:09:17,100 --> 00:09:19,680 endpoint back at the back end that will 224 00:09:19,680 --> 00:09:23,339 redirect to the browser to Azure ID hand 225 00:09:23,339 --> 00:09:25,860 over the authentication to Azure ID if 226 00:09:25,860 --> 00:09:28,620 everything is okay access tokens are 227 00:09:28,620 --> 00:09:30,779 sent back to the client and the stuff 228 00:09:30,779 --> 00:09:34,200 that is in the web browser is a cooking 229 00:09:34,200 --> 00:09:36,300 called session ID that's the connection 230 00:09:36,300 --> 00:09:38,339 to all the data and of course if I have 231 00:09:38,339 --> 00:09:40,860 the session ID I can use step one to 232 00:09:40,860 --> 00:09:43,860 retrieve the various token for the 233 00:09:43,860 --> 00:09:47,399 logged in user so when a client wants to 234 00:09:47,399 --> 00:09:49,500 get the episodes what they basically do 235 00:09:49,500 --> 00:09:51,899 is to on behalf of the logged in user 236 00:09:51,899 --> 00:09:54,420 contact Azure ID and ask hey can I get 237 00:09:54,420 --> 00:09:57,000 an access token to access the episodes 238 00:09:57,000 --> 00:10:00,540 API if that's kind of okay setup it will 239 00:10:00,540 --> 00:10:02,580 return an access token and the client 240 00:10:02,580 --> 00:10:04,620 will use that access token to hit the 241 00:10:04,620 --> 00:10:06,120 episode's API 242 00:10:06,120 --> 00:10:08,580 the episode's API will then verify the 243 00:10:08,580 --> 00:10:10,500 odd token to see that is kind of valid 244 00:10:10,500 --> 00:10:11,880 and okay and all those kind of things 245 00:10:11,880 --> 00:10:15,360 and prepare to serve a list of episodes 246 00:10:15,360 --> 00:10:18,839 when that is done the episode's API will 247 00:10:18,839 --> 00:10:20,940 on behalf of the login user request 248 00:10:20,940 --> 00:10:23,760 another access token from Azure ID to 249 00:10:23,760 --> 00:10:25,500 request quotes 250 00:10:25,500 --> 00:10:27,240 and if all that stuff is kind of okay 251 00:10:27,240 --> 00:10:29,720 the token are validated okay and so on 252 00:10:29,720 --> 00:10:32,040 all that information is kind of sent 253 00:10:32,040 --> 00:10:34,019 back to the client and put into the 254 00:10:34,019 --> 00:10:34,980 front down 255 00:10:34,980 --> 00:10:36,959 so the reason why having a few of these 256 00:10:36,959 --> 00:10:38,820 technical details is that this is a 257 00:10:38,820 --> 00:10:40,560 typical scenario that we meet in our 258 00:10:40,560 --> 00:10:42,779 settings we have like a client stuff but 259 00:10:42,779 --> 00:10:45,600 we touch apis that touch apis and 260 00:10:45,600 --> 00:10:47,640 chaining and so on so this is not 261 00:10:47,640 --> 00:10:49,620 unheard of that's what I call I get a 262 00:10:49,620 --> 00:10:52,279 modern system 263 00:10:53,040 --> 00:10:55,019 the future that we're going to focus our 264 00:10:55,019 --> 00:10:57,839 testing on is like using the browser to 265 00:10:57,839 --> 00:11:00,600 log in and retrieve a Game of Thrones 266 00:11:00,600 --> 00:11:03,839 episode for the login user in the GitHub 267 00:11:03,839 --> 00:11:05,880 repo that I'm sharing with this stuff 268 00:11:05,880 --> 00:11:07,380 there's a more detailed discussion on 269 00:11:07,380 --> 00:11:09,060 the scenario if you want even more 270 00:11:09,060 --> 00:11:11,640 details on that part 271 00:11:11,640 --> 00:11:13,920 before we kind of go in and look to the 272 00:11:13,920 --> 00:11:16,019 solution let's discuss a few test 273 00:11:16,019 --> 00:11:19,440 principles and Technical challenges 274 00:11:19,440 --> 00:11:22,560 so test principles I typically advise 275 00:11:22,560 --> 00:11:24,480 teams to have a few of those themselves 276 00:11:24,480 --> 00:11:26,339 and we have selected a few for our 277 00:11:26,339 --> 00:11:29,579 scenario so yeah one principle is to be 278 00:11:29,579 --> 00:11:31,019 that we should automate as much as 279 00:11:31,019 --> 00:11:33,500 testing as possible 280 00:11:33,500 --> 00:11:35,880 non-functional tests are as important as 281 00:11:35,880 --> 00:11:38,120 the functional ones 282 00:11:38,120 --> 00:11:40,860 a third one don't test in production 283 00:11:40,860 --> 00:11:43,380 then maybe that's a bad idea even though 284 00:11:43,380 --> 00:11:45,959 someone is saying that it's okay in some 285 00:11:45,959 --> 00:11:49,680 cases use synthetic test data is another 286 00:11:49,680 --> 00:11:52,380 principle and running code should not 287 00:11:52,380 --> 00:11:54,959 know that is under tests 288 00:11:54,959 --> 00:11:57,540 and testing should not involve 289 00:11:57,540 --> 00:12:00,360 components that we don't control so this 290 00:12:00,360 --> 00:12:02,040 is not an exhaustive list it's just an 291 00:12:02,040 --> 00:12:04,320 example of some test principles that we 292 00:12:04,320 --> 00:12:05,899 had set for our 293 00:12:05,899 --> 00:12:08,540 example and 294 00:12:08,540 --> 00:12:11,040 you will see that maybe we have to break 295 00:12:11,040 --> 00:12:14,000 or challenge a few of those 296 00:12:14,000 --> 00:12:16,260 so what are the technical challenges 297 00:12:16,260 --> 00:12:18,120 with testing this from like the end user 298 00:12:18,120 --> 00:12:20,279 perspective through the browser that is 299 00:12:20,279 --> 00:12:21,720 to do the login through in the browser 300 00:12:21,720 --> 00:12:23,399 and that's this that's a super challenge 301 00:12:23,399 --> 00:12:26,060 it has a lot of challenges on its own 302 00:12:26,060 --> 00:12:28,560 one of the typical one is that the 303 00:12:28,560 --> 00:12:30,899 authentication is not handled in our 304 00:12:30,899 --> 00:12:34,560 client is handed over to Azure ad so now 305 00:12:34,560 --> 00:12:36,959 I'm leaving my own browser context and 306 00:12:36,959 --> 00:12:40,079 most web drivers and browser will not be 307 00:12:40,079 --> 00:12:41,459 kind of stop me that because this is the 308 00:12:41,459 --> 00:12:42,779 different domain so that's a very 309 00:12:42,779 --> 00:12:45,120 typical challenge that we face 310 00:12:45,120 --> 00:12:47,459 and there are no tokens in the browser 311 00:12:47,459 --> 00:12:49,620 so we must kind of mess around slash 312 00:12:49,620 --> 00:12:51,959 utilize the backend to get this testing 313 00:12:51,959 --> 00:12:53,279 going 314 00:12:53,279 --> 00:12:54,660 um there are some examples of 315 00:12:54,660 --> 00:12:56,700 applications where the whole application 316 00:12:56,700 --> 00:12:58,860 is stored in the client and the tokens 317 00:12:58,860 --> 00:13:01,740 are stored in in the client client being 318 00:13:01,740 --> 00:13:03,600 in the web browser and then you can mess 319 00:13:03,600 --> 00:13:05,820 around within there but that's not the 320 00:13:05,820 --> 00:13:07,579 pattern we have implemented 321 00:13:07,579 --> 00:13:10,860 could we acquire tokens in the test and 322 00:13:10,860 --> 00:13:12,959 manipulate the token cache the cache 323 00:13:12,959 --> 00:13:15,420 that Amazon is providing yes that could 324 00:13:15,420 --> 00:13:17,339 be done but it's really really hard and 325 00:13:17,339 --> 00:13:19,860 messy work so I'm not sure I will say 326 00:13:19,860 --> 00:13:21,600 that is a good way of doing it but it 327 00:13:21,600 --> 00:13:24,240 could be done it's super messy 328 00:13:24,240 --> 00:13:25,800 clearly messed around with the session 329 00:13:25,800 --> 00:13:28,440 objects in the back end yes our test is 330 00:13:28,440 --> 00:13:30,000 driven from the back end so we have 331 00:13:30,000 --> 00:13:32,459 access to both these kind of things the 332 00:13:32,459 --> 00:13:33,899 token cache in the session cache so 333 00:13:33,899 --> 00:13:35,459 maybe there are some opportunities there 334 00:13:35,459 --> 00:13:37,800 and of course we have tried it out and 335 00:13:37,800 --> 00:13:39,600 again it's super messy I don't think you 336 00:13:39,600 --> 00:13:40,910 want to go down that route 337 00:13:40,910 --> 00:13:42,779 [Music] 338 00:13:42,779 --> 00:13:45,060 and the corporate environment is I come 339 00:13:45,060 --> 00:13:46,740 from working in a Norwegian company 340 00:13:46,740 --> 00:13:50,279 called Equinox we have MFA enabled for 341 00:13:50,279 --> 00:13:53,339 all of our users and that makes kind of 342 00:13:53,339 --> 00:13:55,500 a Automation and automation of login 343 00:13:55,500 --> 00:14:01,139 slash testing more or less impossible 344 00:14:01,139 --> 00:14:01,740 um 345 00:14:01,740 --> 00:14:04,079 and of course if you only have one kind 346 00:14:04,079 --> 00:14:06,000 of identity provider for all your users 347 00:14:06,000 --> 00:14:08,639 test users or not then we are also using 348 00:14:08,639 --> 00:14:10,500 a production system for testing which is 349 00:14:10,500 --> 00:14:14,279 not a very good pattern I would say 350 00:14:14,279 --> 00:14:17,639 uh so yeah just mention that one could 351 00:14:17,639 --> 00:14:19,560 be more because the identity provider 352 00:14:19,560 --> 00:14:22,560 with an oi to mock server so that's this 353 00:14:22,560 --> 00:14:24,720 solution that we had tried out and it's 354 00:14:24,720 --> 00:14:26,420 definitely doable 355 00:14:26,420 --> 00:14:28,860 but it depends on what framework you're 356 00:14:28,860 --> 00:14:30,899 using on the backend if you're using 357 00:14:30,899 --> 00:14:33,839 Microsoft msol framework and try to use 358 00:14:33,839 --> 00:14:37,320 a like a Norway to mock server to mock 359 00:14:37,320 --> 00:14:39,540 that one you're in for a real treat 360 00:14:39,540 --> 00:14:42,600 because Microsoft's framework is 361 00:14:42,600 --> 00:14:45,839 Microsoft standards or the web 2 362 00:14:45,839 --> 00:14:48,600 standard plus the Microsoft stuff so if 363 00:14:48,600 --> 00:14:50,940 you really have to mimic or what msaltz 364 00:14:50,940 --> 00:14:53,100 expects in the in the in the request 365 00:14:53,100 --> 00:14:55,440 responses in your mock server as well 366 00:14:55,440 --> 00:14:58,139 and before you know it you're more or 367 00:14:58,139 --> 00:14:59,940 less developing a parallel thing to 368 00:14:59,940 --> 00:15:01,079 Amazon 369 00:15:01,079 --> 00:15:01,800 um 370 00:15:01,800 --> 00:15:03,660 it can be done but it's really really 371 00:15:03,660 --> 00:15:05,240 hard 372 00:15:05,240 --> 00:15:07,980 so the choices that we make should as 373 00:15:07,980 --> 00:15:10,500 far as possible not disable the security 374 00:15:10,500 --> 00:15:13,139 features of our system that's one thing 375 00:15:13,139 --> 00:15:15,480 and we would like to develop as little 376 00:15:15,480 --> 00:15:19,260 as possible of the testing support code 377 00:15:19,260 --> 00:15:22,139 it's not the test code itself but all 378 00:15:22,139 --> 00:15:23,940 the stuff that we mess around with try 379 00:15:23,940 --> 00:15:27,000 to kind of enable the testing 380 00:15:27,000 --> 00:15:29,220 there is also more rapid discussion of 381 00:15:29,220 --> 00:15:31,440 that money available in the GitHub repo 382 00:15:31,440 --> 00:15:34,079 that I will share a bit later 383 00:15:34,079 --> 00:15:37,079 so to time to make some decisions 384 00:15:37,079 --> 00:15:39,420 all solutions are trade-offs trying to 385 00:15:39,420 --> 00:15:41,220 balance risk impact there are no perfect 386 00:15:41,220 --> 00:15:44,279 world here but we decided to use Azure 387 00:15:44,279 --> 00:15:47,160 ID the live one but we don't use our 388 00:15:47,160 --> 00:15:49,500 production one we use Microsoft Office 389 00:15:49,500 --> 00:15:52,440 360 developer program to acquire a 390 00:15:52,440 --> 00:15:55,139 separate Azure ad test environment and 391 00:15:55,139 --> 00:15:57,360 that is available for all developers in 392 00:15:57,360 --> 00:15:59,040 that one we can create all the stuff 393 00:15:59,040 --> 00:16:01,260 that we need in Azure ID to kind of get 394 00:16:01,260 --> 00:16:03,430 this scenario going and support it 395 00:16:03,430 --> 00:16:04,740 [Music] 396 00:16:04,740 --> 00:16:07,800 we create syntactic test users and 397 00:16:07,800 --> 00:16:10,199 disable the MFA to be able to get this 398 00:16:10,199 --> 00:16:11,940 testing going there's no way around that 399 00:16:11,940 --> 00:16:14,339 but the good thing for me is syntactic 400 00:16:14,339 --> 00:16:16,980 is not production there in any way it's 401 00:16:16,980 --> 00:16:19,320 like fantastic synthetic data all the 402 00:16:19,320 --> 00:16:20,880 way 403 00:16:20,880 --> 00:16:23,940 our client component will know that it's 404 00:16:23,940 --> 00:16:25,980 under test so now I'm challenging one of 405 00:16:25,980 --> 00:16:27,360 the test principles that I said was 406 00:16:27,360 --> 00:16:30,480 smart we have so trying to make the test 407 00:16:30,480 --> 00:16:32,880 Footprints as little as possible but for 408 00:16:32,880 --> 00:16:34,740 you guys that are kind of known to the 409 00:16:34,740 --> 00:16:36,540 technical side what what you are doing 410 00:16:36,540 --> 00:16:39,120 is to change the underlying 411 00:16:39,120 --> 00:16:42,480 authorization authentication flow from a 412 00:16:42,480 --> 00:16:44,339 cold ground to Resource owner password 413 00:16:44,339 --> 00:16:48,060 credential and that is yeah it's it's 414 00:16:48,060 --> 00:16:49,320 doable 415 00:16:49,320 --> 00:16:51,660 to serve the infrastructure we use 416 00:16:51,660 --> 00:16:53,579 Docker we put all these Services the 417 00:16:53,579 --> 00:16:55,800 apis in containers and we use Docker 418 00:16:55,800 --> 00:16:58,320 compose to kind of build them and serve 419 00:16:58,320 --> 00:17:01,940 the infrastructure for our test purposes 420 00:17:01,940 --> 00:17:04,679 we do the testing from the browser with 421 00:17:04,679 --> 00:17:07,260 a complete system running and we do that 422 00:17:07,260 --> 00:17:08,819 from the perspective of the end users 423 00:17:08,819 --> 00:17:11,579 and to do that we use Cyprus Cypress 424 00:17:11,579 --> 00:17:14,179 from Cypress IO it's a really good tool 425 00:17:14,179 --> 00:17:16,919 I'm really starting to kind of love that 426 00:17:16,919 --> 00:17:18,720 one and what we can do with it and of 427 00:17:18,720 --> 00:17:22,220 course there are many many more options 428 00:17:22,400 --> 00:17:24,900 the system 429 00:17:24,900 --> 00:17:27,480 create should be kind of fully automated 430 00:17:27,480 --> 00:17:30,480 and able to run in the pipeline so to be 431 00:17:30,480 --> 00:17:32,280 able to run and get directions is that 432 00:17:32,280 --> 00:17:34,860 your treat or whatever that's that's one 433 00:17:34,860 --> 00:17:37,320 of the the kind of a record since that 434 00:17:37,320 --> 00:17:39,360 we have here 435 00:17:39,360 --> 00:17:42,480 oh so exploring one potential solution 436 00:17:42,480 --> 00:17:44,580 and I say one potential solution just 437 00:17:44,580 --> 00:17:46,860 emphasized this may not work for you 438 00:17:46,860 --> 00:17:50,580 guys it has been proven helpful for some 439 00:17:50,580 --> 00:17:52,919 of our teams and maybe you can take away 440 00:17:52,919 --> 00:17:55,160 a few things yourself 441 00:17:55,160 --> 00:17:57,900 so running the application we are 442 00:17:57,900 --> 00:17:59,640 putting the system components into 443 00:17:59,640 --> 00:18:02,520 containers and now I will try the trick 444 00:18:02,520 --> 00:18:05,460 of sharing code this is how it will look 445 00:18:05,460 --> 00:18:07,500 when you kind of open the repositories 446 00:18:07,500 --> 00:18:09,360 we have the slide containing the stuff 447 00:18:09,360 --> 00:18:11,940 that you see here it's written revealed 448 00:18:11,940 --> 00:18:13,440 your desk it's a really good framework 449 00:18:13,440 --> 00:18:15,720 if you want to avoid the Powerpoints 450 00:18:15,720 --> 00:18:18,059 this is the scenario here we have the 451 00:18:18,059 --> 00:18:22,559 the client you have the the diverse apis 452 00:18:22,559 --> 00:18:24,360 and all the documentation and so on 453 00:18:24,360 --> 00:18:26,340 that's available to you guys but the 454 00:18:26,340 --> 00:18:29,000 containers we have a Docker compose file 455 00:18:29,000 --> 00:18:32,160 describing a few Services we have the 456 00:18:32,160 --> 00:18:34,860 client that is the application serving 457 00:18:34,860 --> 00:18:37,160 the front end and doing the Ashley 458 00:18:37,160 --> 00:18:39,960 getting episodes and so on that's one 459 00:18:39,960 --> 00:18:42,480 service the second service is the 460 00:18:42,480 --> 00:18:44,039 episodes API 461 00:18:44,039 --> 00:18:46,500 and the third service is the quote API 462 00:18:46,500 --> 00:18:48,780 and they also created a service for 463 00:18:48,780 --> 00:18:52,020 Cypress more on that later you can see 464 00:18:52,020 --> 00:18:53,520 that there's a lot of environment 465 00:18:53,520 --> 00:18:56,039 variables that we use here and I have a 466 00:18:56,039 --> 00:18:58,620 few templates just giving you an idea of 467 00:18:58,620 --> 00:19:01,440 what environment variables that are 468 00:19:01,440 --> 00:19:04,320 in user so if this was the production 469 00:19:04,320 --> 00:19:05,940 scenario this is not how I would 470 00:19:05,940 --> 00:19:07,740 download I would typically print things 471 00:19:07,740 --> 00:19:09,360 like secrets and those kind of things 472 00:19:09,360 --> 00:19:11,820 maybe even the whole configuration in a 473 00:19:11,820 --> 00:19:13,740 keyboard like Azure keyboard or similar 474 00:19:13,740 --> 00:19:15,360 stuff but for demonstration purposes 475 00:19:15,360 --> 00:19:19,320 this should be kind of a sufficient 476 00:19:19,320 --> 00:19:22,380 so yeah and I've also in for those of 477 00:19:22,380 --> 00:19:24,480 you are familiar with with Azure ID or 478 00:19:24,480 --> 00:19:26,840 any similar systems I have registered 479 00:19:26,840 --> 00:19:30,360 the objects for our systems in Azure ID 480 00:19:30,360 --> 00:19:32,640 and given the permissions that make this 481 00:19:32,640 --> 00:19:34,919 kind of run 482 00:19:34,919 --> 00:19:37,200 I'm using Docker compose to run the 483 00:19:37,200 --> 00:19:39,620 application 484 00:19:39,840 --> 00:19:44,418 this is my command line I am now 485 00:19:46,740 --> 00:19:49,320 in the in the folder called scenario and 486 00:19:49,320 --> 00:19:52,020 I have a file called run 487 00:19:52,020 --> 00:19:52,679 um 488 00:19:52,679 --> 00:19:54,900 what run does is typically set the node 489 00:19:54,900 --> 00:19:56,700 environment to production and then do 490 00:19:56,700 --> 00:19:58,380 Docker compose up for the client 491 00:19:58,380 --> 00:20:00,539 episodes and the quotes 492 00:20:00,539 --> 00:20:04,500 so there's no magic to it 493 00:20:04,500 --> 00:20:07,820 but let's try to do that 494 00:20:14,280 --> 00:20:16,700 start okay 495 00:20:16,700 --> 00:20:21,900 I will take out my glasses open a 496 00:20:21,900 --> 00:20:25,620 private window go to localhost 3000 this 497 00:20:25,620 --> 00:20:28,380 is the super application that we have I 498 00:20:28,380 --> 00:20:30,890 do a sign in 499 00:20:30,890 --> 00:20:32,160 [Music] 500 00:20:32,160 --> 00:20:36,000 and I have to select the user I use one 501 00:20:36,000 --> 00:20:39,900 password as my password manager 502 00:20:39,900 --> 00:20:41,700 and using a password manager is always 503 00:20:41,700 --> 00:20:45,059 super smart I have this Adele Advance my 504 00:20:45,059 --> 00:20:47,400 test user on my own organization that I 505 00:20:47,400 --> 00:20:50,400 have in the Office 365 developer portals 506 00:20:50,400 --> 00:20:53,640 called cycling power I press next and 507 00:20:53,640 --> 00:20:55,679 then I select her password 508 00:20:55,679 --> 00:20:58,799 and um I don't want to stay signed in 509 00:20:58,799 --> 00:21:01,200 but now I'm basically signed into the 510 00:21:01,200 --> 00:21:03,120 application 511 00:21:03,120 --> 00:21:06,120 so show inbox is getting me the Office 512 00:21:06,120 --> 00:21:08,820 365 inbox and as you know the whole 513 00:21:08,820 --> 00:21:11,220 process involved getting access token to 514 00:21:11,220 --> 00:21:14,340 to be able to reach the Office 365 graph 515 00:21:14,340 --> 00:21:15,600 and so on 516 00:21:15,600 --> 00:21:17,700 show God episodes or hitting the 517 00:21:17,700 --> 00:21:20,280 episodes API that is being the quote API 518 00:21:20,280 --> 00:21:22,140 and suddenly it returns a list of 519 00:21:22,140 --> 00:21:24,840 episodes along with a quote so that's 520 00:21:24,840 --> 00:21:27,600 basically it and of course some of the 521 00:21:27,600 --> 00:21:29,760 test challenges you see is the login the 522 00:21:29,760 --> 00:21:31,799 authentication you know that one and 523 00:21:31,799 --> 00:21:34,500 it's uh yeah it's typically where we 524 00:21:34,500 --> 00:21:38,780 kind of have the biggest problems 525 00:21:38,880 --> 00:21:40,860 in this situation 526 00:21:40,860 --> 00:21:44,760 so uh moving on to putting the system in 527 00:21:44,760 --> 00:21:46,740 test mode we use the node environment 528 00:21:46,740 --> 00:21:50,640 variable called node end and we use set 529 00:21:50,640 --> 00:21:52,440 as a value to test to tell our system 530 00:21:52,440 --> 00:21:55,380 inform it that is under test and when we 531 00:21:55,380 --> 00:21:57,419 are testing we switch the authentication 532 00:21:57,419 --> 00:22:01,320 flow from both code flow to the resource 533 00:22:01,320 --> 00:22:03,600 owner password credential and we provide 534 00:22:03,600 --> 00:22:05,280 the username and password to the back 535 00:22:05,280 --> 00:22:07,860 end so just to show a little about code 536 00:22:07,860 --> 00:22:10,380 how that is looking I can go into the 537 00:22:10,380 --> 00:22:12,299 clients file 538 00:22:12,299 --> 00:22:14,640 Source folder the app and this is the 539 00:22:14,640 --> 00:22:15,960 login function 540 00:22:15,960 --> 00:22:18,179 so you can see that if my system 541 00:22:18,179 --> 00:22:20,520 identifier is in their test it would use 542 00:22:20,520 --> 00:22:22,440 one specific function for authentication 543 00:22:22,440 --> 00:22:25,799 another one if it's not under test there 544 00:22:25,799 --> 00:22:27,480 are better ways of doing this with 545 00:22:27,480 --> 00:22:29,700 dependency injection and so on but this 546 00:22:29,700 --> 00:22:33,000 work for the testing purposes and 547 00:22:33,000 --> 00:22:35,159 this is one of the changes for the 548 00:22:35,159 --> 00:22:37,380 testing the second one is the function 549 00:22:37,380 --> 00:22:40,140 doing the authentication is basically 550 00:22:40,140 --> 00:22:43,440 this function it's an Amazon terms 551 00:22:43,440 --> 00:22:44,940 creating a confidential client 552 00:22:44,940 --> 00:22:47,159 application and trying to authenticate 553 00:22:47,159 --> 00:22:49,080 with the username and password it got 554 00:22:49,080 --> 00:22:51,600 from the environment variables if all 555 00:22:51,600 --> 00:22:53,460 that kind of stuff is okay we have 556 00:22:53,460 --> 00:22:56,159 access tokens gotten that is kind of a 557 00:22:56,159 --> 00:22:58,559 built up in the token cache in the 558 00:22:58,559 --> 00:23:01,320 session cookie and everything so the 559 00:23:01,320 --> 00:23:02,880 only code that we have entered in 560 00:23:02,880 --> 00:23:05,100 assistant in format that is under test 561 00:23:05,100 --> 00:23:07,679 are this function and the three lines 562 00:23:07,679 --> 00:23:11,059 that you saw for the login endpoint 563 00:23:11,059 --> 00:23:13,260 not too much 564 00:23:13,260 --> 00:23:16,919 so to run that one I will do the run T 565 00:23:16,919 --> 00:23:19,140 it's you'll see that this Docker 566 00:23:19,140 --> 00:23:20,760 composed up with the client episode 567 00:23:20,760 --> 00:23:22,320 codes and so on 568 00:23:22,320 --> 00:23:24,240 but it tells the system that it's under 569 00:23:24,240 --> 00:23:27,299 test that's the important part 570 00:23:27,299 --> 00:23:29,380 I'll stop this one 571 00:23:29,380 --> 00:23:32,630 [Music] 572 00:23:36,179 --> 00:23:38,700 so is up and running there's a lot more 573 00:23:38,700 --> 00:23:41,159 debug information when I'm test and 574 00:23:41,159 --> 00:23:42,960 those of you are paying really good 575 00:23:42,960 --> 00:23:44,700 attention you may see that I'm logging a 576 00:23:44,700 --> 00:23:47,340 bit too much which is intentional so 577 00:23:47,340 --> 00:23:48,900 don't do that in the production system 578 00:23:48,900 --> 00:23:51,179 again 579 00:23:51,179 --> 00:23:53,520 I'm in a private window trying to log 580 00:23:53,520 --> 00:23:55,559 into the solution and as you recognize 581 00:23:55,559 --> 00:23:57,720 if I'm lucky there is no kind of 582 00:23:57,720 --> 00:23:59,640 authentication going on here because 583 00:23:59,640 --> 00:24:03,240 that was a handle on the back end and in 584 00:24:03,240 --> 00:24:05,760 the in the test driver I can manipulate 585 00:24:05,760 --> 00:24:07,679 backend to log into different users and 586 00:24:07,679 --> 00:24:10,559 so on and and mimic various scenarios 587 00:24:10,559 --> 00:24:13,200 but the functionality is the same the 588 00:24:13,200 --> 00:24:15,780 Inbox and remember behind the scenes 589 00:24:15,780 --> 00:24:17,820 everything is working as it would in 590 00:24:17,820 --> 00:24:19,620 production now besides this login 591 00:24:19,620 --> 00:24:22,440 functionality and they got episodes more 592 00:24:22,440 --> 00:24:25,640 or less the same as well 593 00:24:25,919 --> 00:24:27,780 so um 594 00:24:27,780 --> 00:24:30,659 just speeding on here we're not going to 595 00:24:30,659 --> 00:24:32,480 do the test we're going to use Cyprus 596 00:24:32,480 --> 00:24:36,539 and I want to do a demo of of Cyprus and 597 00:24:36,539 --> 00:24:38,100 all the details and just show it how it 598 00:24:38,100 --> 00:24:40,440 works so now I have my kind of system 599 00:24:40,440 --> 00:24:42,240 running in the back end I open a new 600 00:24:42,240 --> 00:24:43,980 terminal window 601 00:24:43,980 --> 00:24:46,220 and then I go into 602 00:24:46,220 --> 00:24:46,440 [Music] 603 00:24:46,440 --> 00:24:48,440 um 604 00:24:48,559 --> 00:24:49,950 let's see 605 00:24:49,950 --> 00:24:54,320 [Music] 606 00:24:54,320 --> 00:24:57,780 sorry scenario and then the fronts are 607 00:24:57,780 --> 00:24:59,820 made a bit bigger to help you guys read 608 00:24:59,820 --> 00:25:02,400 but this was not very readable but I go 609 00:25:02,400 --> 00:25:04,640 into the 610 00:25:04,640 --> 00:25:09,419 client Cyprus and client is a node thing 611 00:25:09,419 --> 00:25:11,159 so the command that I will typically do 612 00:25:11,159 --> 00:25:15,200 now is npm Cypress open and 613 00:25:15,200 --> 00:25:18,179 my computer will open Cyprus the tool 614 00:25:18,179 --> 00:25:19,679 that I use it to kind of Define the 615 00:25:19,679 --> 00:25:22,799 testing the tests are defined in the 616 00:25:22,799 --> 00:25:26,960 client side press Cyprus it's called 617 00:25:26,960 --> 00:25:30,360 integration and this is Javascript 618 00:25:30,360 --> 00:25:32,340 basically defining the test that we're 619 00:25:32,340 --> 00:25:34,080 going to do log into the system press 620 00:25:34,080 --> 00:25:36,419 this button verify the output and so on 621 00:25:36,419 --> 00:25:39,179 more or less the same stuff that our 622 00:25:39,179 --> 00:25:42,720 users are going to do 623 00:25:42,720 --> 00:25:46,100 so what happens 624 00:25:47,039 --> 00:25:50,600 maybe Cyprus loaded 625 00:25:51,900 --> 00:25:53,520 okay I will give it a little bit more 626 00:25:53,520 --> 00:25:54,659 time 627 00:25:54,659 --> 00:25:57,960 there it comes so the network now is not 628 00:25:57,960 --> 00:25:59,760 running the Defcon one it's running the 629 00:25:59,760 --> 00:26:02,460 C server resource and I have VPN so 630 00:26:02,460 --> 00:26:04,799 network is a bit slow but this is kind 631 00:26:04,799 --> 00:26:07,799 of a Cypress I can double click this 632 00:26:07,799 --> 00:26:09,779 test specification the only one that I 633 00:26:09,779 --> 00:26:12,020 have and it will now open a browser 634 00:26:12,020 --> 00:26:15,299 Firefox the one that I have chosen in 635 00:26:15,299 --> 00:26:18,080 times 636 00:26:18,480 --> 00:26:21,260 of course 637 00:26:22,700 --> 00:26:27,200 it complains let me see why 638 00:26:33,900 --> 00:26:37,220 let me try again 639 00:26:48,539 --> 00:26:51,059 it did not work as expected of course 640 00:26:51,059 --> 00:26:52,740 it's demo time so just give me a few 641 00:26:52,740 --> 00:26:55,260 seconds I will quick that one and try to 642 00:26:55,260 --> 00:26:56,760 run it again 643 00:26:56,760 --> 00:26:59,940 make sure that I don't have any 644 00:26:59,940 --> 00:27:02,700 more firefixtures open 645 00:27:02,700 --> 00:27:05,460 so you can tell Cyprus to use different 646 00:27:05,460 --> 00:27:07,559 kind of browsers like Firefox Chrome and 647 00:27:07,559 --> 00:27:10,200 so on and the end of this story is that 648 00:27:10,200 --> 00:27:12,659 you can also run Cypress in headless 649 00:27:12,659 --> 00:27:14,279 mode so now I'll just show you how this 650 00:27:14,279 --> 00:27:16,200 works when I'm developing the testing 651 00:27:16,200 --> 00:27:19,080 and so on but again this the kind of uh 652 00:27:19,080 --> 00:27:21,179 the Headless mode is what I'm really 653 00:27:21,179 --> 00:27:22,919 after to be able to put this in a 654 00:27:22,919 --> 00:27:27,720 pipeline so open the test specification 655 00:27:27,720 --> 00:27:30,120 there is Oprah's a new version of the 656 00:27:30,120 --> 00:27:31,860 browser and different profile as you can 657 00:27:31,860 --> 00:27:34,080 see and it's basically running through 658 00:27:34,080 --> 00:27:36,840 all the tests logging in and so on and 659 00:27:36,840 --> 00:27:39,419 very fine that I get responses from the 660 00:27:39,419 --> 00:27:42,000 API and all that kind of stuff so in my 661 00:27:42,000 --> 00:27:43,740 world this simple example I'm not 662 00:27:43,740 --> 00:27:46,260 testing the system from the end user's 663 00:27:46,260 --> 00:27:48,000 perspective 664 00:27:48,000 --> 00:27:50,820 that's why quite okay The Next Step will 665 00:27:50,820 --> 00:27:55,158 be to run it in headless mode 666 00:27:55,580 --> 00:27:58,919 and right now I'm not running this in 667 00:27:58,919 --> 00:28:00,380 containers I'm just running in 668 00:28:00,380 --> 00:28:03,900 JavaScript in from my computer but you 669 00:28:03,900 --> 00:28:05,760 will see the output and maybe that's the 670 00:28:05,760 --> 00:28:07,919 in important thing 671 00:28:07,919 --> 00:28:09,980 um 672 00:28:10,260 --> 00:28:14,520 try to put things in a headless mode 673 00:28:14,520 --> 00:28:16,440 so now we start off in the Headless mode 674 00:28:16,440 --> 00:28:19,080 I'm using the electron browser to do 675 00:28:19,080 --> 00:28:20,940 this stuff for those who are very 676 00:28:20,940 --> 00:28:22,919 interested into the details 677 00:28:22,919 --> 00:28:25,380 I had to build a specific image to make 678 00:28:25,380 --> 00:28:27,779 Cypress work on on this Macintosh with 679 00:28:27,779 --> 00:28:30,059 the arm but it's kind of it's working 680 00:28:30,059 --> 00:28:31,799 pretty okay 681 00:28:31,799 --> 00:28:33,299 but now you can see the tests are 682 00:28:33,299 --> 00:28:36,620 running and they are passed okay luckily 683 00:28:36,620 --> 00:28:39,000 it's a bit slower than anticipated 684 00:28:39,000 --> 00:28:41,580 that's because of the network but all 685 00:28:41,580 --> 00:28:43,559 tests were kind of a passing so now I 686 00:28:43,559 --> 00:28:46,020 have developed the test and I'm testing 687 00:28:46,020 --> 00:28:47,520 my system 688 00:28:47,520 --> 00:28:49,559 so the next step will typically be to 689 00:28:49,559 --> 00:28:51,360 wrap everything up and bring it together 690 00:28:51,360 --> 00:28:53,700 and that is to use the docker and and 691 00:28:53,700 --> 00:28:55,620 put everything in headless mode I just 692 00:28:55,620 --> 00:28:57,120 briefly show where that one works as 693 00:28:57,120 --> 00:28:58,080 well 694 00:28:58,080 --> 00:29:02,539 so I go back to the um 695 00:29:02,580 --> 00:29:04,919 to the docker compose and just show a 696 00:29:04,919 --> 00:29:06,659 few of the details to maybe help you 697 00:29:06,659 --> 00:29:08,700 understand why this works 698 00:29:08,700 --> 00:29:09,900 so 699 00:29:09,900 --> 00:29:12,240 um if I look at the docker compose file 700 00:29:12,240 --> 00:29:14,460 you will see that there is a dependency 701 00:29:14,460 --> 00:29:17,279 created for this Cypress service this 702 00:29:17,279 --> 00:29:19,740 means that Cyprus will not report ready 703 00:29:19,740 --> 00:29:22,380 status before decline the episodes and 704 00:29:22,380 --> 00:29:24,179 the quotes are up and running and 705 00:29:24,179 --> 00:29:27,299 working okay of course that stat is a 706 00:29:27,299 --> 00:29:29,039 nice thing to do so I don't run the test 707 00:29:29,039 --> 00:29:30,840 on stuff that isn't ready 708 00:29:30,840 --> 00:29:32,520 the other thing that you want to notice 709 00:29:32,520 --> 00:29:34,919 is that I'm going to use Docker compose 710 00:29:34,919 --> 00:29:38,760 op not the app one but this one I tell 711 00:29:38,760 --> 00:29:40,559 Docker compose to fire up all the 712 00:29:40,559 --> 00:29:44,159 services including Cyprus and at board 713 00:29:44,159 --> 00:29:46,799 when a container exits and the exit code 714 00:29:46,799 --> 00:29:49,500 you're gonna kind of pass on is from 715 00:29:49,500 --> 00:29:50,880 Cyprus 716 00:29:50,880 --> 00:29:53,279 so how this will work is if we start up 717 00:29:53,279 --> 00:29:55,500 all the services Cyprus will wait to 718 00:29:55,500 --> 00:29:57,720 execute until the my system is ready 719 00:29:57,720 --> 00:30:00,360 then it will execute and exit and Docker 720 00:30:00,360 --> 00:30:02,220 compose will use the exit code from side 721 00:30:02,220 --> 00:30:04,559 press which I typically then use in my 722 00:30:04,559 --> 00:30:06,840 build pipeline to determine what to do 723 00:30:06,840 --> 00:30:09,779 fail the building or or whatnot 724 00:30:09,779 --> 00:30:14,600 so to do that stuff I do um 725 00:30:20,940 --> 00:30:22,919 I know that this doesn't make a lot of 726 00:30:22,919 --> 00:30:24,779 sense just watching this kind of roll 727 00:30:24,779 --> 00:30:26,520 over but you can see the whole system is 728 00:30:26,520 --> 00:30:28,799 rolling the Cypress is running all the 729 00:30:28,799 --> 00:30:31,200 tests and if you want to separate the 730 00:30:31,200 --> 00:30:34,080 logs that that's good the essence is 731 00:30:34,080 --> 00:30:37,020 that I now ran everything concealed in 732 00:30:37,020 --> 00:30:39,120 my computer and all the tests kind of 733 00:30:39,120 --> 00:30:41,640 passed for the whole complete system 734 00:30:41,640 --> 00:30:44,399 and that is typically what I would what 735 00:30:44,399 --> 00:30:47,120 I was after 736 00:30:47,220 --> 00:30:50,279 so to start wrapping things up the 737 00:30:50,279 --> 00:30:52,200 current status for our super complex and 738 00:30:52,200 --> 00:30:55,080 modern application is that we now have a 739 00:30:55,080 --> 00:30:58,700 fully automated system test scenario 740 00:30:58,700 --> 00:31:01,440 all the test environment is synthetic 741 00:31:01,440 --> 00:31:03,559 the users and and so on 742 00:31:03,559 --> 00:31:05,760 I have a system with active 743 00:31:05,760 --> 00:31:07,980 authentication authorization use a 744 00:31:07,980 --> 00:31:10,200 different protocol but it's still based 745 00:31:10,200 --> 00:31:11,640 on the access token or all the other 746 00:31:11,640 --> 00:31:14,100 things like the kind of in the later 747 00:31:14,100 --> 00:31:17,279 part of the value chain all my security 748 00:31:17,279 --> 00:31:18,840 controls the stuff that I had in 749 00:31:18,840 --> 00:31:21,360 production is active around my system 750 00:31:21,360 --> 00:31:24,960 and we have very little test support 751 00:31:24,960 --> 00:31:27,419 code a few lines that I showed you to 752 00:31:27,419 --> 00:31:29,880 drive a different login experience 753 00:31:29,880 --> 00:31:32,460 so we have broken a few principles to 754 00:31:32,460 --> 00:31:34,620 reach this state the trade-off could 755 00:31:34,620 --> 00:31:37,679 maybe be kind of acceptable again I 756 00:31:37,679 --> 00:31:39,539 don't can't decide for you guys what I 757 00:31:39,539 --> 00:31:41,480 really recommend is doing a threat model 758 00:31:41,480 --> 00:31:44,760 on your test setup your contestant ramps 759 00:31:44,760 --> 00:31:47,640 and so on and make sure that you ask the 760 00:31:47,640 --> 00:31:51,419 question what could possibly go wrong 761 00:31:51,419 --> 00:31:53,399 our objective with this kind of pattern 762 00:31:53,399 --> 00:31:56,159 was to encourage our teams to divert 763 00:31:56,159 --> 00:31:58,559 more effort on to system testing with 764 00:31:58,559 --> 00:32:00,120 all the security features kind of 765 00:32:00,120 --> 00:32:03,779 activated it's hard not only a technical 766 00:32:03,779 --> 00:32:06,419 challenge but it's doable and in my 767 00:32:06,419 --> 00:32:09,240 humble opinion it's kind of necessary as 768 00:32:09,240 --> 00:32:10,980 well 769 00:32:10,980 --> 00:32:13,919 so that was a 770 00:32:13,919 --> 00:32:16,980 brief tour question and answers I can 771 00:32:16,980 --> 00:32:18,960 leave this here while we do the 772 00:32:18,960 --> 00:32:20,880 questions 773 00:32:20,880 --> 00:32:22,919 visit loopback you know.com to learn 774 00:32:22,919 --> 00:32:24,240 more about what we do with software 775 00:32:24,240 --> 00:32:27,380 development and this is the link to the 776 00:32:27,380 --> 00:32:30,600 GitHub repository with everything 777 00:32:30,600 --> 00:32:33,419 so take a snapshot of that if you want 778 00:32:33,419 --> 00:32:35,600 to 779 00:32:44,880 --> 00:32:48,000 all right open for question 780 00:32:48,000 --> 00:32:49,919 if there are anyone 781 00:32:49,919 --> 00:32:52,380 if you have similar experiences done a 782 00:32:52,380 --> 00:32:54,779 bit differently whatever please share 783 00:32:54,779 --> 00:32:56,520 very eager to learn what other people 784 00:32:56,520 --> 00:32:58,820 are doing 785 00:33:00,500 --> 00:33:05,899 hang on a second like is is Mike on 786 00:33:07,620 --> 00:33:10,320 is the mic on here 787 00:33:10,320 --> 00:33:14,640 just tap it yeah it is um is that better 788 00:33:14,640 --> 00:33:16,740 can you hear me now yeah have you had 789 00:33:16,740 --> 00:33:19,380 any success with trying to fake MFA so 790 00:33:19,380 --> 00:33:21,179 you don't have to break an entire path 791 00:33:21,179 --> 00:33:23,820 to user password 792 00:33:23,820 --> 00:33:26,039 have you had so the question was have we 793 00:33:26,039 --> 00:33:28,440 had any success in Breaking MFA yeah you 794 00:33:28,440 --> 00:33:30,960 chose to go down the user the ropc have 795 00:33:30,960 --> 00:33:32,220 you had any success with actually 796 00:33:32,220 --> 00:33:34,860 keeping with MFA with automation 797 00:33:34,860 --> 00:33:37,620 no we haven't really uh 798 00:33:37,620 --> 00:33:40,919 it hadn't gone exhausted that route we 799 00:33:40,919 --> 00:33:43,019 have some ideas that we could use but we 800 00:33:43,019 --> 00:33:46,440 we found this one to be yeah the one we 801 00:33:46,440 --> 00:33:48,120 selected and a bit better 802 00:33:48,120 --> 00:33:50,159 thank you 803 00:33:50,159 --> 00:33:52,500 thanks for the great talk uh just a 804 00:33:52,500 --> 00:33:54,299 question about do you have any guidance 805 00:33:54,299 --> 00:33:57,720 for how to select tests to System test 806 00:33:57,720 --> 00:33:59,279 your auth NFC like what's your 807 00:33:59,279 --> 00:34:01,200 methodology how do you pick your tests 808 00:34:01,200 --> 00:34:03,299 that's a really good question so the 809 00:34:03,299 --> 00:34:06,419 question was how what mythology do we do 810 00:34:06,419 --> 00:34:09,000 to do the system test so 811 00:34:09,000 --> 00:34:11,460 I would like to say we do but we have 812 00:34:11,460 --> 00:34:13,800 like a hundred plus teams so they are 813 00:34:13,800 --> 00:34:16,500 all different so what we advise the 814 00:34:16,500 --> 00:34:18,839 teams doing is is first like the develop 815 00:34:18,839 --> 00:34:21,599 teams on its owns what really needs to 816 00:34:21,599 --> 00:34:24,119 work what what do we do to do need to do 817 00:34:24,119 --> 00:34:26,879 smoke tests and those kind of things and 818 00:34:26,879 --> 00:34:28,139 then work together with your business 819 00:34:28,139 --> 00:34:30,239 because these system tests are pretty 820 00:34:30,239 --> 00:34:31,560 much close 821 00:34:31,560 --> 00:34:33,540 to what the business would write as 822 00:34:33,540 --> 00:34:35,879 acceptance tests and that will be your 823 00:34:35,879 --> 00:34:38,399 kind of a that would be the gold mind we 824 00:34:38,399 --> 00:34:40,440 have been trying to encourage the 825 00:34:40,440 --> 00:34:42,899 business to start writing Cyprus tests 826 00:34:42,899 --> 00:34:46,679 or explore that route but it's uh not 827 00:34:46,679 --> 00:34:48,599 sure if we will succeed but that will be 828 00:34:48,599 --> 00:34:49,739 like the 829 00:34:49,739 --> 00:34:51,839 the Golden Goose in my head the business 830 00:34:51,839 --> 00:34:53,820 writing Cyprus test that we just 831 00:34:53,820 --> 00:34:57,000 included as in in a test Suite so that 832 00:34:57,000 --> 00:34:59,400 will be beautiful but so yeah 833 00:34:59,400 --> 00:35:01,560 thank you one other question from a 834 00:35:01,560 --> 00:35:03,300 developer to another developer how do 835 00:35:03,300 --> 00:35:04,740 you make these tests more reliable 836 00:35:04,740 --> 00:35:06,599 because I know and then tests can be 837 00:35:06,599 --> 00:35:08,339 very fragile 838 00:35:08,339 --> 00:35:10,680 that's a very good question how do you 839 00:35:10,680 --> 00:35:12,720 make these tests more reliable 840 00:35:12,720 --> 00:35:14,579 um I've been around for a while and I 841 00:35:14,579 --> 00:35:16,260 hated these kind of things because they 842 00:35:16,260 --> 00:35:18,119 were so fragile yeah it's the first time 843 00:35:18,119 --> 00:35:19,619 we did this we have to reference the 844 00:35:19,619 --> 00:35:22,619 point with an X and Y and so on so 845 00:35:22,619 --> 00:35:26,400 no way Jose but after I kind of um time 846 00:35:26,400 --> 00:35:28,260 went on and I start messing around with 847 00:35:28,260 --> 00:35:30,060 Cypress and similar tools they are 848 00:35:30,060 --> 00:35:33,300 getting a lot better and I'm also in 849 00:35:33,300 --> 00:35:35,280 doing a bit of stuff on tagging stuff in 850 00:35:35,280 --> 00:35:37,020 my code make it easier to navigate and 851 00:35:37,020 --> 00:35:40,140 so on so these days what is when we do 852 00:35:40,140 --> 00:35:42,300 examples they're not that fragile there 853 00:35:42,300 --> 00:35:43,800 may be some hiccups in the network and 854 00:35:43,800 --> 00:35:46,920 so on but not too bad actually so I 855 00:35:46,920 --> 00:35:48,359 think it's an option that more people 856 00:35:48,359 --> 00:35:53,000 should explore cool thank you 857 00:35:57,240 --> 00:36:00,078 all right 858 00:36:00,780 --> 00:36:02,760 enjoy the rest of your conference thank 859 00:36:02,760 --> 00:36:04,880 you 860 00:36:07,680 --> 00:36:10,739 [Music]