fix: require api_token for /token endpoint when configured#1795
Closed
Br1an67 wants to merge 1 commit intounclecode:developfrom
Closed
fix: require api_token for /token endpoint when configured#1795Br1an67 wants to merge 1 commit intounclecode:developfrom
Br1an67 wants to merge 1 commit intounclecode:developfrom
Conversation
Add api_token field to security config and TokenRequest. When security.api_token is set in config.yml, the /token endpoint validates the provided api_token before issuing a JWT. Existing deployments without api_token configured are unaffected (backward compatible). Closes unclecode#1627
unclecode
added a commit
that referenced
this pull request
Mar 7, 2026
…1734, #1290, #1668) Bug fixes: - Verify redirect targets are alive before returning from URL seeder (#1622) - Wire mean_delay/max_range from CrawlerRunConfig into dispatcher rate limiter (#1786) - Use DOMParser instead of innerHTML in process_iframes to prevent XSS (#1796) Security/Docker: - Require api_token for /token endpoint when configured (#1795) - Deep-crawl streaming now mirrors Python library behavior via arun() (#1798) CI: - Bump GitHub Actions to latest versions - checkout v6, setup-python v6, build-push-action v6, setup-buildx v4, login v4 (#1734) Features: - Support type-list pipeline in JsonCssExtractionStrategy for chained extraction like ["attribute", "regex"] (#1290) - Add --json-ensure-ascii CLI flag and JSON_ENSURE_ASCII config setting for Unicode preservation in JSON output (#1668)
Owner
|
Thanks @Br1an67 - this is a solid security hardening for the Docker deployment. We've merged it into develop and it will be in the next release. We'll acknowledge your contribution. |
unclecode
added a commit
that referenced
this pull request
Mar 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1627
The
/tokenendpoint issues JWT tokens to anyone with a valid email domain, with no credential check. This adds anapi_tokenfield to the security config. When set, the/tokenendpoint requires the caller to provide the matchingapi_tokenin the request body before issuing a JWT.Existing deployments without
api_tokenconfigured are unaffected (backward compatible).List of files changed and why
deploy/docker/auth.py— Added optionalapi_tokenfield toTokenRequestdeploy/docker/server.py— Validateapi_tokenagainst config before issuing JWTdeploy/docker/config.yml— Addedapi_tokenfield undersecuritysectionHow Has This Been Tested?
Verified logic: when
security.api_tokenis empty (default), the endpoint works as before. When set, requests without a matchingapi_tokenget a 401 response.Checklist: