Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security Best Practices #312

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions templates/documentation/sdks/navigation.yaml
szekelyzol marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- heading:
items:
- label: Security Best Practices
href: /sdks/security-best-practices.md
55 changes: 55 additions & 0 deletions templates/documentation/sdks/security-best-practices.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Security Best Practices

Ensuring app security is paramount for developers for several compelling reasons:

* User Trust: A secure app instills trust in users. When people know their data and privacy are protected, they are more likely to use the app and share personal information.

* Reputation: Security breaches can severely damage a developer's reputation. News of vulnerabilities or data leaks can spread rapidly and deter users from using the app.

* Legal and Compliance Issues: Failing to secure user data can lead to legal consequences, especially with the introduction of data protection regulations like GDPR and CCPA. Developers can face lawsuits, fines, or other penalties for non-compliance.

* Financial Impact: Security breaches can be financially devastating. The costs associated with cleaning up a breach, compensating affected users, and lost business can be exorbitant.

* Customer Retention: When users feel safe, they are more likely to stay loyal to the app. A secure app reduces churn and increases customer retention.

* Competitive Advantage: Security can be a significant differentiator. Apps that prioritize security can gain a competitive edge, attracting more users and business partners.

In summary, securing an app is not merely a technical necessity; it's a strategic imperative for developers to protect their users, reputation, and long-term success.

## Securing your application

We highly recommend to avoid storing the API keys in your frontend application as long as it is possible. The best way to make sure that your API keys are secure is separating the front-end and the backend, while making sure that all the API keys and sensitive app information is stored on the backend.
arthemium marked this conversation as resolved.
Show resolved Hide resolved
arthemium marked this conversation as resolved.
Show resolved Hide resolved

* Make sure that the code that makes request to the API, including the API keys are stored on the backend. While the frontend is making requests to your backend securely.
arthemium marked this conversation as resolved.
Show resolved Hide resolved

* All the api.video client libraries are using the [Advanced Authentication](https://docs.api.video/reference/disposable-bearer-token-authentication) method. If you are writing your own API client wrapper, be sure to leverage the Advanced Authentication instead of the Basic Authentication concept.
arthemium marked this conversation as resolved.
Show resolved Hide resolved

* While serving the [upload token](https://docs.api.video/vod/delegated-upload-tokens) to the frontend, make sure that you maintain the shortest TTL possible for the tokens. In order to make sure that token is not hijacked and abused.

* Maintain a secure channel of communication between the front-end and backend at all times.

* Do not store API keys in files inside your application’s source tree. If you store API keys in files, keep the files outside your application’s source tree to help ensure your keys do not end up in your source code control system. This is particularly important if you use a public source code management system such as GitHub.
arthemium marked this conversation as resolved.
Show resolved Hide resolved

* Do not embed API keys directly in code. API keys that are embedded in code can be accidentally exposed to the public. For example, you may forget to remove the keys from code that you share. Instead of embedding your API keys in your applications, store them in environment variables or in files outside of your application’s source tree.
arthemium marked this conversation as resolved.
Show resolved Hide resolved

* Review your code before publicly releasing it. Ensure that your code does not contain API keys or any other private information before you make your code publicly available.
Delete unneeded API keys to minimize exposure to attacks.

* Limit one API key pair's usage to a specific system of your platform backend. This limits the scope of each key. If an API key is compromised, you can delete or regenerate the impacted key without needing to update your other API keys.


## Securing the API keys on the application
arthemium marked this conversation as resolved.
Show resolved Hide resolved

If you are forced to store the API keys directly in your application for technical reasons, make sure that you follow the below recommendations.

Consider obfuscating the API key within your front-end application. Obfuscation transforms the key into a form that isn't immediately readable. However, it's crucial to understand that obfuscation is not foolproof. It merely makes the task of key retrieval more challenging, but not impossible. Determined malicious actors with advanced skills can still de-obfuscate the key. Think of obfuscation as an added layer of security, not a standalone solution.

There are multiple guides around the web on how to secure your frontend application. You can find more recommendations on securing sensitive data on various frameworks and languages below:

* [React Native - Storing sensitive data](https://reactnative.dev/docs/security#storing-sensitive-info)

* [Flutter - Obfuscate code](https://docs.flutter.dev/deployment/obfuscate)

* [Android - App Security](https://developer.android.com/privacy-and-security/security-tips)
arthemium marked this conversation as resolved.
Show resolved Hide resolved

* [iOS - App Security](https://developer.apple.com/documentation/security)
Loading