One-Click Security Check
Trace privacy leak risks and safely share your AI programming projects.
Why Security Check?
When using AI programming assistants, conversation logs often contain various sensitive information:
- API Keys: You might have pasted keys for OpenAI, Anthropic, etc., in the chat.
- Passwords & Credentials: Database passwords, server login credentials, etc.
- Personal Information: Email addresses, phone numbers, etc.
Sharing these conversation logs directly can pose security risks. The One-Click Security Check function automatically identifies and flags this sensitive information, letting you clearly understand potential privacy risks before sharing.
Security Guarantee
Mantra's security suite includes not only manual checks but also Pre-Tool Use Detection, which intercepts sensitive data leakage in real-time before tools are executed. Security checks only flag information; you can choose to redact it before sharing, and your original data remains untouched.
Use Cases
- Real-time Protection: Prevent AI from automatically reading sensitive files containing keys during your session.
- Team Collaboration: Sharing projects with colleagues or team members.
- Social Sharing: Posting to social media to showcase your AI programming results.
- Issue Reporting: Submitting issues with conversation logs without worrying about leaking sensitive info.
Built-in Security Rules
Mantra comes with built-in rules for recognizing common sensitive information, ready to use without configuration.
Supported Detection Types
| Type | Description | Recognition Method | Redaction Effect |
|---|---|---|---|
| 🔑 API Key | OpenAI, Anthropic, Claude keys | Auto-identify prefixes like sk-, anthropic- | sk-**** |
| 🔒 Password | Various password strings | Identify content after keywords like password, pwd | **** |
| 🎫 Token | JWT, Bearer Token, etc. | Identify features like Bearer, eyJ | eyJ**** |
| 👤 Personal Info | Emails, Phone numbers | Pattern match common formats | ***@***.com |
| 🗄️ DB Credential | DB connection strings, passwords | Identify connection string formats | **** |
| 🌐 Private Address | Intranet IPs, Private domains | Identify private subnets and internal domains | ***.***.*** |
Detection & Redaction Example
Detected Sensitive Info (Original):
My OpenAI API Key is sk-proj-abc123xyz456...
Database password is MySecretPwd123
Please send to [email protected]After Redaction (Safe to Share):
My OpenAI API Key is sk-****
Database password is ****
Please send to ***@***.comCustom Detection Rules
In addition to built-in rules, you can add your own rules to meet specific needs.
Adding a New Rule
- Go to Settings → Security Check Rules.
- Click the Add Rule button.
- Enter a rule name (e.g., Internal Project Code).
- Set the matching pattern (see explanation below).
- Click Save to finish.
Matching Pattern Guide
What is a Matching Pattern?
A matching pattern is a way to describe "what content to hide". You don't need to know programming; you can use simple and intuitive patterns to define it.
Common Pattern Examples:
| Pattern | Description | Match Example |
|---|---|---|
PROJECT-* | Match any content starting with PROJECT- | PROJECT-001, PROJECT-ABC |
*@company.com | Match company emails | [email protected] |
Internal-??? | Match specific format (? represents a single char) | Internal-A01, Internal-X99 |
Pattern Symbols:
*: Matches any length of content (including empty).?: Matches a single character.
Editing Rules
- Find the rule you want to modify in the rule list.
- Click the Edit button on the right side of the rule.
- Modify the rule name or matching pattern.
- Click Save to finish.
Deleting Rules
- Find the rule you want to delete in the rule list.
- Click the Delete button on the right side of the rule.
- Click Confirm in the dialog.
Note
After deleting a built-in rule, sensitive information of that type will no longer be automatically detected. Please operate with caution.
Previewing Security Check Results
Before sharing, you can preview the effect of the security check to ensure sensitive information has been correctly identified and flagged.
Entering Preview Mode
- Select the project to share.
- Click the Security Check button in the toolbar.
- The system will display the detected sensitive information and the redacted conversation content.
Confirming Detection Results
In the preview interface:
- Detected sensitive content is highlighted with a special style.
- You can scroll through the entire conversation to verify that all sensitive information has been identified.
- If omissions are found, you can return to add custom rules.
Adjusting Settings
If the detection results do not meet expectations, you can:
- Add Rules: Found some sensitive info not detected? Add a new custom rule.
- Adjust Rules: Detection range too broad or too narrow? Modify the matching pattern of existing rules.
- Temporarily Disable: Some rules not needed for now? You can temporarily disable them without deleting.
Safely Sharing Projects
After confirming the security check results, you can safely share the project.
Sharing Process
- Complete the security check preview and ensure satisfaction.
- Click the Share button.
- Choose a sharing method:
- Generate Link: Create a shareable link.
- Export File: Download the redacted project file.
- Copy the link or save the file.
Share Link Usage
- Validity: Share links are valid for 7 days by default.
- Access: Anyone with the link can view the redacted content.
- Statistics: You can view link access counts in Share Management.
Suggestion
For particularly sensitive projects, it is recommended to set a shorter link validity period and check access status promptly after sharing.
Real-time Protection & Interception Records
Beyond manual checks, Mantra provides an active defense mechanism.
Pre-Tool Use Detection
When AI attempts to use a tool (e.g., read_file) to access file content, Mantra's privacy engine automatically scans the content before it's sent to the model. If sensitive info is detected:
- Automatic Interception: Blocks the transmission of sensitive content.
- Risk Notification: Displays the reason for interception in the chat interface.
- Secure Replacement: If you choose to proceed, only the redacted secure content is sent.
Interception Records
All real-time interception events are stored for your review.
- Click the "Interception Records" icon in the sidebar.
- Review the timestamp, file path, matched rules, and the specific content that was blocked.
- Use this interface to evaluate rule effectiveness or fine-tune your custom rules.
Usage Tips
Best Practices
- Always Check Before Sharing: Develop a habit of security checking to ensure nothing is missed.
- Regularly Check Rules: As projects evolve, new custom rules might be needed.
- Stricter for Sensitive Projects: Consider adding more custom rules for particularly sensitive projects.
- Original Data Preserved: Security checks only affect shared content; local data is always preserved intact.
Rule Priority
When multiple rules match the same content, they are processed in the following priority:
- Custom Rules take precedence over Built-in Rules.
- More Specific Rules take precedence over Broader Rules.
- Later Added Rules take precedence over Earlier Added Rules.
Example
Suppose you have two rules:
- Built-in Rule: Matches all
@*.comemails. - Custom Rule: Keeps
@public.comemails unredacted.
When encountering [email protected], the Custom Rule takes precedence, and the email will not be redacted.
FAQ
Can original content be seen after redaction?
No. Redaction is a one-way operation. Hidden content cannot be recovered from the shared copy.
But rest assured, your local original data is not modified. Redaction only affects the shared copy; you can view the complete original content at any time.
How to bulk redact multiple projects?
Currently, projects need to be redacted and shared one by one. Bulk operation features are being planned.
Workaround: You can set up all necessary redaction rules first, so the same rules will automatically apply when sharing different projects.
What if custom rules don't work?
Possible causes and solutions:
Rule Syntax Error
- Check if the matching pattern correctly uses
*and?symbols. - Try testing with a simpler pattern.
- Check if the matching pattern correctly uses
Overridden by Other Rules
- Check if higher priority rules are affecting the match.
- Try adjusting rule order.
Need Re-preview
- After modifying rules, you need to click Preview again to see the effect.
- Ensure rule changes are saved.
How to recover content before redaction?
If you need to view the original content:
- Local Data: Just open the project directly; local data is never modified.
- Shared Content: Cannot be recovered, which is the security guarantee of the redaction feature.
If you want to reshare with new redaction settings, simply redact and share the original project again.
Does redaction affect project readability?
Mantra's redaction design tries to maintain content readability:
- Preserves Context: Only hides sensitive info itself, not affecting surrounding descriptive text.
- Smart Replacement: Uses meaningful placeholders (like
sk-****) instead of complete deletion. - Structure Maintained: Code blocks, lists, etc., formats are unaffected.
Therefore, even after redaction, conversation logs remain valuable for reference.
Next Steps
- Time Travel - Go back to any historical moment
- Message Filtering - Filter conversation messages by condition
- Shortcuts Reference - Improve efficiency
