Communitygithub.com

bg-szy/TOP-SKILLS

Configura e executa o Ruzzy, o fuzzer Ruby orientado por cobertura da Trail of Bits e o único pronto para produção para a linguagem. Abrange estrutura de harness, fuzzing de Ruby puro e extensões C nativas em gems, além de compilações com sanitizadores. Use ao fazer fuzzing de uma biblioteca ou gem Ruby, testar uma extensão C do Ruby quanto à segurança de memória ou perguntar como fazer fuzzing em Ruby.

O que é TOP-SKILLS?

Esta habilidade configura e utiliza o Ruzzy, um fuzzer orientado por cobertura para Ruby desenvolvido pela Trail of Bits e construído sobre o libFuzzer. O Ruzzy é atualmente o único fuzzer pronto para produção para Ruby, suportando tanto código Ruby puro quanto extensões C nativas, com integração de sanitizadores como AddressSanitizer (ASan) e UndefinedBehaviorSanitizer (UBSan) para detectar corrupção de memória e comportamento indefinido. A habilidade cobre desde a instalação, escrita de harnesses (com scripts separados para Ruby puro e arquivos únicos para extensões C), compilação de gems com flags de sanitizadores, até a execução de campanhas de fuzzing com opções de corpus e reprodução de crashes. É útil para desenvolvedores que precisam testar a segurança e robustez de bibliotecas Ruby, gems com extensões nativas ou qualquer código Ruby que lide com entradas não confiáveis, oferecendo um guia prático e detalhado para integração com ferramentas de análise dinâmica.

Funciona com~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/bg-szy/TOP-SKILLS/tree/HEAD/skills/skills/ruzzy

Perguntar na sua IA favorita

Abre um novo chat com esta habilidade de agente já pré-carregada.

Documentação

Ruzzy

Ruzzy é um fuzzer orientado por cobertura para Ruby construído sobre o libFuzzer. Ele permite fuzzing tanto de código Ruby puro quanto de extensões C do Ruby, com suporte a sanitizadores para detecção de corrupção de memória e comportamento indefinido.

Quando Usar

Atualmente, o Ruzzy é o único fuzzer orientado por cobertura pronto para produção para Ruby.

Escolha o Ruzzy quando:

  • Fizer fuzzing de aplicações ou bibliotecas Ruby
  • Testar extensões C do Ruby quanto a problemas de segurança de memória
  • Precisar de fuzzing orientado por cobertura para código Ruby
  • Trabalhar com gems Ruby que possuem extensões nativas

Início Rápido

Configure o ambiente:

export ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0"

Teste com o exemplo de brinquedo incluso:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby -e 'require "ruzzy"; Ruzzy.dummy'

Isso deve encontrar rapidamente uma falha, demonstrando que o Ruzzy está funcionando corretamente.

Instalação

Suporte a Plataformas

O Ruzzy suporta Linux x86-64 e AArch64/ARM64. Para macOS ou Windows, use o Dockerfile ou o ambiente de desenvolvimento.

Pré-requisitos

  • Linux x86-64 ou AArch64/ARM64
  • Versão recente do clang (testada a partir da 14.0.0, recomenda-se a versão mais recente)
  • Ruby com gem instalada

Comando de Instalação

Instale o Ruzzy com as flags do compilador clang:

MAKE="make --environment-overrides V=1" \
CC="/caminho/para/clang" \
CXX="/caminho/para/clang++" \
LDSHARED="/caminho/para/clang -shared" \
LDSHAREDXX="/caminho/para/clang++ -shared" \
    gem install ruzzy

Variáveis de ambiente explicadas:

  • MAKE: Sobrescreve o make para respeitar as variáveis de ambiente subsequentes
  • CC, CXX, LDSHARED, LDSHAREDXX: Garantem o uso dos binários clang corretos para recursos mais recentes

Solução de Problemas na Instalação

Se a instalação falhar, ative a saída de depuração:

RUZZY_DEBUG=1 gem install --verbose ruzzy

Verificação

Verifique a instalação executando o exemplo de brinquedo (veja a seção Início Rápido).

