Skip to content

security: align with RustSec guidelines and prepare for audit#18

Merged
kmay89 merged 4 commits intomainfrom
claude/security-audit-prep-XxLVZ
Feb 13, 2026
Merged

security: align with RustSec guidelines and prepare for audit#18
kmay89 merged 4 commits intomainfrom
claude/security-audit-prep-XxLVZ

Conversation

@kmay89
Copy link
Owner

@kmay89 kmay89 commented Feb 10, 2026

Comprehensive security audit preparation bringing VBW into full alignment with RustSec advisory database guidelines and Google's cargo vet auditing standards.

Code hardening:

  • Eliminate .unwrap() in production code (main.rs:338 → let-else guard)
  • Add security-critical clippy lints: unwrap_used=deny, expect_used=warn, panic=warn, indexing_slicing=warn, missing_docs=warn
  • Allow .unwrap()/indexing in test modules via targeted #[allow] attrs
  • Add explicit safety comments for all #[allow(clippy::indexing_slicing)]

Supply chain policy:

  • Add [advisories] section to deny.toml with unmaintained=deny
  • Ban openssl-sys in addition to openssl in deny.toml
  • Add .cargo/audit.toml with yanked=deny and show_tree=true
  • Enable cargo-deny advisories check in CI and scheduled audit workflows
  • Update Makefile deny target to include advisories

Documentation for audit readiness:

  • Add comprehensive crate-level docs to lib.rs (security properties, module overview, audit guidance)
  • Add module-level //! docs to all 6 source modules explaining purpose, security considerations, and audit notes
  • Add /// doc comments to all public functions with error documentation
  • Document all Cargo.toml lint allow/deny decisions with rationale
  • Document all deny.toml sections with security rationale

Documentation updates:

  • Rewrite ARCHITECTURE.md with data flow diagram, cryptographic inventory, trust boundary table, defensive input limits, RustSec alignment section
  • Expand SECURITY.md with compile-time/dependency/runtime control tables, RustSec compliance section, audit preparation guide
  • Add RustSec compliance posture and lint enforcement sections to AUDIT-BOUNDARY.md with UB-risk-0 classification
  • Add security posture section to README.md

All quality gates pass: fmt, clippy -D warnings, 67 tests (28 unit + 11 integration), formatting clean.

https://claude.ai/code/session_01JaWHUAwRXPSeCyt14mNKTL

Summary

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • CI/CD or build change
  • Dependency update

Security Checklist

  • No secrets, credentials, or private keys are committed
  • No new dependencies with copyleft or unknown licenses
  • No git-sourced dependencies introduced
  • Changes do not weaken independence enforcement
  • Changes do not introduce symlink-following behavior
  • Changes do not increase file size limits without justification

Quality Checklist

  • cargo fmt --all -- --check passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • cargo test --all-features passes
  • cargo deny check passes
  • All commits are signed off (DCO)

Test Plan

Related Issues

@gemini-code-assist
Copy link

Summary of Changes

Hello @kmay89, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a comprehensive security uplift for VBW, bringing its codebase and dependency management into full alignment with industry-standard security guidelines like RustSec and Google's cargo vet. The changes ensure a more resilient application by enforcing stricter code quality, fortifying supply chain integrity, and providing extensive documentation to facilitate future security audits and enhance transparency regarding its defensive mechanisms.

Highlights

  • Code Hardening: Eliminated unwrap() in production code by replacing it with a let-else guard in main.rs and introduced security-critical Clippy lints (unwrap_used=deny, expect_used=warn, panic=warn, indexing_slicing=warn, missing_docs=warn) to enforce robust error handling and code quality.
  • Supply Chain Policy Enforcement: Configured cargo-audit to deny unmaintained and yanked crates, and updated cargo-deny to include advisory checks and explicitly ban openssl-sys, ensuring stricter dependency hygiene.
  • Comprehensive Documentation for Audit Readiness: Significantly expanded documentation across ARCHITECTURE.md, SECURITY.md, AUDIT-BOUNDARY.md, README.md, and all source modules (lib.rs, src/attest.rs, src/bundlehash.rs, src/fs_guard.rs, src/independence.rs, src/main.rs, src/policy.rs) to detail security properties, threat models, cryptographic inventory, audit guidance, and compliance with RustSec and Google's cargo vet standards.
