From 72c1bf1b9f67138a0e389073ea2b87d627d8bed6 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 1 Nov 2024 18:02:53 -0700 Subject: [PATCH 1/6] feat: add article user-removal-api-keys-impact --- ...val-api-keys-impact-1302075420622983179.md | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 articles/en/community/user-removal-api-keys-impact-1302075420622983179.md diff --git a/articles/en/community/user-removal-api-keys-impact-1302075420622983179.md b/articles/en/community/user-removal-api-keys-impact-1302075420622983179.md new file mode 100644 index 0000000..428b0d2 --- /dev/null +++ b/articles/en/community/user-removal-api-keys-impact-1302075420622983179.md @@ -0,0 +1,38 @@ +# Impact of User Removal on API Keys in Deepgram Projects + +When working with Deepgram's API in a collaborative environment, it's crucial to understand how the removal of a user from a project affects associated API keys. This documentation outlines this specific scenario to ensure seamless integration and minimal disruption in production environments. + +### Understanding API Key Ownership + +API keys in Deepgram are tied to the specific user account that created them. They are created within the context of a specific project and are thus bound by the permissions and existence of that user within that project. + +- **Key Creator Responsibilities**: The user who creates an API key is considered the owner of that key. The key can only be used by the creator within the specific project it was created. + +- **Revocation on User Removal**: If a user is removed from a project, any API keys they created for that project are automatically revoked. This ensures security and compliance, preventing orphan keys from remaining active when they’re no longer monitored by the creating account. + +### Potential Implications + +- **Disruption of Services**: If your production environment relies on an API key that was created by a user who gets removed from your project, the revocation of the key will lead to an interruption in service. + +- **Preventive Measures**: Ensure that critical API keys are either managed by a service account that won't be removed or document and transfer key creation responsibilities, especially if project members change roles or leave. + +### Steps to Mitigate Impact + +1. **Regular Review**: Periodically review the ownership and permissions of API keys to ensure they align with the current project member list. + +2. **Establish Clear Guidelines**: Have clear documentation and processes for managing API keys and assigning them to stable service accounts where possible. + +3. **Monitoring and Alerts**: Implement monitoring that alerts you when an API key used in production is revoked or when a team member's access is updated, allowing for quick remediation. + +4. **Collaboration Tools**: Use collaboration tools or notes to keep track of key ownership and project member changes to minimize unanticipated disruptions. + +### Conclusion + +Understanding the relationship between user accounts and API keys is crucial to maintaining uninterrupted service while utilizing Deepgram's powerful APIs. By planning ahead and regularly auditing key ownership, project teams can prevent unnecessary downtime and ensure compliance with best security practices. + +### References + +- [Deepgram API Documentation](https://developers.deepgram.com/docs) +- [GitHub Discussions on Deepgram](https://github.com/orgs/deepgram/discussions) +- [Deepgram Community Platform](https://community.deepgram.com) +- [Asana Task for Documentation Update](https://app.asana.com/0/1203960061328510/1207598434458847) \ No newline at end of file From b29111911a5926da2251813787ec33ef80c8c075 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 1 Nov 2024 18:03:20 -0700 Subject: [PATCH 2/6] feat: add code samples user-removal-api-keys-impact --- .../user-removal-api-keys-impact.rs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 code/community/1302075420622983179/user-removal-api-keys-impact.rs diff --git a/code/community/1302075420622983179/user-removal-api-keys-impact.rs b/code/community/1302075420622983179/user-removal-api-keys-impact.rs new file mode 100644 index 0000000..a7d4416 --- /dev/null +++ b/code/community/1302075420622983179/user-removal-api-keys-impact.rs @@ -0,0 +1,33 @@ +use reqwest::{Client, Error}; +use std::env; + +#[tokio::main] +async fn main() -> Result<(), Error> { + // Load the API key from the environment variable + let api_key = env::var("DEEPGRAM_API_KEY").expect("DEEPGRAM_API_KEY not set"); + + // Configuring the API endpoint + let url = "https://api.deepgram.com/v1/listen"; + + // Create a new HTTP client + let client = Client::new(); + + // Make the HTTP POST request + let response = client + .post(url) + .bearer_auth(api_key) + .send() + .await?; + + // Check the status and print the response text + if response.status().is_success() { + println!("Response: {:?}", response.text().await?); + } else { + eprintln!("Request failed with status: {}", response.status()); + } + + Ok(()) +} + +// NOTE: Before running, ensure you have set the DEEPGRAM_API_KEY environment variable. +// Run with: DEEPGRAM_API_KEY=your_api_key_here cargo run \ No newline at end of file From 20157c7f4add49da6c113b016849d84fff9c6537 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 1 Nov 2024 18:03:21 -0700 Subject: [PATCH 3/6] feat: add code samples user-removal-api-keys-impact --- .../user-removal-api-keys-impact.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 code/community/1302075420622983179/user-removal-api-keys-impact.py diff --git a/code/community/1302075420622983179/user-removal-api-keys-impact.py b/code/community/1302075420622983179/user-removal-api-keys-impact.py new file mode 100644 index 0000000..67f355b --- /dev/null +++ b/code/community/1302075420622983179/user-removal-api-keys-impact.py @@ -0,0 +1,19 @@ +import os +import requests + +# Set your Deepgram API key in the environment variable +api_key = os.getenv('DEEPGRAM_API_KEY') + +# Deepgram API endpoint +url = "https://api.deepgram.com/v1/listen" + +# Make the HTTP POST request +response = requests.post(url, headers={"Authorization": f"Bearer {api_key}"}) + +# Check the status and print the response text +if response.status_code == 200: + print("Response:", response.json()) +else: + print("Request failed with status:", response.status_code) + +# NOTE: Before running, ensure you have set the DEEPGRAM_API_KEY environment variable. \ No newline at end of file From 1c07daa1810d857c9c1a71e0b5083196daae4c28 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 1 Nov 2024 18:03:22 -0700 Subject: [PATCH 4/6] feat: add code samples user-removal-api-keys-impact --- .../user-removal-api-keys-impact.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 code/community/1302075420622983179/user-removal-api-keys-impact.js diff --git a/code/community/1302075420622983179/user-removal-api-keys-impact.js b/code/community/1302075420622983179/user-removal-api-keys-impact.js new file mode 100644 index 0000000..3c935e9 --- /dev/null +++ b/code/community/1302075420622983179/user-removal-api-keys-impact.js @@ -0,0 +1,29 @@ +const axios = require('axios'); + +// Get your Deepgram API key from the environment variables +const apiKey = process.env.DEEPGRAM_API_KEY; + +// Deepgram API endpoint +const url = 'https://api.deepgram.com/v1/listen'; + +(async () => { + try { + // Make the HTTP POST request + const response = await axios.post(url, null, { + headers: { + 'Authorization': `Bearer ${apiKey}` + } + }); + + // Check the status and print the response data + if (response.status === 200) { + console.log('Response:', response.data); + } else { + console.error('Request failed with status:', response.status); + } + } catch (error) { + console.error('Error making request:', error); + } +})(); + +// NOTE: Before running, ensure you have set the DEEPGRAM_API_KEY environment variable. \ No newline at end of file From 1a9ef825fd2250efe5046592c0a21a345ea56674 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 1 Nov 2024 18:03:23 -0700 Subject: [PATCH 5/6] feat: add code samples user-removal-api-keys-impact --- .../user-removal-api-keys-impact.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 code/community/1302075420622983179/user-removal-api-keys-impact.cs diff --git a/code/community/1302075420622983179/user-removal-api-keys-impact.cs b/code/community/1302075420622983179/user-removal-api-keys-impact.cs new file mode 100644 index 0000000..55e9b02 --- /dev/null +++ b/code/community/1302075420622983179/user-removal-api-keys-impact.cs @@ -0,0 +1,36 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; + +class Program +{ + static async Task Main(string[] args) + { + // Get your Deepgram API key from the environment variables + var apiKey = Environment.GetEnvironmentVariable("DEEPGRAM_API_KEY"); + + // Deepgram API endpoint + var url = "https://api.deepgram.com/v1/listen"; + + using (var client = new HttpClient()) + { + client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}"); + + // Make the HTTP POST request + var response = await client.PostAsync(url, null); + + // Check the status and print the response + if (response.IsSuccessStatusCode) + { + var responseData = await response.Content.ReadAsStringAsync(); + Console.WriteLine("Response: " + responseData); + } + else + { + Console.WriteLine("Request failed with status: " + response.StatusCode); + } + } + } +} + +// NOTE: Before running, ensure you have set the DEEPGRAM_API_KEY environment variable. \ No newline at end of file From c8a609c8be63b897da1aec7281c6457cf0f6cab9 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 1 Nov 2024 18:03:24 -0700 Subject: [PATCH 6/6] feat: add code samples user-removal-api-keys-impact --- .../user-removal-api-keys-impact.go | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 code/community/1302075420622983179/user-removal-api-keys-impact.go diff --git a/code/community/1302075420622983179/user-removal-api-keys-impact.go b/code/community/1302075420622983179/user-removal-api-keys-impact.go new file mode 100644 index 0000000..2c2d6fd --- /dev/null +++ b/code/community/1302075420622983179/user-removal-api-keys-impact.go @@ -0,0 +1,39 @@ +package main + +import ( + "fmt" + "net/http" + "os" +) + +func main() { + // Get your Deepgram API key from the environment variables + apiKey := os.Getenv("DEEPGRAM_API_KEY") + + // Deepgram API endpoint + url := "https://api.deepgram.com/v1/listen" + + // Create a new HTTP request + req, err := http.NewRequest("POST", url, nil) + if err != nil { + fmt.Println("Error creating request:", err) + return + } + + // Add the Authorization header + req.Header.Add("Authorization", "Bearer "+apiKey) + + // Execute the request + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + fmt.Println("Error executing request:", err) + return + } + defer resp.Body.Close() + + // Check the status and print the response + fmt.Println("Response status:", resp.Status) +} + +// NOTE: Before running, ensure you have set the DEEPGRAM_API_KEY environment variable. \ No newline at end of file