Bulletin Tools
Find a file
Benjamin Slingo 9f0c008345 Security hardening: defense-in-depth improvements
While these issues require API compromise to exploit, added multiple
layers of defense to prevent privilege escalation:

CRITICAL FIXES:
- Path traversal protection: Sanitize filenames to prevent ../../ attacks
- DoS prevention: Limit cover image size to 10MB

HIGH PRIORITY FIXES:
- Flexible browser configuration: Support BULLETIN_CHROME_PATH env var
- Windows support: Add default Brave path for Windows
- HTTPS enforcement: Warn when using HTTP for remote APIs
- Temp file security: Use process-specific directories with restricted permissions
- Complete cleanup: Remove entire temp directory instead of just files

All fixes maintain existing functionality with graceful error handling.
2025-11-29 13:41:20 -05:00
bulletin-generator Security hardening: defense-in-depth improvements 2025-11-29 13:41:20 -05:00
bulletin-input Replace hardcoded pastor detection with user prompt and fix CSV reference 2025-11-13 16:12:25 -05:00
data-upload-tools Migrate to church-core and implement security hardening 2025-11-03 18:19:23 -05:00
.env.example Migrate to church-core and implement security hardening 2025-11-03 18:19:23 -05:00
.gitignore Improve bulletin-input UX and fix pastor assignment logic 2025-10-24 18:09:22 -04:00
autoprintbulletin.sh Initial commit with major improvements 2025-08-21 20:17:54 -04:00
Cargo.toml Migrate to church-core and implement security hardening 2025-11-03 18:19:23 -05:00
LICENSE Add MIT License with Benjamin Slingo copyright 2025-08-21 20:19:11 -04:00
README.md Migrate to church-core and implement security hardening 2025-11-03 18:19:23 -05:00
SERMON_FORMAT.md Initial commit with major improvements 2025-08-21 20:17:54 -04:00

Bulletin Tools - Rust Implementation

This is a Rust rewrite of the Python church bulletin generation system. The system consists of two main binaries that work with a REST API to create and generate church bulletins.

Project Structure

  • bulletin-input/ - Binary for creating bulletin data entries

    • Fetches schedule data from REST API
    • Prompts for sermon details
    • Creates bulletin records via REST API
  • bulletin-generator/ - Binary for generating PDF bulletins

    • Fetches bulletin data from REST API
    • Renders HTML templates
    • Generates PDF using headless Chrome
    • Uploads PDF back via REST API

This project now uses the church-core library (https://git.rockvilletollandsda.church/RTSDA/church-core.git) which contains shared functionality including:

  • Configuration management
  • REST API client implementation
  • Data models (Bulletin, Event, Personnel)

Data Files

The data/ directory contains:

  • Quarterly schedule2021 - 2025.csv - Personnel assignments
  • 2025 Offering and Sunset Times Chart.txt - Conference offering schedule and sunset times
  • KJV.json - King James Version Bible text for scripture lookups

Configuration

The shared configuration is in shared/config.toml:

church_name = "Your Church Name"
# Optional contact information for templates
# contact_phone = "555-123-4567"
# contact_website = "yourchurchwebsite.org"
# contact_youtube = "youtube.com/yourchurchchannel"
# contact_address = "123 Church St, Your City, ST 12345"

This system requires a REST API backend for bulletin management. Authentication is configured via username/password in the .env file:

  • BULLETIN_API_USERNAME - Your API username
  • BULLETIN_API_PASSWORD - Your API password

The backend uses PASETO tokens for session management.

Usage

Building

cargo build --release

Bulletin Input

# Use upcoming Saturday (default)
cargo run --bin bulletin-input

# Specify a date
cargo run --bin bulletin-input -- --date 2025-06-21

# Use different location for sunset times
cargo run --bin bulletin-input -- --location "springfield"

Bulletin Generation

# Generate for upcoming Saturday
cargo run --bin bulletin-generator

# Specify a date
cargo run --bin bulletin-generator -- --date 2025-06-21

# Don't upload to PocketBase (local only)
cargo run --bin bulletin-generator -- --no-upload

# Custom output directory
cargo run --bin bulletin-generator -- --output-dir custom_output

Templates

The bulletin templates are located in bulletin-generator/templates/:

  • bulletin_template.html - Jinja2-style template for the bulletin layout
  • style.css - CSS styling for the PDF output

Dependencies

Key Rust dependencies:

  • tokio - Async runtime
  • reqwest - HTTP client for PocketBase API
  • serde - Serialization/deserialization
  • chrono - Date/time handling
  • tera - Template engine
  • headless_chrome - PDF generation
  • csv - CSV parsing
  • regex - Text parsing

Migration from Python

This Rust implementation maintains full compatibility with the original Python system:

  • Uses the new REST API backend
  • Processes the same data files
  • Generates identical bulletin layouts
  • Follows the same workflow

The main benefits of the Rust version:

  • Faster execution
  • Single binary deployment
  • Better error handling
  • Type safety
  • Reduced runtime dependencies