Escrevendo um Harness

Fuzzing de Código Ruby Puro

O fuzzing de Ruby puro requer dois scripts devido a detalhes de implementação do interpretador Ruby.

Script tracer (test_tracer.rb):

# frozen_string_literal: true

require 'ruzzy'

Ruzzy.trace('test_harness.rb')

Script harness (test_harness.rb):

# frozen_string_literal: true

require 'ruzzy'

def fuzzing_target(input)
  # Seu código a ser fuzzeado aqui
  if input.length == 4
    if input[0] == 'F'
      if input[1] == 'U'
        if input[2] == 'Z'
          if input[3] == 'Z'
            raise
          end
        end
      end
    end
  end
end

test_one_input = lambda do |data|
  fuzzing_target(data)
  return 0
end

Ruzzy.fuzz(test_one_input)

Execute com:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby test_tracer.rb

Fuzzing de Extensões C do Ruby

Extensões C podem ser fuzzeadas com um único arquivo harness, sem necessidade de tracer.

Exemplo de harness para msgpack (fuzz_msgpack.rb):

# frozen_string_literal: true

require 'msgpack'
require 'ruzzy'

test_one_input = lambda do |data|
  begin
    MessagePack.unpack(data)
  rescue Exception
    # Estamos procurando por corrupção de memória, não exceções Ruby
  end
  return 0
end

Ruzzy.fuzz(test_one_input)

Execute com:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby fuzz_msgpack.rb

Regras do Harness

FaçaNão Faça
Capture exceções Ruby se estiver testando extensões CDeixe exceções Ruby quebrarem o fuzzer
Retorne 0 do lambda test_one_inputRetorne outros valores
Mantenha o harness determinísticoUse aleatoriedade ou lógica baseada em tempo
Use script tracer para Ruby puroPule o tracer para código Ruby puro

Veja Também: Para técnicas detalhadas de escrita de harness, padrões para lidar com entradas complexas e estratégias avançadas, consulte a habilidade técnica fuzz-harness-writing.

Compilação

Instalando Gems com Sanitizadores

Ao instalar gems Ruby com extensões C para fuzzing, compile com flags de sanitizador:

MAKE="make --environment-overrides V=1" \
CC="/caminho/para/clang" \
CXX="/caminho/para/clang++" \
LDSHARED="/caminho/para/clang -shared" \
LDSHAREDXX="/caminho/para/clang++ -shared" \
CFLAGS="-fsanitize=address,fuzzer-no-link -fno-omit-frame-pointer -fno-common -fPIC -g" \
CXXFLAGS="-fsanitize=address,fuzzer-no-link -fno-omit-frame-pointer -fno-common -fPIC -g" \
    gem install <nome-da-gem>

Flags de Compilação

FlagPropósito
-fsanitize=address,fuzzer-no-linkAtiva o AddressSanitizer e a instrumentação do fuzzer
-fno-omit-frame-pointerMelhora a qualidade do stack trace
-fno-commonMelhor compatibilidade com sanitizadores
-fPICCódigo independente de posição para bibliotecas compartilhadas
-gInclui símbolos de depuração

Executando Campanhas

Configuração do Ambiente

Antes de executar qualquer campanha de fuzzing, configure ASAN_OPTIONS:

export ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0"

Opções explicadas:

  1. allocator_may_return_null=1: Ignora falhas comuns de alocação de baixo impacto (DoS)
  2. detect_leaks=0: O interpretador Ruby vaza dados; ignore isso por enquanto
  3. use_sigaltstack=0: O Ruby recomenda desabilitar sigaltstack com ASan

Execução Básica

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb

Nota: LD_PRELOAD é necessário para a injeção do sanitizador. Ao contrário de ASAN_OPTIONS, não o exporte, pois pode interferir com outros programas.

Com Corpus

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb /caminho/para/corpus

Passando Opções do libFuzzer

Todas as opções do libFuzzer podem ser passadas como argumentos:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb /caminho/para/corpus -max_len=1024 -timeout=10

