Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
- Nothing yet
- WASM compatibility support using `chrono` with `wasmbind` feature
- `validation_test.rs` in new `tests/` directory

### Changed
- Nothing yet
- Replaced `std::time` usage with `chrono` for WASM compatibility

### Deprecated
- Nothing yet
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ lazy_static = "1.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
unicode-normalization = "0.1"
chrono = { version = "0.4", features = ["wasmbind", "serde"] }

# Optional tracing support
tracing = { version = "0.1", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ Licensed under the MIT License. See [LICENSE](LICENSE) for details.

## Security

To report security vulnerabilities, please email security@asgardtech.com.
To report security vulnerabilities, please email security@redasgard.com.

**Do not** open public GitHub issues for security vulnerabilities.

6 changes: 2 additions & 4 deletions src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ impl ValidationEngine {
issues,
warnings,
output_size: output.len(),
validation_timestamp: std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_secs(),
validation_timestamp: chrono::Utc::now().timestamp() as u64,
}
}

Expand Down Expand Up @@ -253,3 +250,4 @@ impl ValidationResult {
self.issues.iter().filter(|i| matches!(i.severity, ValidationSeverity::High | ValidationSeverity::Critical)).collect()
}
}

14 changes: 14 additions & 0 deletions tests/validation_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use llm_security::{ValidationEngine, LLMSecurityConfig};

#[test]
fn test_validation_timestamp() {
let config = LLMSecurityConfig::default();
let engine = ValidationEngine::new(config);
let result = engine.validate_output_comprehensive("There are two r's in 'strawberry'.");

assert!(result.validation_timestamp > 0);
// Check if timestamp is recent (within last hour) - simplified check
let now = chrono::Utc::now().timestamp() as u64;
assert!(result.validation_timestamp <= now);
assert!(result.validation_timestamp > now - 3600);
}