Commit Graph

28 Commits

Author SHA1 Message Date
Abhinav Raut baeade99a6 oidc: always read the redirect URL from settings, drop the session copy 2026-08-30 23:26:34 +05:30
malpou 8eeea388d6 oidc: resolve redirect URI once per login and propagate errors
Address CodeRabbit review on the live-lookup change:

- Resolve the redirect URI live in LoginURL and return it so the caller
  persists it in the session; ExchangeOIDCToken reuses that stored value
  instead of resolving again. The token exchange redirect_uri must match
  the one in the auth request (RFC 6749 4.1.3); resolving twice would let
  a Root URL change between login and callback produce a mismatch the IdP
  rejects.
- Propagate the redirect URL resolution error out of LoginURL rather
  than discarding it, so a setting read failure fails the login loudly
  instead of sending an empty redirect_uri.
- Pass rootURL as a formatting argument in oidc.RedirectURL instead of
  concatenating it into the format string, so a root URL containing a
  %-sequence (e.g. %2F) is not interpreted as a verb.
2026-08-29 11:51:43 +02:00
malpou 02e9d1d3bf oidc: resolve redirect URL live so Root URL changes without a restart
Auth providers captured the redirect URL as a string at build time, so
changing app.root_url in General settings left OIDC providers sending
the old redirect_uri until the process restarted. The identity provider
then rejected login with "redirect_uri is missing in the client
configuration" even though the database and the IdP client both held the
right value.

Make auth.Provider.RedirectURL a closure and resolve it in LoginURL and
ExchangeOIDCToken from the current root URL, matching the media store's
existing rootURL closure. The redirect URL is computed by a new
oidc.Manager.RedirectURL(id) helper so the path format stays in one
place. Other provider fields (client ID, provider URL) remain snapshotted
and are refreshed by reloadAuth on OIDC changes, as before.

This removes the reload requirement for Root URL entirely; the settings
handler no longer needs to know that auth depends on it.
2026-08-29 11:32:28 +02:00
Abhinav Raut 6b8a0f9521 fix content loss in knowledge base chunking and harden AI agent limits
Final review pass before taking the AI agent branch live.

Knowledge base:
- Text not wrapped in a block tag was never collected, so prose around a
  table or list never reached the index. The assistant answered "no
  relevant information" for questions the snippet covered.
- Blocks over the token limit were truncated and the remainder dropped. They
  are split into several chunks now.
- Trimming an oversized block ran one rune at a time and re-tokenized the
  whole string each step. A large table took minutes. It uses a binary
  search now.
- Overlap text was not escaped, so a sentence containing markup swallowed
  the rest of the chunk.
- SVG and template text no longer reaches the index.

AI agent:
- Verification codes are capped per address and per conversation. The cap
  was per conversation only, so a customer correcting a mistyped email was
  told to check an inbox that never got a code.
- Livechat verification sends synchronously. A queued send returned nil even
  when SMTP failed, so a failure counted as a sent code.
- Queued jobs drain on shutdown and hand off to a human instead of being
  dropped with no reply.
- Deleting an assistant no longer moves resolved and closed conversations
  into the fallback team.
- Image decode is capped at 25 MP. The old bound allowed a 400 MB decode per
  attachment.

Auth and admin:
- A blank OIDC client secret no longer overwrites the stored one. Blank id
  or secret is rejected instead.
- OIDC token exchange uses the SSRF guarded client with a timeout.
- Renaming a tool auth header no longer attaches the secret of whichever row
  now sits at that position.
- Clearing embedding dimensions no longer refills 1536 on the next load,
  which pushed a wrong value to the provider on the next save.
