-
Notifications
You must be signed in to change notification settings - Fork 107
Put back code samples we should not have deleted #767
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1387,6 +1387,24 @@ authorization_header_1: | |||||||||||||||||||||||||||||||||||
| .get_keys() | ||||||||||||||||||||||||||||||||||||
| .await | ||||||||||||||||||||||||||||||||||||
| .unwrap(); | ||||||||||||||||||||||||||||||||||||
| tenant_token_guide_generate_sdk_1: |- | ||||||||||||||||||||||||||||||||||||
| let api_key = "B5KdX2MY2jV6EXfUs6scSfmC..."; | ||||||||||||||||||||||||||||||||||||
| let api_key_uid = "6062abda-a5aa-4414-ac91-ecd7944c0f8d"; | ||||||||||||||||||||||||||||||||||||
| let expires_at = time::macros::datetime!(2025 - 12 - 20 00:00:00 UTC); | ||||||||||||||||||||||||||||||||||||
| let search_rules = json!({ "patient_medical_records": { "filter": "user_id = 1" } }); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| let token = client | ||||||||||||||||||||||||||||||||||||
| .generate_tenant_token(api_key_uid, search_rules, api_key, expires_at) | ||||||||||||||||||||||||||||||||||||
| .unwrap(); | ||||||||||||||||||||||||||||||||||||
| tenant_token_guide_search_sdk_1: |- | ||||||||||||||||||||||||||||||||||||
| let front_end_client = Client::new("http://localhost:7700", Some(token)); | ||||||||||||||||||||||||||||||||||||
| let results: SearchResults<Patient> = front_end_client | ||||||||||||||||||||||||||||||||||||
| .index("patient_medical_records") | ||||||||||||||||||||||||||||||||||||
| .search() | ||||||||||||||||||||||||||||||||||||
| .with_query("blood test") | ||||||||||||||||||||||||||||||||||||
| .execute() | ||||||||||||||||||||||||||||||||||||
| .await | ||||||||||||||||||||||||||||||||||||
| .unwrap(); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1400
to
+1407
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Define
🧩 Suggested fix+ let token = "TENANT_TOKEN";
let front_end_client = Client::new("http://localhost:7700", Some(token));📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| multi_search_1: |- | ||||||||||||||||||||||||||||||||||||
| let movie = client.index("movie"); | ||||||||||||||||||||||||||||||||||||
| let movie_ratings = client.index("movie_ratings"); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace concrete-looking keys and use a future expiration.
Line 1391–Line 1392 look like real secrets and are already flagged by secret scanning. Also, Line 1393 is in the past (December 20, 2025), so the sample token is immediately expired as of February 11, 2026. Please use obvious placeholders and a future date.
🔧 Suggested fix
📝 Committable suggestion
🧰 Tools
🪛 Gitleaks (8.30.0)
[high] 1391-1391: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
[high] 1392-1392: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.
(generic-api-key)
🤖 Prompt for AI Agents