Skip to content
Back to skills

2756 Query Param Auth E000b191

BSecurity

!!! warning "Security Warning" Query parameter authentication is **inherently insecure** (CWE-598). API keys in URLs may appear in proxy logs, browser history, and server access logs. Only use this authentication method when the upstream MCP server **requires** it (e.g., Tavily MCP).

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 31, 2026
securitypythonbashdockerapidatabasesecuritydocumentation

Works with

  • cli
  • api
  • mcp

Security analysis

B88/100
  • criticalExfiltrates credentials via HTTP — exact pattern from Snyk ToxicSkills study

Pro scans all 2 files and shows the line behind each finding

Scanned May 31, 2026

npx -y skills add tools-only/X-Skills --skill 2756-query-param-auth_e000b191 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2756 Query Param Auth E000b191?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2756 Query Param Auth E000b191
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2756-query-param-auth-e000b191/badge)](https://www.skillsdirectory.com/skills/tools-only-2756-query-param-auth-e000b191)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Query Parameter Authentication

## Overview

!!! warning "Security Warning"
    Query parameter authentication is **inherently insecure** (CWE-598). API keys in URLs may appear in proxy logs, browser history, and server access logs. Only use this authentication method when the upstream MCP server **requires** it (e.g., Tavily MCP).

ContextForge supports API key authentication via URL query parameters for upstream MCP servers that mandate this authentication method. This feature is disabled by default and requires explicit opt-in.

!!! tip "Admin UI URL"
    - Direct installs (`uvx`, pip, or `docker run`): `http://localhost:4444/admin/`
    - Docker Compose (nginx proxy): `http://localhost:8080/admin/`
    - Dev server (`make dev`): `http://localhost:8000/admin/`

## Use Cases

Query parameter authentication is specifically designed for:

- **Tavily MCP Server**: Requires `tavilyApiKey` as a query parameter
- Other MCP servers that mandate query parameter authentication
- Legacy APIs that don't support header-based authentication

## Prerequisites

Before using query parameter authentication, you must:

1. **Enable the feature flag** in your environment
2. **Configure the host allowlist** (recommended for production)

### Environment Configuration

```bash
# Enable query parameter authentication (required)
INSECURE_ALLOW_QUERYPARAM_AUTH=true

# Restrict to specific hosts (recommended for production)
INSECURE_QUERYPARAM_AUTH_ALLOWED_HOSTS=["mcp.tavily.com"]
```

!!! tip "Host Allowlist"
    Always configure `INSECURE_QUERYPARAM_AUTH_ALLOWED_HOSTS` in production to restrict which upstream servers can use this authentication method. An empty list `[]` allows any host.

## Configuration

### Via Admin UI

1. Navigate to the Admin Panel (see Admin UI URL above)
2. Click on the "Gateways" tab
3. When adding or editing a gateway:

   - Select **"Query Parameter (INSECURE)"** as the Authentication Type
   - Read the security warning displayed
   - Enter the **Query Parameter Name** (e.g., `tavilyApiKey`)
   - Enter the **API Key Value**
   - Submit the form to save your configuration

The Admin UI displays an inline warning when you select query-parameter authentication to highlight the security risks.

### Via API

Send a POST request to `/admin/gateways` with query parameter authentication:

```json
{
  "name": "Tavily MCP",
  "url": "https://mcp.tavily.com",
  "transport": "sse",
  "auth_type": "query_param",
  "auth_query_param_key": "tavilyApiKey",
  "auth_query_param_value": "your-tavily-api-key"
}
```

### Via Python SDK

```python
from mcpgateway.schemas import GatewayCreate

gateway = GatewayCreate(
    name="Tavily MCP",
    url="https://mcp.tavily.com",
    transport="sse",
    auth_type="query_param",
    auth_query_param_key="tavilyApiKey",
    auth_query_param_value="your-tavily-api-key"
)
```

## How It Works

When a gateway is configured with query parameter authentication:

1. **Registration**: The API key is encrypted and stored in the database
2. **Connection**: The gateway appends the decrypted API key to the URL when connecting
3. **Tool Invocation**: Each request to the upstream server includes the API key in the URL
4. **Logging**: URLs are sanitized before logging to redact sensitive query parameters

```
Original URL:  https://mcp.tavily.com
With Auth:     https://mcp.tavily.com?tavilyApiKey=your-api-key
In Logs:       https://mcp.tavily.com?tavilyApiKey=REDACTED
```

## Security Considerations

### Risks

- **Proxy Logs**: API keys may appear in proxy server access logs
- **Browser History**: If URLs are exposed to browsers, keys may be stored in history
- **Server Logs**: Upstream servers may log the full URL including query parameters
- **Network Monitoring**: Network monitoring tools may capture the full URL

### Mitigations

1. **Feature Flag**: Disabled by default, requires explicit opt-in
2. **Host Allowlist**: Restrict which hosts can use this auth method
3. **Encrypted Storage**: API keys are encrypted at rest
4. **Log Sanitization**: Sensitive query parameters are redacted in gateway logs
5. **UI Warning**: Clear security warning displayed in the Admin UI

### Recommendations

- Configure your proxy servers to redact query strings from access logs
- Use the host allowlist to restrict this auth method to specific services
- Rotate API keys regularly
- Monitor for unauthorized access to your API keys

## Troubleshooting

### "Query parameter authentication is disabled"

**Cause**: The feature flag is not enabled.

**Solution**: Set `INSECURE_ALLOW_QUERYPARAM_AUTH=true` in your environment.

### "Host not in allowed hosts"

**Cause**: The upstream host is not in the configured allowlist.

**Solution**: Add the host to `INSECURE_QUERYPARAM_AUTH_ALLOWED_HOSTS`:

```bash
INSECURE_QUERYPARAM_AUTH_ALLOWED_HOSTS=["mcp.tavily.com", "api.example.com"]
```

### API key not being sent

**Cause**: The gateway may not have the auth_query_params configured correctly.

**Solution**: Verify the gateway configuration via the API:

```bash
curl -H "Authorization: Bearer $TOKEN" \
  http://localhost:4444/admin/gateways/{gateway_id}
```

Check that `auth_type` is `query_param` and `auth_query_param_key` is set.

## Example: Tavily MCP Server

Here's a complete example of configuring the Tavily MCP server:

### 1. Enable the Feature

```bash
# .env
INSECURE_ALLOW_QUERYPARAM_AUTH=true
INSECURE_QUERYPARAM_AUTH_ALLOWED_HOSTS=["mcp.tavily.com"]
```

### 2. Register the Gateway

```bash
curl -X POST http://localhost:4444/admin/gateways \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Tavily Search",
    "url": "https://mcp.tavily.com",
    "transport": "sse",
    "auth_type": "query_param",
    "auth_query_param_key": "tavilyApiKey",
    "auth_query_param_value": "tvly-your-api-key-here"
  }'
```

### 3. Create a Virtual Server

```bash
curl -X POST http://localhost:4444/admin/servers \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Tavily Search Server",
    "gateway_ids": ["<gateway-id-from-step-2>"]
  }'
```

### 4. Use the Tools

The Tavily search tools are now available through your virtual server's MCP endpoint.

## Related Documentation

- [ADR-035: Query Parameter Authentication](../architecture/adr/035-query-parameter-authentication.md)
- [Multiple Authentication Headers](multi-auth-headers.md)
- [Gateway Configuration](../overview/ui.md)

Files in this skill

  • README.md1 KB
  • skill.md6.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.