Consulte opções do libFuzzer para referência completa.

Reproduzindo Falhas

Reexecute um caso de falha passando o arquivo de falha:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb ./crash-253420c1158bc6382093d409ce2e9cff5806e980

Interpretando a Saída

SaídaSignificado
INFO: Running with entropic power scheduleCampanha de fuzzing iniciada
ERROR: AddressSanitizer: heap-use-after-freeCorrupção de memória detectada
SUMMARY: libFuzzer: fuzz target exitedExceção Ruby ocorreu
artifact_prefix='./'; Test unit written to ./crash-*Entrada de falha salva
Base64: ...Codificação Base64 da entrada de falha

Integração com Sanitizadores

AddressSanitizer (ASan)

O Ruzzy inclui uma biblioteca AddressSanitizer pré-compilada:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby harness.rb

Use ASan para detectar:

  • Estouro de buffer no heap
  • Estouro de buffer na pilha
  • Use-after-free
  • Double-free
  • Vazamentos de memória (desabilitados por padrão no Ruzzy)

UndefinedBehaviorSanitizer (UBSan)

O Ruzzy também inclui UBSan:

LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::UBSAN_PATH') \
    ruby harness.rb

Use UBSan para detectar:

  • Estouro de inteiro com sinal
  • Desreferências de ponteiro nulo
  • Acesso a memória desalinhada
  • Divisão por zero

Problemas Comuns com Sanitizadores

ProblemaSolução
Avisos de vazamento do interpretador RubyUse ASAN_OPTIONS=detect_leaks=0
Conflitos de SigaltstackUse ASAN_OPTIONS=use_sigaltstack=0
Spam de falha de alocaçãoUse ASAN_OPTIONS=allocator_may_return_null=1
LD_PRELOAD interfere com ferramentasNão o exporte; defina inline com o comando ruby

Veja Também: Para configuração detalhada de sanitizadores, problemas comuns e flags avançadas, consulte as habilidades técnicas address-sanitizer e undefined-behavior-sanitizer.

Exemplos do Mundo Real

Exemplo: msgpack-ruby

Fuzzing do analisador MessagePack msgpack para corrupção de memória.

Instale com sanitizadores:

MAKE="make --environment-overrides V=1" \
CC="/caminho/para/clang" \
CXX="/caminho/para/clang++" \
LDSHARED="/caminho/para/clang -shared" \
LDSHAREDXX="/caminho/para/clang++ -shared" \
CFLAGS="-fsanitize=address,fuzzer-no-link -fno-omit-frame-pointer -fno-common -fPIC -g" \
CXXFLAGS="-fsanitize=address,fuzzer-no-link -fno-omit-frame-pointer -fno-common -fPIC -g" \
    gem install msgpack

Harness (fuzz_msgpack.rb):

# frozen_string_literal: true

require 'msgpack'
require 'ruzzy'

test_one_input = lambda do |data|
  begin
    MessagePack.unpack(data)
  rescue Exception
    # Estamos procurando por corrupção de memória, não exceções Ruby
  end
  return 0
end

Ruzzy.fuzz(test_one_input)

Execute:

export ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0"
LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby fuzz_msgpack.rb

Exemplo: Alvo Ruby Puro

Fuzzing de código Ruby puro com um analisador personalizado.

Tracer (test_tracer.rb):

# frozen_string_literal: true

require 'ruzzy'

Ruzzy.trace('test_harness.rb')

Harness (test_harness.rb):

# frozen_string_literal: true

require 'ruzzy'
require_relative 'my_parser'

test_one_input = lambda do |data|
  begin
    MyParser.parse(data)
  rescue StandardError
    # Exceções esperadas de entrada malformada
  end
  return 0
end

Ruzzy.fuzz(test_one_input)

Execute:

export ASAN_OPTIONS="allocator_may_return_null=1:detect_leaks=0:use_sigaltstack=0"
LD_PRELOAD=$(ruby -e 'require "ruzzy"; print Ruzzy::ASAN_PATH') \
    ruby test_tracer.rb

Solução de Problemas

