This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a vulnerable Ruby GraphQL application designed for security testing with StackHawk's HawkScan. It's a Rails 6.0 application using Ruby 2.7.8 that implements a GraphQL API for managing links, users, and votes.
The application follows standard Rails conventions with a GraphQL layer:
- Rails Application: Located in
app/directory using Rails 6.0.2.1 - GraphQL Schema: Defined in
app/app/graphql/graphql_tutorial_schema.rb - GraphQL Types: Located in
app/app/graphql/types/- includes base types, link, user, vote types - Mutations: Located in
app/app/graphql/mutations/- handles create operations for links, users, votes, and authentication - Resolvers: Located in
app/app/graphql/resolvers/- complex query logic, particularly search functionality - Models: Standard Rails models in
app/app/models/- User, Link, Vote, AuthToken - Controllers:
app/app/controllers/graphql_controller.rbserves as the GraphQL API endpoint - Database: SQLite3 with migrations in
app/db/migrate/ - Tests: Located in
app/test/using Rails minitest framework with FactoryBot
# Install dependencies
bundle install
# Setup database
rails db:setup
# Start development server
rails server
# Run tests
rails test
# Access GraphQL playground
open http://localhost:3000/graphiql# Build the application
docker-compose build
# or
docker build -t stackhawk/vuln-graphql-ruby .
# Run the application
docker-compose up
# or
docker run --name gql-ruby --rm -ti -p 3000:3000 stackhawk/vuln-graphql-ruby# Run StackHawk security scan (requires AUTH_TOKEN file)
./run_hawkscan.sh
# Manual HawkScan execution
source ./AUTH_TOKEN && docker run -e APP_HOST=http://127.0.0.1:3000 --rm -v $(pwd):/hawk:rw -ti --name hawkscan stackhawk/hawkscan:latest example-stackhawk-config.ymlapp/app/controllers/graphql_controller.rb- Main GraphQL API endpointapp/app/graphql/graphql_tutorial_schema.rb- GraphQL schema definitionapp/app/graphql/types/query_type.rb- Root queries including allLinks searchapp/app/graphql/types/mutation_type.rb- Root mutationsapp/app/graphql/resolvers/links_search.rb- Complex search functionality with filteringapp/config/application.rb- Rails configuration with CORS enabled for all originsexample-stackhawk-config.yml- StackHawk security scanning configurationdocker-entrypoint.sh- Container startup script
The application exposes a GraphQL endpoint at /graphql with:
allLinks- Search and filter links with pagination- User and vote data through link relationships
createUser- User registration with email/passwordsigninUser- Authentication returning JWT tokencreateLink- Create new links (requires authentication)createVote- Vote on links (requires authentication)
Uses JWT tokens via Authorization header. Tokens are generated through signinUser mutation.
This is intentionally vulnerable application for security testing. The CORS configuration allows all origins (origins '*') and the application may contain other security vulnerabilities by design for testing purposes.