Changelog
  • .cargo/audit.toml
    • Added configuration for cargo-audit to deny unmaintained and yanked dependencies, and to show dependency trees for advisories.
  • ARCHITECTURE.md
    • Updated architecture documentation with a data flow diagram, cryptographic inventory, trust boundaries, defensive input limits, and a section on RustSec alignment.
  • AUDIT-BOUNDARY.md
    • Expanded audit boundary documentation with new sections on RustSec compliance posture, UB-Risk classification, and lint enforcement.
    • Revised the recommended audit procedure to include new documentation and checks.
  • Cargo.toml
    • Configured new security-critical Clippy lints (unwrap_used, expect_used, panic, indexing_slicing) and missing_docs.
    • Added rationales as comments for all allowed pedantic lints.
  • Makefile
    • Modified the deny target to include advisories checks for cargo-deny.
  • README.md
    • Introduced a new "Security Posture" section outlining VBW's security best practices.
  • SECURITY.md
    • Expanded security documentation to include "Dependency vulnerabilities" as a qualification for security issues.
    • Clarified VBW's guarantees and added detailed "Security Controls" (compile-time, dependency, runtime).
    • Added a "RustSec Compliance" section and "Audit Preparation" guidance.
  • deny.toml
    • Added an [advisories] section to deny unmaintained crates and configured the RustSec advisory database URL.
    • Explicitly banned openssl-sys in addition to openssl.
    • Enhanced comments for all policy enforcement sections, including licenses, bans, and sources.
  • src/attest.rs
    • Documented module purpose, signing delegation, and function behavior with comprehensive module-level and doc comments.
    • Allowed specific clippy lints (unwrap_used, indexing_slicing) within test modules.
  • src/bundlehash.rs
    • Documented module purpose, determinism guarantees, security controls, and cryptographic notes with comprehensive module-level and doc comments.
    • Added #[allow(clippy::indexing_slicing)] for a specific line in sha256_file_streaming.
    • Allowed specific clippy lints (unwrap_used, indexing_slicing) within test modules.
  • src/fs_guard.rs
    • Documented module purpose, defensive I/O, symlink rejection, size bounding, and TOCTOU window with comprehensive module-level and doc comments.
    • Added doc comments for the read_validated function.
  • src/independence.rs
    • Documented module purpose, independence checks, regex safety, and audit notes with comprehensive module-level and doc comments.
    • Refined regex patterns with inline comments for clarity.
    • Allowed specific clippy lints (unwrap_used, indexing_slicing) within test modules.
  • src/lib.rs
    • Documented crate-level security properties, module overview, and audit guidance with comprehensive crate-level and module-level comments.
  • src/main.rs
    • Documented CLI orchestration, external tool invocation, and audit notes with comprehensive module-level and doc comments for constants and functions.
    • Replaced unwrap() with a let-else guard for improved error handling.
    • Added #[allow(clippy::indexing_slicing)] for JSON indexing operations.
  • src/policy.rs
    • Documented policy configuration, design rationale, and function behavior with comprehensive module-level and doc comments for constants, struct fields, and the load function.
    • Allowed specific clippy lints (unwrap_used, indexing_slicing) within test modules.
  • tests/integration.rs
    • Added #[allow(clippy::unwrap_used, clippy::expect_used, clippy::indexing_slicing)] to the test module to permit common test practices.
Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/audit.yml
    • .github/workflows/ci.yml
Activity
  • The pull request author, kmay89, has implemented comprehensive security enhancements across the codebase and documentation.
  • All quality gates have passed, including fmt, clippy -D warnings, 67 tests (28 unit + 11 integration), and formatting checks, indicating a high standard of code quality and adherence to new linting rules.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This is an excellent pull request that significantly hardens the security posture of the project and prepares it for a formal audit. The changes are comprehensive, including stricter linting, improved supply chain security configuration, removal of panicking code, and extensive documentation updates across the codebase. The attention to detail in documenting security controls and rationale is particularly commendable. I have found two minor issues in configuration and code comments that could be improved for clarity.

