โข It's not all fun & games
โข Why Logging is crucial
โข Invocation/Event Inputs
โข Response Payload
โข Performance Levels
โข Authentication Requests
โข Service Usage Indicators
โข The 4 W's
โข What you should never log ๐ฅ
Serverless brings in a lot of benefits and helps developers to focus more on actually focusing on writing their apps instead of running and maintaining them
But it's not the holy grail that drops all responsibilities
{ 2 | 17 }
You still need to be aware of your web threats like cross-site scripting and #SQL injections.
And there's more:
โข Broken Authentication
โข Insecure Storage of App Secrets
โข Insecure deployment settings
โข Misuse of permissions
โข Improper exception handling
{ 3 | 17 }
Additionally, serverless brings in unique threats to take care of like #DoSattacks for ๐ณ๐ถ๐ป๐ฎ๐ป๐ฐ๐ถ๐ฎ๐น ๐ฒ๐ ๐ต๐ฎ๐๐๐๐ถ๐ผ๐ป.
A thing that's often missed out on:
Logging is crucial for your application security as it can lead to huge issues later.
{ 4 | 17 }
No system is 100% secure, but #logging will help to understand the flaws that were used to compromise our system.
We can use this information to fix flaws, build blocklists, or identify compromised accounts.
A first start is to log the inputs that are received by each function - regardless of whether they are internal or external.
It can help to retrace steps that were taken by the attacker or how validations were avoided.
Similar to invocation inputs, logging outputs help to analyze and mitigate security breaches.
In the worst-case - not being able to stop attacks - we can at least identify what information was stolen.
If a function performs badly and now takes 2.5s instead of 250ms to complete a task, we can end up in financial misery as we're paying what we use in #serverless land.
Logging for this purpose depends heavily on the use case.
{ 8 | 17 }
Nevertheless, it's vital to have this in mind when planning the application critical logs.
At Dashbird, we're also collecting & aggregating detailed insights about all of your function's performances. Having this in a single place will save time & money.
If your app has a protected area, it's important to log for authentication requests, especially failed ones.
Look for odd requests or patterns.
Maybe there's a spike in failed requests for emails that aren't even known
{ 10 | 17 }
This could indicate that someone's scanning a list of leaked passwords to find potentially vulnerable accounts in your app
Authentication logging can alert that someone is scouting our app for weak spots.
By that, you can introduce countermeasures before an attack
{ 11 | 17 }
External sources like ๐๐ฎ๐๐ฒ ๐ ๐ฏ๐ฒ๐ฒ๐ป ๐ฃ๐๐ป๐ฒ๐ฑ can be very helpful here
Preemptively search for compromised accounts & lock them, asking for a password reset.
Your customers will love to receive a preventive serverless security alert
It's always a good idea to log service usage indicators
Even with carefully planned costs & pricing structures, there could be things that went unseen
Maybe mistakes were made at dimensioning costs & pricing of our app
{ 13 | 17 }
Maybe there are cost spikes as some authorization logics are bypassed and someone is free-riding on our backs.
Logs will help to
โข narrow down contributing services
โข who was contributing to the cost spikes
โข where services abused in a way we didn't expect?
{ 14 | 17 }
๐ง๐ต๐ฒ ๐ฐ ๐ช'๐
Based on OWASP Logging Cheat Sheet Recommendations, we should be logging:
โข When
โข Where
โข Who
โข What
...in every function invocation!
This applies to all items that we discussed.
We at Dashbird.io help you with all of them by providing the observability that lacks your serverless environment while providing monitoring & alerting
Spend less time debugging with detailed, noise-free insights and always be on top of what's going on
{ 16 | 17 }
A last reminder to complete this thread:
User-related information like personal or sensitive data should ๐ป๐ฒ๐๐ฒ๐ฟ be logged!
Make sure to filter these out as it might get you in big trouble, not only with regulatory authorities.
{ 17 | 17 }
Thank you for reading!
You can find the complete article and more serverless-related tutorials, news, and insights at @thedashbird blog โ๏ธ
Regardless if youโre an AWS Lambda expert or youโre new to Lambda, thereโs ๐ฎ๐น๐๐ฎ๐๐ ๐๐ผ๐บ๐ฒ๐๐ต๐ถ๐ป๐ด ๐ป๐ฒ๐ ๐๐ผ ๐น๐ฒ๐ฎ๐ฟ๐ป ๐
Topic for Today: ๐๐ฎ๐บ๐ฏ๐ฑ๐ฎ ๐๐ฟ๐ฟ๐ผ๐ฟ ๐๐ฎ๐ป๐ฑ๐น๐ถ๐ป๐ด ๐
Differences in Lambda & Step Functions โ
๐ข๐๐ฒ๐ฟ๐๐ถ๐ฒ๐ ๐งต
โข Lambda Retry Behaviour
โข Consequences
โข Idempotency
โข Error Handling at Step Functions
โข Wrap up
Lambda functions can fail ๐ฎ๐ป๐ฑ ๐๐ต๐ฒ๐ ๐๐ถ๐น๐น.
When they do, it's of these situations:
โข ๐๐ฎ๐ฐ๐ธ ๐ผ๐ณ ๐บ๐ฒ๐บ๐ผ๐ฟ๐ - your process exceeded the functions allocated memory and will exit with "Process exited before completing the request."