{
  "audit_id": "aud_20261126_8f01910",
  "commit_sha": "7edc2dd123a8923db389de8772170663cb2d8e17",
  "scanner_digests": {
    "trivy": "sha256:8f6bb947dbc528902e11f2f5be52f7b519f6a39d5d148f41166f2040499768fb",
    "osv_scanner": "sha256:a70ffffc2bfd33482953e5d6b64c6fcdb30239717a07b0f0d3ab2859ce3e4cde",
    "semgrep": "sha256:67518c174185a2043fdbed16c70631b79209499b3671178e7194379b48295a0d",
    "trufflehog": "sha256:8fd07ea46a3f59583c4d50f006d8cf150530141b28969c3c34cc455cb9165a6b"
  },
  "scanner_execution": {
    "cve": true,
    "sast": true,
    "secrets": true,
    "install_hooks": true,
    "prompt_injections": true,
    "supply_chain": true
  },
  "metrics": {
    "loc_total": 153397,
    "direct_dependencies": 20,
    "transitive_dependencies": 17,
    "has_lockfile": true,
    "lockfile_names": [
      "go.sum",
      "package-lock.json"
    ],
    "unpinned_dependencies_count": 0,
    "floating_url_or_git_deps_count": 0,
    "pinning_posture": "STRICT_LOCKED",
    "has_test_files": true,
    "test_file_count": 168,
    "license_osi_approved": true
  },
  "findings": {
    "cve_critical": [],
    "cve_high": [
      {
        "id": "ST-CVE-001",
        "advisory": "CVE-2026-78661",
        "package": "golang.org/x/net",
        "installed_version": "v0.61.0",
        "fixed_version": "0.62.0",
        "source": "trivy"
      }
    ],
    "secrets_verified": [],
    "secrets_production": [],
    "secrets_test_fixtures": [
      {
        "id": "ST-SEC-001",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/token_test.go",
        "line": 42,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-002",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/token_test.go",
        "line": 45,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-003",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/token_test.go",
        "line": 50,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-004",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/token_test.go",
        "line": 53,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-005",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/token_test.go",
        "line": 58,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-006",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/token_test.go",
        "line": 61,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-007",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/token_test.go",
        "line": 224,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-008",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/pat_scope_test.go",
        "line": 69,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-009",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/pat_scope_test.go",
        "line": 80,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-010",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/pat_scope_test.go",
        "line": 91,
        "secret_hash": "***_**...",
        "severity": "LOW"
      },
      {
        "id": "ST-SEC-011",
        "rule_id": "GITHUB_PAT",
        "file": "pkg/http/middleware/pat_scope_test.go",
        "line": 171,
        "secret_hash": "***_**...",
        "severity": "LOW"
      }
    ],
    "suspicious_install_hooks": [],
    "sast_blocking": [],
    "iac_misconfigs": [],
    "prompt_injections": [],
    "supply_chain_anomalies": []
  },
  "sanitized_excerpts": [
    {
      "excerpt_id": "EX-001",
      "file": "cmd/github-mcp-server/main.go",
      "lines": "1-80",
      "content": "package main\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\t\"runtime/debug\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/github/github-mcp-server/v2/internal/buildinfo\"\n\t\"github.com/github/github-mcp-server/v2/internal/ghmcp\"\n\t\"github.com/github/github-mcp-server/v2/internal/githubapp\"\n\t\"github.com/github/github-mcp-server/v2/internal/oauth\"\n\t\"github.com/github/github-mcp-server/v2/pkg/github\"\n\tghhttp \"github.com/github/github-mcp-server/v2/pkg/http\"\n\tghoauth \"github.com/github/github-mcp-server/v2/pkg/http/oauth\"\n\t\"github.com/github/github-mcp-server/v2/pkg/utils\"\n\t\"github.com/spf13/cobra\"\n\t\"github.com/spf13/pflag\"\n\t\"github.com/spf13/viper\"\n)\n\n// These variables are set by the build process using ldflags.\nvar version = \"version\"\nvar commit = \"commit\"\nvar date = \"date\"\n\nvar (\n\trootCmd = &cobra.Command{\n\t\tUse:     \"github-mcp-server\",\n\t\tShort:   \"GitHub MCP Server\",\n\t\tLong:    `A GitHub MCP server that handles various tools and resources.`,\n\t\tVersion: fmt.Sprintf(\"Version: %s\\nCommit: %s\\nBuild Date: %s\", version, commit, date),\n\t}\n\n\tstdioCmd = &cobra.Command{\n\t\tUse:   \"stdio\",\n\t\tShort: \"Start stdio server\",\n\t\tLong:  `Start a server that communicates via standard input/output streams using JSON-RPC messages.`,\n\t\tRunE: func(cmd *cobra.Command, _ []string) error {\n\t\t\tinfo, _ := debug.ReadBuildInfo()\n\t\t\tserverVersion := resolveServerVersion(version, commit, info)\n\t\t\tif serverVersion == developmentServerVersion {\n\t\t\t\tcmd.PrintErrln(\"Warning: no usable server build version metadata; using development version dev\")\n\t\t\t}\n\n\t\t\ttoken := viper.GetString(\"personal_access_token\")\n\t\t\tappID := viper.GetString(\"app-id\")\n\t\t\tappInstallationID := viper.GetString(\"app-installation-id\")\n\t\t\tappPrivateKeyPath := viper.GetString(\"app-private-key-path\")\n\t\t\tappPrivateKeyInline := viper.GetString(\"app-private-key\")\n\t\t\tappAuthRequested := appID != \"\" || appInstallationID != \"\" || appPrivateKeyPath != \"\" || appPrivateKeyInline != \"\"\n\n\t\t\toauthClientID := viper.GetString(\"oauth-client-id\")\n\t\t\toauthClientSecret := viper.GetString(\"oauth-client-secret\")\n\t\t\t// Fall back to the build-time baked-in client (official releases) when none is\n\t\t\t// configured explicitly. The baked-in app is registered on github.com, so it is\n\t\t\t// only applied to the default host; GHES/ghe.com users must bring their own\n\t\t\t// --oauth-client-id. Recognizing the host via NormalizeHost means an explicit\n\t\t\t// GITHUB_HOST=github.com (or api.github.com) still counts as the default and keeps\n\t\t\t// zero-config login working. The secret tracks the id, so an explicitly provided\n\t\t\t// id with no secret never picks up the baked-in secret.\n\t\t\tif oauthClientID == \"\" && !appAuthRequested && oauth.NormalizeHost(viper.GetString(\"host\")) == \"https://github.com\" {\n\t\t\t\toauthClientID = buildinfo.OAuthClientID\n\t\t\t\toauthClientSecret = buildinfo.OAuthClientSecret\n\t\t\t}\n\t\t\tif token == \"\" && !appAuthRequested && oauthClientID == \"\" {\n\t\t\t\treturn errors.New(\"authentication required: set GITHUB_PERSONAL_ACCESS_TOKEN, configure GitHub App auth, or pass --oauth-client-id to log in via OAuth\")\n\t\t\t}\n\t\t\tif appAuthRequested && token != \"\" {\n\t\t\t\treturn errors.New(\"GitHub App authentication and GITHUB_PERSONAL_ACCESS_TOKEN are mutually exclusive: set only one\")\n\t\t\t}\n\t\t\tif appAuthRequested && oauthClientID != \"\" {\n\t\t\t\treturn errors.New(\"GitHub App authentication and OAuth login (--oauth-client-id) are mutually exclusive: set only one\")\n\t\t\t}\n\n\t\t\t// If you're wondering why we're not using viper.GetStringSlice(\"toolsets\"),\n\t\t\t// it's because viper doesn't handle comma-separated values correctly for env"
    },
    {
      "excerpt_id": "EX-002",
      "file": "cmd/github-mcp-server/main_test.go",
      "lines": "1-80",
      "content": "package main\n\nimport (\n\t\"os\"\n\t\"path/filepath\"\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/github/github-mcp-server/v2/pkg/github\"\n\t\"github.com/github/github-mcp-server/v2/pkg/inventory\"\n\t\"github.com/github/github-mcp-server/v2/pkg/scopes\"\n\t\"github.com/github/github-mcp-server/v2/pkg/translations\"\n\t\"github.com/google/jsonschema-go/jsonschema\"\n\t\"github.com/modelcontextprotocol/go-sdk/mcp\"\n\t\"github.com/spf13/viper\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"github.com/stretchr/testify/require\"\n)\n\nfunc TestLoadAppPrivateKey(t *testing.T) {\n\tt.Run(\"file\", func(t *testing.T) {\n\t\tpath := filepath.Join(t.TempDir(), \"app.pem\")\n\t\trequire.NoError(t, os.WriteFile(path, []byte(\"from-file\"), 0o600))\n\n\t\tkey, err := loadAppPrivateKey(path, \"from-inline\")\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, []byte(\"from-file\"), key)\n\t})\n\n\tt.Run(\"inline\", func(t *testing.T) {\n\t\tkey, err := loadAppPrivateKey(\"\", `first\\nsecond`)\n\t\trequire.NoError(t, err)\n\t\tassert.Equal(t, []byte(\"first\\nsecond\"), key)\n\t})\n\n\tt.Run(\"missing\", func(t *testing.T) {\n\t\t_, err := loadAppPrivateKey(\"\", \"\")\n\t\trequire.Error(t, err)\n\t\tassert.Contains(t, err.Error(), \"private key\")\n\t})\n}\n\nfunc TestGitHubAppFlagsAreStdioOnly(t *testing.T) {\n\tassert.NotNil(t, stdioCmd.Flags().Lookup(\"app-id\"))\n\tassert.Nil(t, httpCmd.Flags().Lookup(\"app-id\"))\n}\n\nfunc TestAuthorizationServerConfigurationIsHTTPOnly(t *testing.T) {\n\tflag := httpCmd.Flags().Lookup(\"authorization-server\")\n\trequire.NotNil(t, flag)\n\tassert.Empty(t, flag.DefValue)\n\tassert.Nil(t, stdioCmd.Flags().Lookup(\"authorization-server\"))\n\n\tt.Setenv(\"GITHUB_AUTHORIZATION_SERVER\", \"\")\n\tinitConfig()\n\tassert.Empty(t, viper.GetString(\"authorization-server\"))\n\n\tt.Setenv(\"GITHUB_AUTHORIZATION_SERVER\", \"https://oauth-proxy.example.com\")\n\tassert.Equal(t, \"https://oauth-proxy.example.com\", viper.GetString(\"authorization-server\"))\n}\n\nfunc TestWriteToolDocScopes(t *testing.T) {\n\ttool := inventory.ServerTool{\n\t\tTool:        mcp.Tool{Name: \"delete\", Annotations: &mcp.ToolAnnotations{Title: \"Delete\"}},\n\t\tScopeAccess: scopes.RequireAll(scopes.DeleteRepo, scopes.Repo),\n\t}\n\n\tvar buf strings.Builder\n\twriteToolDoc(&buf, tool)\n\tassert.Contains(t, buf.String(), \"**OAuth Challenge Scopes**: `delete_repo`, `repo`\")\n}\n\nfunc TestDependabotUpdateListScopes(t *testing.T) {\n\tfor _, readOnly := range []bool{false, true} {\n\t\tinv, err := github.NewInventory(translations.NullTranslationHelper).\n\t\t\tWithToolsets([]string{\"dependabot\"}).WithReadOnly(readOnly).Build()\n\t\trequire.NoError(t, err)\n\t\toutput := collectToolScopes(inv, readOnly)\n\t\tif readOnly {\n\t\t\tassert.NotContains(t, output.ScopesByTool, \"update_dependabot_alert\")"
    },
    {
      "excerpt_id": "EX-003",
      "file": "cmd/mcpcurl/main.go",
      "lines": "1-80",
      "content": "package main\n\nimport (\n\t\"bufio\"\n\t\"crypto/rand\"\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io\"\n\t\"math/big\"\n\t\"os\"\n\t\"os/exec\"\n\t\"slices\"\n\t\"strings\"\n\n\t\"github.com/spf13/cobra\"\n\t\"github.com/spf13/viper\"\n)\n\ntype (\n\t// SchemaResponse represents the top-level response containing tools\n\tSchemaResponse struct {\n\t\tResult  Result `json:\"result\"`\n\t\tJSONRPC string `json:\"jsonrpc\"`\n\t\tID      int    `json:\"id\"`\n\t}\n\n\t// Result contains the list of available tools\n\tResult struct {\n\t\tTools []Tool `json:\"tools\"`\n\t}\n\n\t// Tool represents a single command with its schema\n\tTool struct {\n\t\tName        string      `json:\"name\"`\n\t\tDescription string      `json:\"description\"`\n\t\tInputSchema InputSchema `json:\"inputSchema\"`\n\t}\n\n\t// InputSchema defines the structure of a tool's input parameters\n\tInputSchema struct {\n\t\tType                 string              `json:\"type\"`\n\t\tProperties           map[string]Property `json:\"properties\"`\n\t\tRequired             []string            `json:\"required\"`\n\t\tAdditionalProperties bool                `json:\"additionalProperties\"`\n\t\tSchema               string              `json:\"$schema\"`\n\t}\n\n\t// Property defines a single parameter's type and constraints\n\tProperty struct {\n\t\tType        string        `json:\"type\"`\n\t\tDescription string        `json:\"description\"`\n\t\tEnum        []string      `json:\"enum,omitempty\"`\n\t\tMinimum     *float64      `json:\"minimum,omitempty\"`\n\t\tMaximum     *float64      `json:\"maximum,omitempty\"`\n\t\tItems       *PropertyItem `json:\"items,omitempty\"`\n\t}\n\n\t// PropertyItem defines the type of items in an array property\n\tPropertyItem struct {\n\t\tType                 string              `json:\"type\"`\n\t\tProperties           map[string]Property `json:\"properties,omitempty\"`\n\t\tRequired             []string            `json:\"required,omitempty\"`\n\t\tAdditionalProperties bool                `json:\"additionalProperties,omitempty\"`\n\t}\n\n\t// JSONRPCRequest represents a JSON-RPC 2.0 request\n\tJSONRPCRequest struct {\n\t\tJSONRPC string        `json:\"jsonrpc\"`\n\t\tID      int           `json:\"id\"`\n\t\tMethod  string        `json:\"method\"`\n\t\tParams  RequestParams `json:\"params\"`\n\t}\n\n\t// RequestParams contains the tool name and arguments\n\tRequestParams struct {\n\t\tName      string         `json:\"name\"`\n\t\tArguments map[string]any `json:\"arguments\"`\n\t}\n\n\t// Content matches the response format of a text content response"
    },
    {
      "excerpt_id": "EX-004",
      "file": "cmd/mcpcurl/main_test.go",
      "lines": "1-80",
      "content": "package main\n\nimport (\n\t\"bufio\"\n\t\"encoding/json\"\n\t\"strings\"\n\t\"testing\"\n)\n\nfunc TestReadJSONRPCResponse_DirectResponse(t *testing.T) {\n\tt.Parallel()\n\tinput := `{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"tools\":[]}}` + \"\\n\"\n\tscanner := bufio.NewScanner(strings.NewReader(input))\n\n\tgot, err := readJSONRPCResponse(scanner)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\tif got != `{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"tools\":[]}}` {\n\t\tt.Fatalf(\"unexpected response: %s\", got)\n\t}\n}\n\nfunc TestReadJSONRPCResponse_SkipsNotifications(t *testing.T) {\n\tt.Parallel()\n\tinput := strings.Join([]string{\n\t\t`{\"jsonrpc\":\"2.0\",\"method\":\"notifications/resources/list_changed\",\"params\":{}}`,\n\t\t`{\"jsonrpc\":\"2.0\",\"method\":\"notifications/tools/list_changed\"}`,\n\t\t`{\"jsonrpc\":\"2.0\",\"id\":42,\"result\":{\"content\":[{\"type\":\"text\",\"text\":\"hello\"}]}}`,\n\t}, \"\\n\") + \"\\n\"\n\tscanner := bufio.NewScanner(strings.NewReader(input))\n\n\tgot, err := readJSONRPCResponse(scanner)\n\tif err != nil {\n\t\tt.Fatalf(\"unexpected error: %v\", err)\n\t}\n\n\tvar msg map[string]json.RawMessage\n\tif err := json.Unmarshal([]byte(got), &msg); err != nil {\n\t\tt.Fatalf(\"response is not valid JSON: %v\", err)\n\t}\n\t// Verify we got the response with id:42, not a notification\n\tvar id int\n\tif err := json.Unmarshal(msg[\"id\"], &id); err != nil {\n\t\tt.Fatalf(\"failed to parse id: %v\", err)\n\t}\n\tif id != 42 {\n\t\tt.Fatalf(\"expected id 42, got %d\", id)\n\t}\n}\n\nfunc TestReadJSONRPCResponse_NoResponse(t *testing.T) {\n\tt.Parallel()\n\t// Only notifications, no response\n\tinput := `{\"jsonrpc\":\"2.0\",\"method\":\"notifications/resources/list_changed\",\"params\":{}}` + \"\\n\"\n\tscanner := bufio.NewScanner(strings.NewReader(input))\n\n\t_, err := readJSONRPCResponse(scanner)\n\tif err == nil {\n\t\tt.Fatal(\"expected error for missing response, got nil\")\n\t}\n\tif !strings.Contains(err.Error(), \"unexpected end of output\") {\n\t\tt.Fatalf(\"expected 'unexpected end of output' error, got: %v\", err)\n\t}\n}\n\nfunc TestReadJSONRPCResponse_EmptyInput(t *testing.T) {\n\tt.Parallel()\n\tscanner := bufio.NewScanner(strings.NewReader(\"\"))\n\n\t_, err := readJSONRPCResponse(scanner)\n\tif err == nil {\n\t\tt.Fatal(\"expected error for empty input, got nil\")\n\t}\n}\n\nfunc TestReadJSONRPCResponse_InvalidJSON(t *testing.T) {\n\tt.Parallel()\n\tinput := \"not valid json\\n\"\n\tscanner := bufio.NewScanner(strings.NewReader(input))"
    },
    {
      "excerpt_id": "ST-METRIC-LOC",
      "file": "METRICS",
      "lines": "LOC: 153397",
      "content": "Verified total codebase lines of code: 153397"
    },
    {
      "excerpt_id": "ST-METRIC-TESTS",
      "file": "METRICS",
      "lines": "TestFiles: 168",
      "content": "Verified automated test file count: 168 (has_test_files=True)"
    },
    {
      "excerpt_id": "ST-METRIC-DEPS",
      "file": "METRICS",
      "lines": "Dependencies: 20",
      "content": "Verified dependencies: direct=20, transitive=17"
    },
    {
      "excerpt_id": "ST-METRIC-LOCK",
      "file": "METRICS",
      "lines": "Pinning: STRICT_LOCKED",
      "content": "Lockfiles: ['go.sum', 'package-lock.json'] | pinning_posture=STRICT_LOCKED | unpinned=0 | floating_git=0"
    }
  ]
}