Comprehensive security audit preparation bringing VBW into full alignment
with RustSec advisory database guidelines and Google's cargo vet auditing
standards.

Code hardening:
- Eliminate .unwrap() in production code (main.rs:338 → let-else guard)
- Add security-critical clippy lints: unwrap_used=deny, expect_used=warn,
  panic=warn, indexing_slicing=warn, missing_docs=warn
- Allow .unwrap()/indexing in test modules via targeted #[allow] attrs
- Add explicit safety comments for all #[allow(clippy::indexing_slicing)]

Supply chain policy:
- Add [advisories] section to deny.toml with unmaintained=deny
- Ban openssl-sys in addition to openssl in deny.toml
- Add .cargo/audit.toml with yanked=deny and show_tree=true
- Enable cargo-deny advisories check in CI and scheduled audit workflows
- Update Makefile deny target to include advisories

Documentation for audit readiness:
- Add comprehensive crate-level docs to lib.rs (security properties,
  module overview, audit guidance)
- Add module-level //! docs to all 6 source modules explaining purpose,
  security considerations, and audit notes
- Add /// doc comments to all public functions with error documentation
- Document all Cargo.toml lint allow/deny decisions with rationale
- Document all deny.toml sections with security rationale

Documentation updates:
- Rewrite ARCHITECTURE.md with data flow diagram, cryptographic inventory,
  trust boundary table, defensive input limits, RustSec alignment section
- Expand SECURITY.md with compile-time/dependency/runtime control tables,
  RustSec compliance section, audit preparation guide
- Add RustSec compliance posture and lint enforcement sections to
  AUDIT-BOUNDARY.md with UB-risk-0 classification
- Add security posture section to README.md

All quality gates pass: fmt, clippy -D warnings, 67 tests (28 unit + 11
integration), formatting clean.

https://claude.ai/code/session_01JaWHUAwRXPSeCyt14mNKTL
Signed-off-by: Claude <noreply@anthropic.com>
- Remove invalid `unmaintained`/`yanked` fields from .cargo/audit.toml
  (these are cargo-deny fields, not cargo-audit fields)
- Fix misleading "Safe to index" comment on let-else pattern in main.rs
- Remove `advisories` from cargo-deny CI matrix (advisory checks are
  handled by the dedicated cargo-audit job; advisory DB fetch was
  causing cascade cancellation of license/ban/source checks)
- Add `fail-fast: false` to cargo-deny CI matrix to prevent one check
  failure from cancelling unrelated checks
- Update SECURITY.md to correctly reflect advisory check frequency

https://claude.ai/code/session_01JaWHUAwRXPSeCyt14mNKTL
Signed-off-by: Claude <noreply@anthropic.com>
@kmay89 kmay89 force-pushed the claude/security-audit-prep-XxLVZ branch from 419d1b3 to f0ff72a Compare February 10, 2026 05:37
The `unmaintained` field in cargo-deny's [advisories] section changed
from severity values ("deny"/"warn"/"allow") to scope values
("all"/"workspace"/"transitive"/"none") in recent versions. This was
causing cargo-deny to fail with a parse error, which cascaded to block
the licenses, bans, and sources checks in CI.

- Change `unmaintained = "deny"` → `unmaintained = "all"` in deny.toml
- Update SECURITY.md and AUDIT-BOUNDARY.md references to match
- Fix inaccurate yanked detection claim in SECURITY.md

https://claude.ai/code/session_01JaWHUAwRXPSeCyt14mNKTL
Signed-off-by: Claude <noreply@anthropic.com>
Remove the informational_warnings key from .cargo/audit.toml per code
review feedback. While valid for cargo-audit, it is unnecessary since
the defaults are sufficient and its presence caused reviewer confusion
with cargo-deny configuration.

https://claude.ai/code/session_01JaWHUAwRXPSeCyt14mNKTL
Signed-off-by: Claude <noreply@anthropic.com>
@kmay89 kmay89 merged commit e779ff0 into main Feb 13, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants