Scan for sensitive information easily and effectively.
Scan for sensitive information easily and effectively.
GShark
Scan for sensitive information easily and effectively.
GShark is a sensitive information detection and management platform. The backend is built with Go and Gin, and the current frontend is built with Vue 3, Vite, Vue Router 4, Vuex 4, and Element Plus. For the full introduction, please refer to articles and videos. GShark scans repositories exposed by configured providers rather than local source trees.
For the usage of GShark, please refer to the wiki.
Default login after initialization (if not customized):
gshark / gsharkChange the default password immediately after a non-local deployment.
Set a custom admin account via script/CLI flags (no browser init page required):
./scripts/quick-docker.sh --admin-user myadmin --admin-password 'S3cret!'
# or
./gshark init --host 127.0.0.1 --user root --password madneal --db gshark \
--admin-user myadmin --admin-password 'S3cret!'# Clone the repository
git clone https://github.com/madneal/gshark.git
cd gshark
# Build the images, initialize MySQL, and start server/web
./scripts/quick-docker.sh
# Set a custom administrator during initialization
./scripts/quick-docker.sh --admin-user myadmin --admin-password 'S3cret!'
# Start the scanner after initialization as part of the same command
./scripts/quick-docker.sh --with-scan[!IMPORTANT] The quick Docker script starts MySQL first, initializes the database, and only then starts the scanner when
--with-scanis used. If you start the scanner manually with Docker Compose, wait until database initialization completes first.
[!TIP] Without
--with-scan, sign in athttp://localhost:8080, configure tokens and rules, then rundocker compose up -d scan. If you use--skip-init, complete database initialization in the web UI first.
The scanner container has conservative resource guardrails in docker-compose.yaml: a 512 MB memory limit, a 1 CPU limit, and Go's GOMEMLIMIT=384MiB. Scan results are persisted page by page so a large repository search does not remain fully resident in memory. If the scanner is OOM-killed, Compose restarts it automatically; monitor the actual usage with docker stats gshark-scanner before lowering the limits further.
docker compose ps
docker compose up -d scan
docker compose logs -f server scan
docker compose restart scan
docker compose stop scanThis option requires MySQL, Nginx, curl, jq, and unzip on macOS or Linux.
git clone https://github.com/madneal/gshark.git
cd gshark
# Download the latest package, configure Nginx, initialize the database,
# and start the backend
./scripts/quick-release.sh
# Or deploy a package that has already been downloaded
./scripts/quick-release.sh --file ./gshark_linux_amd64.zipIt is recommended to deploy the frontend with Nginx. Build the Vite project, place the generated web/dist files in /var/www/html, and configure Nginx to reverse proxy /api/ to the backend service. For detailed deployment tutorials, you can watch videos on bilibili or youtube. For deployment on Windows, refer to this link.
Use nginx -t to locate the active nginx.conf, then add a server configuration like this. Adjust the web root for your installation.
…Download the package for your platform from releases, then copy the complete dist directory contents to the Nginx web root:
unzip gshark*.zip
cd gshark*
sudo mkdir -p /var/www/html
sudo cp -R dist/. /var/www/html/On Homebrew macOS, the common web root is $(brew --prefix)/var/www; keep the Nginx root and copy destination consistent.
Validate and restart Nginx after changing the configuration:
sudo nginx -t
# Homebrew macOS
brew services restart nginx
# Linux with systemd
sudo systemctl restart nginxcp config-temp.yaml config.yaml
# Edit config.yaml and set the MySQL connection before starting the service.
./gshark serveThe backend listens on 8888; when Nginx is used, access the web UI through its frontend port (for example, 8080).
If you haven't initialized the database before, you will be redirected to the database initialization page first.
./gshark scanConfigure the required platform tokens and rules before starting the scan service.
Back up the database and read the release notes before upgrading. GORM applies model schema additions automatically at startup; run only the version-specific statements in sql.md when the release notes explicitly require them. Do not execute the entire file on every upgrade.
git clone https://github.com/madneal/gshark.git
cd gshark/server
go mod download
cp config-temp.yaml config.yaml
# Edit config.yaml and set the MySQL connection.
go build -o gshark .Run the web server:
./gshark serveRun the scan task in another terminal after configuring tokens and rules:
./gshark scanFor development without producing a binary, use go run:
go run main.go serve
go run main.go scan[!NOTE] On macOS ARM, CPU percentage collection in the server-info page depends on cgo. Use
CGO_ENABLED=1when running or building the backend if you need CPU usage percentages:CGO_ENABLED=1 go run main.go serve
cd ../web
npm install
npm run serveCreate a fine-grained personal access token and grant only the repositories and permissions required by your rules. Prefer a short expiration and do not reuse an administrator token. See GitHub's personal access token guidance. GitLab searches require a separate GitLab token.
GitHub and GitLab rules use the search syntax of the corresponding provider. Configure the rule content as the expression you would search for on that provider. GitHub rules reuse the same token across three surfaces:
github — repository code search (in:file)github_issue — issues and pull requests (in:title,body,comments; you can add is:issue or is:pr)gist — public Gist search; the scanner then loads matching gist files through the official Gist APIOne rule can enable several types at once, for example github,github_issue,gist.
You can download the rule import template CSV file, then batch import rules.
Filters currently apply to GitHub surfaces. keyword filters apply to github, github_issue, and gist. extension filters apply to github code search and gist search. Both classes can be configured as a blacklist or whitelist.
For more information, you can refer to this video.
docker compose up -d scan for Docker deployments, or ./gshark scan for manual deployments.docker compose logs -f scan to confirm each provider completes successfully.For manual deployments, copy config-temp.yaml to config.yaml, then configure the database and other settings for your environment.
When GitLab global search isn't available, GShark falls back to crawling recently-active public projects. search.gitlab-discover-pages and search.gitlab-batch-size in config.yaml bound how many project pages are discovered and how many projects are searched per scan cycle (defaults: 5 and 50).
The Sourcegraph provider uses the Stream API to search all repositories indexed by Sourcegraph for each rule; repositories do not need to be configured one by one. The default endpoint is the public https://sourcegraph.com instance. For a self-hosted instance, set search.sourcegraph-url in config.yaml and provide an access token through search.sourcegraph-token or SOURCEGRAPH_TOKEN. GShark explicitly includes forked and archived repositories to maximize coverage. Results remain subject to Sourcegraph's index coverage, search timeout, and result limits; any upstream limits are recorded in the scan log.
Existing rules whose type is searchcode are also picked up by this provider, so existing rule data does not need a database migration.
GShark can optionally send each new search result to one or more OpenAI-compatible Chat Completions endpoints before writing it to search_result. Configure system.ai_providers in priority order; the legacy ai_server, ai_token, and model fields remain supported as a single-provider fallback. Transport, HTTP, and authentication failures move to the next provider, while a valid real: false verdict is final. The model must return JSON in the form {"real":true|false,"confidence":0.0,"reason":"..."}. Only real: true results are persisted; malformed responses, timeouts, and API errors fail closed and are not stored. Each request uses built-in limits of 30 seconds and 6,000 characters. The feature is disabled by default.
Example:
system:
ai_analysis_enabled: true
ai_providers:
- name: primary
server: https://api.openai.com/v1/chat/completions
token: your-openai-token
model: gpt-4o-mini
- name: backup
server: https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
token: your-dashscope-token
model: qwen-plusThe system configuration page includes Test AI Config, which sends synthetic placeholder evidence to verify endpoint connectivity, authentication, model availability, and response compatibility without writing a search result. Each request uses built-in limits of 30 seconds and 6,000 characters.
Rules may optionally define matchPattern from the rules page. Keep content as the provider search express
No open issues yet, or sync has not completed.