ProblemaCausaSolução
Instalação falhaVersão ou caminho do clang erradoVerifique o caminho do clang, use clang 14.0.0+
cannot open shared object fileLD_PRELOAD não definidoDefina LD_PRELOAD inline com o comando ruby
Fuzzer sai imediatamenteDiretório de corpus ausenteCrie o diretório de corpus ou passe-o como argumento
Sem progresso de coberturaRuby puro precisa de tracerUse script tracer para código Ruby puro
Spam de detecção de vazamentoO interpretador Ruby vazaDefina ASAN_OPTIONS=detect_leaks=0
Depuração de instalação necessáriaErros de compilaçãoUse RUZZY_DEBUG=1 gem install --verbose ruzzy

Habilidades Relacionadas

Habilidades Técnicas

HabilidadeCaso de Uso
fuzz-harness-writingOrientação detalhada sobre como escrever harnesses eficazes
address-sanitizerDetecção de erros de memória durante o fuzzing
undefined-behavior-sanitizerDetecção de comportamento indefinido em extensões C
libfuzzerEntendendo as opções do libFuzzer (o Ruzzy é construído sobre o libFuzzer)

Fuzzers Relacionados

HabilidadeQuando Considerar
libfuzzerAo fazer fuzzing de código de extensão C do Ruby diretamente em C/C++
aflppAbordagem alternativa para fuzzing Ruby instrumentando o interpretador Ruby

Recursos

Principais Recursos Externos

Apresentando o Ruzzy, um fuzzer Ruby orientado por cobertura Postagem oficial do blog da Trail of Bits anunciando o Ruzzy, cobrindo motivação, arquitetura e resultados iniciais.

Repositório GitHub do Ruzzy Código-fonte, exemplos adicionais e instruções de desenvolvimento.

Documentação do libFuzzer Como o Ruzzy é construído sobre o libFuzzer, entender as opções e o comportamento do libFuzzer é valioso.

Fuzzing de extensões C do Ruby Guia detalhado sobre fuzzing de extensões C com flags de compilação e exemplos.

Fuzzing de código Ruby puro Guia detalhado sobre o padrão de tracer necessário para fuzzing de Ruby puro.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

bg-szy/TOP-SKILLS

Brand-first landing page designer — runs a brand-identity interview (colors, typography, shape language), then generates and iterates on a polished landing page via Stitch with deployment-ready HTML. Use when the user asks to create, design, or build a landing page, homepage, or marketing page and has no established visual direction. Skip when they have a design mockup, need a dashboard or app UI, are working at component level, building a multi-page app, or restyling with known design tokens — use frontend-design instead.

bg-szy/TOP-SKILLS

Fill out Microsoft Azure Landing Zone (ALZ) Accelerator checklists by interviewing the user, mapping their Azure subscriptions, integrating IP addressing documentation, and applying Microsoft Cloud Adoption Framework best practices. Produces a completed Excel checklist (.xlsx) ready for ALZ deployment. Use this skill whenever the user mentions Azure Landing Zone, ALZ checklist, landing zone accelerator, platform landing zone configuration, ALZ bootstrap, hub-and-spoke setup, Azure network topology planning, or wants to fill out any ALZ-related checklist or configuration file. Also trigger when the user uploads an Excel file that contains tabs like "Accelerator - Bootstrap", "Accelerator - Bicep", or "Accelerator - Terraform".

bg-szy/TOP-SKILLS

Compose a premium, animated landing page section by section in Next.js + Tailwind + Motion (Framer Motion) — built on a real design system, with editorial copy and motion that feels human-crafted, not template-generated. Use when building or rebuilding a landing page, marketing site, or hero/feature/pricing/CTA sections that need to look production-ready and bespoke from day one.

bg-szy/TOP-SKILLS

Write high-converting landing page copy using proven frameworks like PAS (Problem-Agitate-Solution), AIDA, and StoryBrand. Creates headlines, value propositions, CTAs, and full page sections optimized for conversion. Use when users need landing page copy, sales page content, or marketing website text.

bg-szy/TOP-SKILLS

