Crates.io | nu_plugin_secret |
lib.rs | nu_plugin_secret |
version | 0.3.0 |
created_at | 2025-08-22 12:43:06.726587+00 |
updated_at | 2025-08-29 04:50:11.992307+00 |
description | Production-grade secret handling plugin for Nushell with secure CustomValue types that prevent accidental exposure of sensitive data |
homepage | https://github.com/nushell-works/nu_plugin_secret |
repository | https://github.com/nushell-works/nu_plugin_secret |
max_upload_size | |
id | 1806265 |
size | 803,510 |
Production-grade Nushell plugin for secure handling of sensitive data with 8 comprehensive secret types that prevent accidental exposure.
This plugin provides secure custom types that always display as
<redacted:type>
to prevent accidental exposure of sensitive information like
API keys, passwords, tokens, and other confidential data in logs, debug output,
or command history.
8 Secret Types: Complete coverage of Nushell's core data types
SecretString
- API keys, passwords, tokensSecretInt
- sensitive numbers, IDs, portsSecretBool
- sensitive flags, permissionsSecretRecord
- configuration objects, credentialsSecretList
- arrays of sensitive dataSecretFloat
- financial data, coordinates, measurementsSecretBinary
- certificates, keys, encrypted dataSecretDate
- timestamps, birthdates, sensitive datesMemory Safety: Automatic secure cleanup with ZeroizeOnDrop
Timing Attack Protection: Constant-time equality comparison
Type Safety: Clear distinction between secret and regular data
Pipeline Integration: Works seamlessly with Nushell data flows
Security Warnings: Built-in warnings for sensitive operations
# Build the plugin
cargo build --release
# Register with Nushell
plugin add target/release/nu_plugin_secret
plugin use secret
Convert values to secret types:
"my-api-key" | secret wrap-string # <redacted:string>
42 | secret wrap-int # <redacted:int>
true | secret wrap-bool # <redacted:bool>
{key: "value"} | secret wrap-record # <redacted:record>
["item1", "item2"] | secret wrap-list # <redacted:list>
3.14159 | secret wrap-float # <redacted:float>
0x[deadbeef] | secret wrap-binary # <redacted:binary>
date now | secret wrap-date # <redacted:date>
secret unwrap
Extract the underlying value (with security warning):
$secret_value | secret unwrap
# WARNING: Extracting sensitive data from secret type...
# Output: original value
secret validate
Check if a value is a secret type:
$value | secret validate
# Output: true/false
secret type-of
Get the underlying type without exposing content:
$secret_value | secret type-of
# Output: string, int, bool, record, list, float, binary, or date
secret info
Display plugin information and security guidance:
secret info
{:?}
) never shows sensitive content<redacted:type>
in outputunwrap
operations and pipeline functionalityThis plugin uses a dual-layer security approach:
# Secure API key handling
let $api_key = ($env.API_KEY | secret wrap-string)
http get "https://example.com/api" \
-H [Authorization $"Bearer ($api_key | secret unwrap)"]
# Database configuration with mixed types
let $db_config = {
host: "localhost",
port: (5432 | secret wrap-int),
password: ($env.DB_PASSWORD | secret wrap-string),
ssl: (true | secret wrap-bool)
}
# Financial data protection
let $balance = (1234.56 | secret wrap-float)
let $account_id = (9876543210 | secret wrap-int)
# Binary data (certificates, keys)
open cert.pem | secret wrap-binary
# Sensitive timestamps
date now | secret wrap-date
# Validate and process secrets
if ($value | secret validate) {
let $type = ($value | secret type-of)
print $"Processing secret ($type)"
}
β v0.1.1 Released: Functional Serialization & Comprehensive Testing
β
Phase 1: SecretString with core commands
β
Phase 2: SecretInt, SecretBool, SecretRecord, SecretList
β
Phase 2+: SecretFloat, SecretBinary, SecretDate
β
Phase 5: Functional serialization with dual-layer security model
β
Phase 5.6: Comprehensive testing framework and unwrap functionality
π Phase 6: CI/CD pipeline integration
π Phase 7: Security audit and production hardening
# Run all Rust tests (179+ tests)
cargo test
# Run Nushell integration tests
./scripts/run_nu_tests.sh
# Quick Nushell test
nu tests/nushell/simple_test.nu
# Check code quality
cargo clippy
cargo fmt
# Build documentation
cargo doc --open
# Performance testing
cargo test --release
BSD 3-Clause License - see LICENSE for details.
Contributions welcome! Please read our security guidelines before submitting PRs involving sensitive data handling.
This plugin is designed for defensive security purposes only. Always follow security best practices when handling sensitive data. All secret types use memory-safe implementations with automatic cleanup to prevent information leakage.