Skip to content

[Bug]: Allow ":" in Actions API-Key #6422

@dasganni

Description

@dasganni

What happened?

I am trying to get librechat working with Bookstack for example: https://demo.bookstackapp.com/api/docs#authentication

Therefore I configure a custom Header "Authorization" and the API Key is like "Token <token_id>:<token_secret>". As soon as I use the ":", the logs throw a "[handleAbortError] AI response error; aborting request: algorithm.iv must contain exactly 16 bytes".

If I remove the ":" and just use "Token <token_id><token_secret>" as API-Key, it "works" or at least it does not throw an error but a 401, because the API-Key is wrong then.

Version Information

ghcr.io/danny-avila/librechat-dev latest ... In Librechat: LibreChat v0.7.7

Steps to Reproduce

  1. Create an action with an url somewhere, for example this is the openapi I created for Bookstack:

`
openapi: 3.0.3
info:
title: BookStack API
description: API for interacting with BookStack content
version: 1.0.0
servers:

  • url: https://demo.bookstackapp.com/api
    variables:
    host:
    default: demo.bookstackapp.com
    description: BookStack instance host
    security:
  • BookStackToken: []
    tags:
  • name: Shelves
    description: Book shelf management
  • name: Books
    description: Book management
  • name: Chapters
    description: Chapter management
  • name: Pages
    description: Page management
  • name: Search
    description: Content search operations
    paths:

Shelves endpoints (from previous)

/books:
get:
tags: [Books]
summary: List books
parameters:
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- name: shelf_id
in: query
description: Filter books by shelf ID
schema:
type: integer
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedBooks'
post:
tags: [Books]
summary: Create a book
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BookCreateUpdate'
responses:
'201':
description: Book created
content:
application/json:
schema:
$ref: '#/components/schemas/Book'

/books/{id}:
get:
tags: [Books]
summary: Get a book
parameters:
- $ref: '#/components/parameters/id'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Book'
put:
tags: [Books]
summary: Update a book
parameters:
- $ref: '#/components/parameters/id'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BookCreateUpdate'
responses:
'200':
description: Book updated
content:
application/json:
schema:
$ref: '#/components/schemas/Book'
delete:
tags: [Books]
summary: Delete a book
parameters:
- $ref: '#/components/parameters/id'
responses:
'204':
description: Book deleted

/chapters:
get:
tags: [Chapters]
summary: List chapters
parameters:
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- name: book_id
in: query
description: Filter chapters by book ID
schema:
type: integer
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedChapters'
post:
tags: [Chapters]
summary: Create a chapter
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChapterCreateUpdate'
responses:
'201':
description: Chapter created
content:
application/json:
schema:
$ref: '#/components/schemas/Chapter'

/chapters/{id}:
get:
tags: [Chapters]
summary: Get a chapter
parameters:
- $ref: '#/components/parameters/id'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Chapter'
put:
tags: [Chapters]
summary: Update a chapter
parameters:
- $ref: '#/components/parameters/id'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChapterCreateUpdate'
responses:
'200':
description: Chapter updated
content:
application/json:
schema:
$ref: '#/components/schemas/Chapter'
delete:
tags: [Chapters]
summary: Delete a chapter
parameters:
- $ref: '#/components/parameters/id'
responses:
'204':
description: Chapter deleted

/pages:
get:
tags: [Pages]
summary: List pages
parameters:
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
- name: book_id
in: query
description: Filter pages by book ID
schema:
type: integer
- name: chapter_id
in: query
description: Filter pages by chapter ID
schema:
type: integer
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedPages'
post:
tags: [Pages]
summary: Create a page
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PageCreateUpdate'
responses:
'201':
description: Page created
content:
application/json:
schema:
$ref: '#/components/schemas/Page'

/pages/{id}:
get:
tags: [Pages]
summary: Get a page
parameters:
- $ref: '#/components/parameters/id'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Page'
put:
tags: [Pages]
summary: Update a page
parameters:
- $ref: '#/components/parameters/id'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PageCreateUpdate'
responses:
'200':
description: Page updated
content:
application/json:
schema:
$ref: '#/components/schemas/Page'
delete:
tags: [Pages]
summary: Delete a page
parameters:
- $ref: '#/components/parameters/id'
responses:
'204':
description: Page deleted

/shelves:
get:
tags: [Shelves]
summary: List shelves
parameters:
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/count'
- $ref: '#/components/parameters/sort'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedShelves'
post:
tags: [Shelves]
summary: Create a shelf
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ShelfCreateUpdate'
responses:
'201':
description: Shelf created
content:
application/json:
schema:
$ref: '#/components/schemas/Shelf'

/shelves/{id}:
get:
tags: [Shelves]
summary: Get a shelf
parameters:
- $ref: '#/components/parameters/id'
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Shelf'
put:
tags: [Shelves]
summary: Update a shelf
parameters:
- $ref: '#/components/parameters/id'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ShelfCreateUpdate'
responses:
'200':
description: Shelf updated
content:
application/json:
schema:
$ref: '#/components/schemas/Shelf'
delete:
tags: [Shelves]
summary: Delete a shelf
parameters:
- $ref: '#/components/parameters/id'
responses:
'204':
description: Shelf deleted

Similar paths for Books, Chapters, and Pages would follow here

/search:
get:
tags: [Search]
summary: Search content
parameters:
- name: query
in: query
required: true
schema:
type: string
- name: type
in: query
schema:
type: string
enum: [book, page, chapter, shelf]
responses:
'200':
description: Search results
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/SearchResult'

components:
securitySchemes:
BookStackToken:
type: http
scheme: Token
description: >-
Use API token in format "Token {token_id}:{token_secret}"
(without quotes). Replace {token_id} and {token_secret} with your actual credentials.

schemas:
# Previous Shelf schemas

Book:
  type: object
  properties:
    id:
      type: integer
    name:
      type: string
    slug:
      type: string
    description:
      type: string
    created_at:
      type: string
      format: date-time
    updated_at:
      type: string
      format: date-time
    created_by:
      $ref: '#/components/schemas/User'
    updated_by:
      $ref: '#/components/schemas/User'
    tags:
      type: array
      items:
        type: string
    shelf_id:
      type: integer
      description: ID of the parent shelf

BookCreateUpdate:
  type: object
  required: [name]
  properties:
    name:
      type: string
      minLength: 1
    description:
      type: string
    tags:
      type: array
      items:
        type: string
    shelf_id:
      type: integer

PaginatedBooks:
  type: object
  properties:
    data:
      type: array
      items:
        $ref: '#/components/schemas/Book'
    meta:
      $ref: '#/components/schemas/PaginationMeta'

Chapter:
  type: object
  properties:
    id:
      type: integer
    name:
      type: string
    slug:
      type: string
    description:
      type: string
    created_at:
      type: string
      format: date-time
    updated_at:
      type: string
      format: date-time
    created_by:
      $ref: '#/components/schemas/User'
    updated_by:
      $ref: '#/components/schemas/User'
    tags:
      type: array
      items:
        type: string
    book_id:
      type: integer

ChapterCreateUpdate:
  type: object
  required: [name, book_id]
  properties:
    name:
      type: string
      minLength: 1
    description:
      type: string
    tags:
      type: array
      items:
        type: string
    book_id:
      type: integer

PaginatedChapters:
  type: object
  properties:
    data:
      type: array
      items:
        $ref: '#/components/schemas/Chapter'
    meta:
      $ref: '#/components/schemas/PaginationMeta'

Page:
  type: object
  properties:
    id:
      type: integer
    title:
      type: string
    slug:
      type: string
    html:
      type: string
    markdown:
      type: string
    created_at:
      type: string
      format: date-time
    updated_at:
      type: string
      format: date-time
    created_by:
      $ref: '#/components/schemas/User'
    updated_by:
      $ref: '#/components/schemas/User'
    tags:
      type: array
      items:
        type: string
    book_id:
      type: integer
    chapter_id:
      type: integer

PageCreateUpdate:
  type: object
  required: [title]
  properties:
    title:
      type: string
      minLength: 1
    html:
      type: string
    markdown:
      type: string
    tags:
      type: array
      items:
        type: string
    book_id:
      type: integer
    chapter_id:
      type: integer

PaginatedPages:
  type: object
  properties:
    data:
      type: array
      items:
        $ref: '#/components/schemas/Page'
    meta:
      $ref: '#/components/schemas/PaginationMeta'

Shelf:
  type: object
  properties:
    id:
      type: integer
    name:
      type: string
    slug:
      type: string
    description:
      type: string
    created_at:
      type: string
      format: date-time
    updated_at:
      type: string
      format: date-time
    created_by:
      $ref: '#/components/schemas/User'
    updated_by:
      $ref: '#/components/schemas/User'
    tags:
      type: array
      items:
        type: string

ShelfCreateUpdate:
  type: object
  required: [name]
  properties:
    name:
      type: string
      minLength: 1
    description:
      type: string
    tags:
      type: array
      items:
        type: string

PaginatedShelves:
  type: object
  properties:
    data:
      type: array
      items:
        $ref: '#/components/schemas/Shelf'
    meta:
      $ref: '#/components/schemas/PaginationMeta'

User:
  type: object
  properties:
    id:
      type: integer
    name:
      type: string
    slug:
      type: string
    avatar_url:
      type: string

PaginationMeta:
  type: object
  properties:
    total:
      type: integer
    per_page:
      type: integer
    current_page:
      type: integer
    last_page:
      type: integer

SearchResult:
  type: object
  properties:
    type:
      type: string
      enum: [book, page, chapter, shelf]
    item:
      oneOf:
        - $ref: '#/components/schemas/Book'
        - $ref: '#/components/schemas/Page'
        - $ref: '#/components/schemas/Chapter'
        - $ref: '#/components/schemas/Shelf'

parameters:
id:
name: id
in: path
required: true
schema:
type: integer
page:
name: page
in: query
schema:
type: integer
default: 1
count:
name: count
in: query
schema:
type: integer
default: 20
sort:
name: sort
in: query
schema:
type: string
enum: [id, name, created_at, updated_at]
default: id
`

Of course the host is just the demo for this example. But it does not matter, the request does not leave librechat.

  1. Use a Custom API Key, the header is not relevant, but in this example: "Authorization" and the Key for example: "Token C6mdvEQTGnebsmVn3sFNeeuelGEBjyQp:NOvD3VlzuSVuBPNaf1xWHmy7nIRlaj22"

  2. Start a chat with the Action and Librechat throws: Something went wrong. Here's the specific error message we encountered: An error occurred while processing your request. Please contact the Admin.

  3. In the logs it will print error: [handleAbortError] AI response error; aborting request: algorithm.iv must contain exactly 16 bytes

What browsers are you seeing the problem on?

Chrome

Relevant log output

error: [handleAbortError] AI response error; aborting request: algorithm.iv must contain exactly 16 bytes

Screenshots

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

🐛 bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions