Support a simplified workflow for using the TDM#604
Merged
Conversation
Create a "localhost" filter (prevent requests from IP addresses which differ from the server) for paths /local/*, and use it to create a local collections API to simplify use of the TDM for the use case of the TDM when running on the same machine as the TDS.
When making a request to the local API, we check that the IP address associated with the request comes from the same IP address that the server is listening on locally though the use of a servlet filter. This will prevent simple external requests to the local API, but the request IP address can can be spoofed and thwart this. This commit adds an additional check - a signature based authorization - to the local API. At this point, only GET requests are supported. An HMAC SHA256 algorithm is used to generate a hash of the the path and query components of the request, along with the ISO formatted date/time (rounded down to the nearest 5 second boundary). The client and server must have access to the same key used to initialize the hash generator. This hash is sent with the request as a header (key: X-TDS-Local-Api-Signature-V1). Upon receipt, the server generates a hash in a similar manner. If the hashes do not match, the server will respond with a 404. By adding the date/time string to the hash calculation, we limit the window in which a request is valid to 5 seconds. The server generates a has using the current five minute window, and if that fails, it will generate the hash using the previous 5 minute window.
When the TDM is configured to send triggers to one or more servers with a hostname of localhost, use the new local API path of the TDS to send triggers without needing credentials.
lesserwhirls
force-pushed
the
localTdm
branch
2 times, most recently
from
July 29, 2025 19:44
0d1fd3e to
bfb2047
Compare
lesserwhirls
marked this pull request as ready for review
July 29, 2025 23:05
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.
Add a localhost-only API for managing collections with the TDM. This will bypass the need to setup tomcat authentication in cases where the TDM and TDS are running on the same host.