- Copilot conversation lookups filter by access before capping at 10.
2026-07-25 03:52:32 +05:30
Abhinav Raut ec5333a393 move OIDC client secret masking to the backend
The frontend used to blank out the masked secret before saving. Now it sends the value as-is and the backend keeps the stored secret when it sees the dummy mask. This matches how webhooks and other secrets already work.
2026-07-19 12:35:07 +05:30
Abhinav Raut 7c949e653c Don't fatal on encryption_key rotation 2026-05-15 02:39:07 +05:30
Abhinav Raut 81847c7f4e i18n: fix localization issues (#231)
Not backported to main due to extensive i18n refactoring changes in this branch.
2026-02-22 15:12:00 +05:30
Abhinav Raut 1127d2967b add logo_url support for custom OIDC providers
- add microsoft option for providers
2026-01-11 17:18:19 +05:30
Abhinav Raut 94202e22bd refactor: update OAuth flow to use Redis for state management instead of storing it in session
- Replace Google logo with SVG
2025-12-24 16:08:25 +05:30
Abhinav Raut f3ddc26512 wip inbox oauth and encryption 2025-12-24 16:08:25 +05:30
Abhinav Raut f6d3bd543f refactor: consolidate public config into single endpoint, move settings behind auth
- remove OIDC enabled endpoint
2025-08-30 18:46:37 +05:30
Abhinav Raut 634fc66e9f Translate welcome to libredesk email subject
- Update all SQL queries to add missing columns

- Update the create conversation API to allow setting the initiator of a conversation. For example, we might want to use this API to create a conversation on behalf of a customer, with the first message coming from the customer instead of the agent. This param allows this.

- Minor refactors and clean up

- Tidy go.mod

- Rename structs to reflect purpose

- Create focus structs for scanning JSON payloads for clarity.
2025-08-28 00:34:56 +05:30
Abhinav Raut d2e5d85e3a fix: return created/updated objects in POST/PUT responses with masked secrets
All POST/PUT handlers now return actual database objects instead of `true`
2025-06-20 19:35:09 +05:30
Abhinav Raut 6b6549cb03 standardize i18n keys for consistency rename keys
fix: avatar url `null` console warnings.
2025-04-03 01:21:12 +05:30
Abhinav Raut 4361250c73 feat: backend api response translations 2025-04-03 01:21:12 +05:30
Abhinav Raut 8e15d733ea fix: regression in sso login caused due to attempting in hiding client secret in the API response. Resolves #21 2025-03-05 16:13:13 +05:30
Abhinav Raut 360557c58f fix: remove client_id and client_secret from get-all-oidc query 2025-03-04 22:02:42 +05:30
Abhinav Raut d3c2cc2527 feat: add CSAT sending functionality and improve error handling in templates
feat: automation action to send CSAT.
- minor refactors.
2025-02-02 21:03:09 +05:30
Abhinav Raut 9939d6206f feat: reload app constants and Templates on update of app settings 2025-02-01 05:34:19 +05:30
Abhinav Raut 1549e87370 fix: OIDC login. 2025-02-01 04:23:26 +05:30
Abhinav Raut 966707191d fix: oidc hide secrets in json marshal
- adds new public handler that returns available providers.
2025-01-30 01:43:44 +05:30
Abhinav Raut 50188352a5 fix: Use SyncedEnforcer in casbin, fixes panics.
feat: store user roles in user roles table, drops the roles table on users table.
feat: standardize column names in schema, renames disabled bool to enables.
- vue router fixes to allow components / pages to rerender after creating an object in db.
- minor fixes and refactors.
2025-01-22 03:40:32 +05:30
Abhinav Raut 0c54abbbad refactor: rename modules and imports to reflect project name 2025-01-11 21:46:29 +05:30
Abhinav Raut ee7be54c0d fix: hide passwords in API response
- Minor refactors.
- Fixes bugs in SelectTag component.
- Update vite.
2024-10-23 05:25:10 +05:30
Abhinav Raut 2b25ce32b6 feat: adds nonce check for oidc token exchange
- feat: adds filters support on conversations list
- refactor middlewares.go
- Adds new paginate.go for generating filtered paginated SQL queries this removes sql generation code from the conversations package.
- rename some components
- removes hardcoded `/uploads/`
2024-10-17 04:21:22 +05:30
Abhinav Raut ce30055223 PUSH COMMITS 2024-08-13 03:32:31 +05:30
Abhinav Raut 06db29f7f3 refactor. 2024-08-11 03:52:05 +05:30
Abhinav Raut 704c485b6a refactor 2024-08-09 03:55:20 +05:30