Mario Bros YAML Cheat Sheet for DevOps and Security Engineers
Introduction
This year has been all about leveling up my DevOps skills. I completed several training modules from GitLab, worked on personal projects, and am currently diving head first into GitHub Actions. With that being said, learning YAML has been high on my list. As configuration files become more complex mastering YAML syntax while keeping security best practices in mind has become essential. I’ve put together this Mario Bros-themed cheat sheet (I am a huge Nintendo fan) to make the learning process more engaging while covering the key concepts every DevOps security engineer should know.
Basic YAML Structure
Document Start/End
---# Start of YAML document (like starting World 1-1!)princess: peachcastle: another...# End of document (flagpole reached!)
Key-Value Pairs (Power-Up Basics)
---hero: mariosidekick: luigienemy: bowserpower_level: 9001has_fire_flower: truecoins_collected: 2500
Security-First Examples
Secure Configuration Management
---# ✅ GOOD: Using environment variables for secretsmario_config: name: mario password: ${MARIO_PASSWORD} # Never hardcode! api_key: ${SUPER_MARIO_API_KEY}
# BAD: Hardcoded secrets (Bowser can see these!)# password: "princess_peach_123"# api_key: "sk-12345678901234567890"
Container Security (Pipe Network)
---pipe_network: image: "mario/super-plumber:v1.2.3" # Always pin versions! security_context: run_as_non_root: true run_as_user: 1000 # Don't run as root Mario! read_only_root_filesystem: true allow_privilege_escalation: false resources: limits: memory: "512Mi" # Prevent memory bomb-ombs cpu: "500m" requests: memory: "256Mi" cpu: "250m"
Data Types (Power-Up Collection)
Strings (Dialogue Boxes)
---# Unquoted stringsprincess_message: Thank you Mario! But our princess is in another castle!
# Quoted strings (escape sequences work)mario_speech: "It's-a me, Mario!\nLet's-a go!"
# Single quotes (literal - no escaping)luigi_speech: 'Mama mia! That\'s a big Goomba!'
# Multi-line stringsbowser_monologue: | Gwahahaha! You'll never save Princess Peach! My fortress is impenetrable! Prepare to face my Koopa army!
# Folded strings (line breaks become spaces)game_description: > Super Mario Bros is a platform game where Mario must rescue Princess Peach from Bowser's castle by jumping on enemies and collecting power-ups.
Numbers (Score System)
---# Integerslives_remaining: 3coins_collected: 2847current_world: 8current_level: 4
# Floatsjump_height: 4.5speed_multiplier: 1.75
# Scientific notationtotal_points: 1.23e+6
# Special valuesinfinite_lives: .infundefined_score: .nan
Booleans (Power-Up Status)
---has_super_mushroom: truehas_fire_flower: falseis_invincible: Truecan_fly: yesunderground_level: onboss_defeated: off
Null Values (Missing Items)
---star_power: nullextra_life: ~magic_mushroom:
Lists and Arrays (Item Collections)
Inline Arrays
---power_ups: [mushroom, fire_flower, star, leaf]world_names: ["Grass Land", "Desert Land", "Water Land", "Giant Land"]
Multi-line Arrays
---mario_enemies: - goomba - koopa_troopa - piranha_plant - hammer_bro - lakitu - bowser
security_scan_results: - type: "vulnerability" severity: "high" description: "Hardcoded Koopa shell in config" - type: "misconfiguration" severity: "medium" description: "Warp pipe left open to public"
Dictionaries and Objects (Castle Structure)
Inline Dictionaries
---mario_stats: {strength: 85, speed: 90, jump: 95, lives: 3}
Nested Dictionaries
---bowsers_castle: location: "World 8-4" difficulty: expert traps: lava_pits: 12 moving_platforms: 8 fake_bowsers: 7 boss: name: "King Bowser" health: 100 attacks: ["fire_breath", "ground_pound", "shell_spin"] weakness: "jump_on_head" security: firewall_enabled: true intrusion_detection: active backup_system: "multiple_castles"
Security Best Practices (Defensive Power-Ups)
Kubernetes Security Policies
---apiVersion: v1kind: Podmetadata: name: mario-pod labels: hero: mario game: super-mario-brosspec: securityContext: runAsNonRoot: true runAsUser: 1001 fsGroup: 2000 containers: - name: mario-container image: nintendo/mario:latest securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: - ALL add: - NET_BIND_SERVICE # Only for pipe network access env: - name: PRINCESS_LOCATION valueFrom: secretKeyRef: name: castle-secrets key: princess-coordinates
CI/CD Pipeline Security
---name: "Super Mario Deployment Pipeline"on: push: branches: [main, world-*]
jobs: security_scan: runs-on: mushroom-kingdom-runner steps: - name: "Scan for Koopa Trojan" run: | trivy image nintendo/mario:${{ github.sha }}
- name: "Check for hardcoded coins" run: | grep -r "coin.*[0-9]{4,}" . && exit 1 || echo "No hardcoded coins found!"
- name: "Validate power-up configurations" run: | yamllint config/power-ups.yml
deploy: needs: security_scan environment: production steps: - name: "Deploy to Mushroom Kingdom" env: CASTLE_ACCESS_KEY: ${{ secrets.CASTLE_ACCESS_KEY }} WARP_PIPE_TOKEN: ${{ secrets.WARP_PIPE_TOKEN }} run: | kubectl apply -f k8s/mario-deployment.yml
Common Security Pitfalls (Avoid These Goombas!)
What NOT to do:
---# DON'T: Hardcode secretsdatabase_password: "princess_peach_123"api_key: "sk-bowser-castle-key-123456"
# DON'T: Use latest tags in productioncontainer_image: "mario/game:latest"
# DON'T: Run as rootsecurity_context: runAsUser: 0 # This is root Mario - very dangerous!
# DON'T: Allow all privilegescontainers: securityContext: privileged: true # Bowser's dream come true!
What TO do:
---# DO: Use environment variables for secretsdatabase_password: ${DB_PASSWORD}api_key: ${MARIO_API_KEY}
# DO: Pin specific versionscontainer_image: "mario/game:v2.1.3"
# DO: Use non-root userssecurity_context: runAsUser: 1000 runAsNonRoot: true
# DO: Limit privilegescontainers: securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: ["ALL"]
Advanced YAML Features (Special Items)
Anchors and Aliases (Warp Pipes for Code Reuse)
---# Define an anchor (like placing a warp pipe)mario_defaults: &mario_config type: plumber hat_color: red overalls_color: blue special_ability: jump
# Use the alias (warp to the config)characters: mario: <<: *mario_config name: "Mario Mario"
luigi: <<: *mario_config name: "Luigi Mario" hat_color: green overalls_color: green
Multi-Document Files (Multiple Worlds)
---# World 1: Grass Landworld: 1theme: grasslevels: 8boss: "King Koopa"...---# World 2: Desert Landworld: 2theme: desertlevels: 8boss: "Desert King"...
Quick Reference Card
Feature | Example | Security Note |
---|---|---|
Secrets | password: ${SECRET} | Never hardcode! |
Comments | # This is secure | Document security choices |
Multi-line | description: | | Use for security policies |
Lists | - item1 | Validate all entries |
Booleans | enabled: true | Be explicit with security flags |
Null | value: null | Handle missing configs safely |