Optimize landing pages for conversions, performance, and SEO. Use when improving landing pages, increasing conversions, or optimizing page performance.

bg-szy/TOP-SKILLS

Review investment portfolios for risk, diversification, fees. Asset allocation recommendations, tax-loss harvesting, rebalancing.

bg-szy/TOP-SKILLS

Beads Viewer - Graph-aware triage engine for Beads projects. Computes PageRank, betweenness, critical path, and cycles. Use --robot-* flags for AI agents.

bg-szy/TOP-SKILLS

CI red? Call us. Pipeline fire brigade deploys. Use when user mentions CI failures, build errors, test failures, or pipeline issues. Do NOT load for: local builds, standard implementation work, reviews, or setup.

bg-szy/TOP-SKILLS

CASS Memory System - procedural memory for AI coding agents. Three-layer cognitive architecture with confidence decay, anti-pattern learning, cross-agent knowledge transfer, trauma guard safety system. Bun/TypeScript CLI.

bg-szy/TOP-SKILLS

Mandatory entry point: read this first for any request to make, create, edit, animate, or render a video, animation, or motion graphic, including a promo, explainer, captioned clip, title card, overlay, slideshow or interactive deck, Remotion port, or any HyperFrames HTML composition. Also use it to inspect, diagnose, validate, preview, publish, or batch-render an existing HyperFrames project. Inputs may be a website URL, GitHub PR, Figma design or URL, text or brief, existing footage, or music. It resumes project state, captures intent when applicable, selects and installs the owning workflow, and routes domain capabilities. HyperFrames is the default output framework unless the user explicitly chooses another framework for the deliverable or asks only to record a browser session.

bg-szy/TOP-SKILLS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

bg-szy/TOP-SKILLS

Use when the user asks to "pre-launch check the landing page", "run a Quality-Score preflight", or "verify ad-to-page message match before launch"; produces an ad↔page continuity report — message-match gaps, above-the-fold check, page-speed read, form-friction count, mobile-render flags — as a pass/fix punch list. Not for redesigning or rewriting the page — use landing-optimizer; not for scoring the account or the RQS — use ad-account-auditor. 落地页体验预检/广告落地页一致性检查

bg-szy/TOP-SKILLS

Use when the user asks to "optimize our landing page for influencer traffic", "fix our promo-code landing page", or "improve conversion from a creator campaign"; produces a message-match audit, page-structure and social-proof recommendations, a promo-code/CTA conversion plan, and an A/B test roadmap. Not for measuring campaign results after launch — use performance-analyzer.

bg-szy/TOP-SKILLS

Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review, critique or improve a landing page, sales page, opt-in page, product page or checkout flow, when conversion rate is low, when paid traffic is not converting, or when someone asks "why isn't this page converting" or wants a CRO / landing page review.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Account assets, equity and fund positions, P&L, cash flow records, account statements, margin ratios, buy-power estimates, order management, and DCA recurring investments via Longbridge (most require Trade permission). Frameworks: portfolio diagnosis, rebalancing, asset allocation, risk analysis (VaR/CVaR), performance attribution, and tax-loss harvesting. Triggers: "持仓", "账户", "盈亏", "资产", "对账单", "下单", "买入", "卖出", "撤单", "定投", "组合诊断", "再平衡", "资产配置", "风险分析", "绩效归因", "税损收割", "持倉", "賬戶", "盈虧", "對賬單", "下單", "買入", "賣出", "組合診斷", "再平衡", "稅損收割", "positions", "portfolio", "P&L", "order", "buy", "sell", "DCA", "statement", "risk analysis", "rebalancing", "tax harvesting", "我的风险", "持仓风险", "风险敞口", "資產", "資產配置", "風險分析", "績效歸因", "撤單

bg-szy/TOP-SKILLS

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

bg-szy/TOP-SKILLS

Process video files with audio extraction, format conversion (mp4, webm), and Whisper transcription. Use when user mentions video conversion, audio extraction, transcription, mp4, webm, ffmpeg, or whisper transcription.

Habilidades Relacionadas