Description
The /callback handler sends an overlength warning message before it checks whether LINE WORKS configuration is complete. If any required LINE WORKS credential is missing, the "message too long" path can raise inside send_message() and return 500 instead of handling the request cleanly.
Component
Steps to Reproduce
- Leave one or more required LINE WORKS credentials unset.
- POST a webhook payload containing a text body longer than
MAX_MESSAGE_LENGTH.
- Observe that the handler reaches
lw_client.send_message(...) before it reaches lw_client.validate_config().
Expected Behavior
Configuration should be validated before any outbound LINE WORKS API call, including the oversize-message branch.
Actual Behavior
The branch at routes.py:77-87 tries to send a reply first, while config validation does not happen until routes.py:89-91.
Environment
- OS: Any
- Python version: Source analysis
- Docker version: N/A
- Chat platform: LINE WORKS
- Flowise version: N/A
Logs
Relevant code paths:
- chat-connector/app/routes.py:77-91
- chat-connector/app/services/lineworks.py:121-130
Additional Context
This is subtle because the normal success path validates config, but the oversize-message guard does not.
Evidence
Suggested fix
- Move
validate_config() ahead of all send_message() calls
- Or short-circuit the oversize path with a logged
500/503 when the connector is misconfigured
Description
The
/callbackhandler sends an overlength warning message before it checks whether LINE WORKS configuration is complete. If any required LINE WORKS credential is missing, the "message too long" path can raise insidesend_message()and return500instead of handling the request cleanly.Component
Steps to Reproduce
MAX_MESSAGE_LENGTH.lw_client.send_message(...)before it reacheslw_client.validate_config().Expected Behavior
Configuration should be validated before any outbound LINE WORKS API call, including the oversize-message branch.
Actual Behavior
The branch at
routes.py:77-87tries to send a reply first, while config validation does not happen untilroutes.py:89-91.Environment
Logs
Additional Context
This is subtle because the normal success path validates config, but the oversize-message guard does not.
Evidence
Suggested fix
validate_config()ahead of allsend_message()calls500/503when the connector is misconfigured