Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gshark

> 前端框架
Open source

Scan for sensitive information easily and effectively.

1.0K stars0 likes1 views
WebsiteGitHub

About

Scan for sensitive information easily and effectively.

GShark

Scan for sensitive information easily and effectively.

GShark

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.

Key Features

  • Multi-Platform Support: GitHub, GitLab, Sourcegraph, Postman, and more
  • Flexible Rule Management: Custom scanning rules and filtering with whitelist/blacklist support
  • Fine-grained Access Control: Configurable menu and API permissions
  • Subdomain Discovery: Integrated gobuster for subdomain enumeration
  • Docker Deployment: Containerized deployment for easy setup
  • Vue 3 Management Interface: Vite-powered web interface for task and result management
  • Resilient Scanning: automatic retry after GitHub rate limiting, and automatic fallback to a per-project crawl when GitLab global search isn't available

Quick start

Default login after initialization (if not customized):

gshark / gshark

Change the default password immediately after a non-local deployment.

Set a custom admin account via script/CLI flags (no browser init page required):

bash
./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!'

Docker Deployment

bash
# 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-scan is used. If you start the scanner manually with Docker Compose, wait until database initialization completes first.

[!TIP] Without --with-scan, sign in at http://localhost:8080, configure tokens and rules, then run docker 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 Operations

bash
docker compose ps
docker compose up -d scan
docker compose logs -f server scan
docker compose restart scan
docker compose stop scan

Release Package Deployment

This option requires MySQL, Nginx, curl, jq, and unzip on macOS or Linux.

bash
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.zip

Manual Deployment

Requirements

  • Nginx
  • MySQL 8.0+
  • Go 1.25+ for building the backend
  • Node.js 20+ and npm for building the frontend

It 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.

Nginx

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:

bash
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:

bash
sudo nginx -t
# Homebrew macOS
brew services restart nginx
# Linux with systemd
sudo systemctl restart nginx

Server service

bash
cp config-temp.yaml config.yaml
# Edit config.yaml and set the MySQL connection before starting the service.
./gshark serve

The 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.

Scan service

bash
./gshark scan

Configure the required platform tokens and rules before starting the scan service.

Incremental Deployment

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.

Development

Server

bash
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:

bash
./gshark serve

Run the scan task in another terminal after configuring tokens and rules:

bash
./gshark scan

For development without producing a binary, use go run:

bash
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=1 when running or building the backend if you need CPU usage percentages:

bash
CGO_ENABLED=1 go run main.go serve

Web

bash
cd ../web
npm install
npm run serve

Usage

Add Token

GitHub

Create 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.

Rule Configuration

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 API

One 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.

Filter Configuration

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.

Scan operation

  1. Initialize the database and sign in to the web UI.
  2. Configure valid platform tokens and enable the required rules. Add a local match regex when a broad provider query needs stricter evidence validation.
  3. Start the scanner with docker compose up -d scan for Docker deployments, or ./gshark scan for manual deployments.
  4. Check the scan log page or run docker compose logs -f scan to confirm each provider completes successfully.
  5. Review findings in the result page, confirm genuine secrets, ignore placeholders and false positives, and export results when needed.

Configuration

For manual deployments, copy config-temp.yaml to config.yaml, then configure the database and other settings for your environment.

GitLab Base URL

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).

Sourcegraph global code search

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.

AI pre-ingest filtering

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:

yaml
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-plus

The 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.

Local context matching

Rules may optionally define matchPattern from the rules page. Keep content as the provider search express

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gogit-leakgithubgitlabgo

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category前端框架
PricingOpen source

> Related tools

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架