Skip to content

Commit d881070

Browse files
committed
Add security considerations and how-it-works documentation; update FAQ
1 parent dbfdff6 commit d881070

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

doc/faq.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
- [How to deploy your AzUrlShortener](./how-to-deploy.md)
88
- [How to run AzUrlShortener locally](#how-to-run-azurlshortener-locally)
99
- [How to update/ redeploy AzUrlShortener](#update-redeploy-azurlshortener)
10-
10+
- [How does it work?](./how-it-works.md)
11+
- [Security Considerations](./security-considerations.md)
1112

1213

1314
## How to run AzUrlShortener locally

doc/how-it-works.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
How It Works
2+
============
3+
4+
The backend is using Azure Functions and Azure Table Storable this page will explains how they work together in this tool.
5+
6+
![Global Diagram](../images/global_diagram_idea_v3b.jpg)
7+
8+
## Azure Functions
9+
10+
Azure Functions were the perfect match for this project because when you use a dynamic plan you are charged only when the function is running. In our case, it's only a few seconds at the time. To know more read [Azure Function Pricing](https://azure.microsoft.com/en-us/pricing/details/functions/)
11+
12+
### Function: UrlRedirect
13+
14+
This function returns a HTTP Redirect to the URL. You can call it directly doing an HTTP request of type POST or GET passing the vanity at the end of the URL. The Azure Function Proxy will call Function passing the parameter.
15+
16+
For example, if the domain is *c5m.ca* and the vanity is "project", the request `c5m.ca/2w` will call "UrlRedirect/{shortUrl}" where `shortUrl` is equal to "project". end the result will be a redirect to the long URL save in the storage.
17+
18+
Every time the Azure Function is called it will increment the click count and save the timestamp when this call appends.
19+
20+
## Azure Table Storage
21+
22+
The [Azure table storage](https://docs.microsoft.com/en-us/azure/storage/tables/) are the data store in this project. They are a very convenient service to keep structured NoSQL data in the cloud. They are also typically lower in cost than traditional SQL for similar volumes of data.
23+
24+
You can explore the Azure Table storage from Azure portal or using the [Azure Storage Explorer](https://docs.microsoft.com/en-us/azure/vs-azure-tools-storage-manage-with-storage-explorer?tabs=windows#overview) it's a nice free tool that is available on all platforms (MacOS, Linux, Windows).
25+
26+
There are two tables that will be automatically created at the first call.
27+
28+
### Table: ClickStats
29+
30+
The ClickStats table get a new entry at every call of the Azure Function **UrlRedirect** with the Datetime value.
31+
32+
33+
### Table: UrlDetails
34+
35+
The UrlDetails table has the information about all the URLs created. The Vanity, URL, and number of clicks.
36+
37+
## Security Considerations
38+
39+
Review [Security Considerations](./security-considerations.md) and choose and implement an appropriate authorization approach.

doc/security-considerations.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Security Responsibilities
2+
3+
This is open-source software and delivered as a Proof-of-concept. Please consider which security approaches is appropriate for your use case.
4+
5+
## Current Implementation
6+
7+
The [TinyBlazorAdmin](../src/Cloud5mins.ShortenerTools.TinyBlazorAdmin/) is secured using the built-in authentication feature of Azure Container Apps (ACA) is a simple and powerful way to add authentication your applications with minimal effort. Here are some key points to remember:
8+
9+
- You don't need to change the existing app code to add this authentication feature.
10+
- This built-in authentication feature of ACA protects your entire application, not individual pages.
11+
12+
For more details about the built-in authentication feature of ACA, see [Authentication and authorization in Azure Container Apps](https://learn.microsoft.com/azure/container-apps/authentication).
13+
14+
## Basic Security Approaches
15+
16+
Using Azure Container Apps (ACA), the API container will only be accessible from the TinyBlazorAdmin and won't be exposed to the Internet. As a bonus, since TinyBlazorAdmin and the API are now running inside containers, you could also decide to run them locally.
17+
18+
The storage access got also a security upgrade. Instead of using a connection string, I will be using a Managed Identity to access the Azure Storage Table. This is a much more secure way to access Azure resources, and thanks to .NET Aspire, it is also very easy to implement.
19+
20+
For more details about Security read the [SECURITY.md](../SECURITY.md) file.

images/global_diagram_idea_v3b.jpg

119 KB
Loading

0 commit comments

Comments
 (0)