elastic / connectors

Source code for all Elastic connectors, developed by the Search team at Elastic, and home of our Python connector development framework
https://www.elastic.co/guide/en/enterprise-search/master/index.html
Other
69 stars 123 forks source link

Network Drive connector DLS mapping CSV gives error - IndexError: list index out of range #2728

Open A-Hall opened 1 month ago

A-Hall commented 1 month ago

Bug Description

When supplying a DSL mapping CSV to a connector service Docker container, you receive an error - IndexError: list index out of range

To Reproduce

Steps to reproduce the behavior:

  1. Create a network drive connector. - https://{kibana_URL}:5601/app/enterprise_search/content/connectors/new_connector?service_type=network_drive&connector_type=connector_clients
  2. Under the configuration, enable Document Level Security and supply the path to your mapping.csv file.
  3. Run an access control sync
  4. The error is returned:
[FMWK][19:10:52][CRITICAL] [Connector id: Ymfz4JAB1oTHpHwc9jx7, index name: .search-acl-filter-network_drive, Sync job id: m3Dm_5AB1oTHpHwc6yK-] Document extractor failed
Traceback (most recent call last):
  File "/app/connectors/es/sink.py", line 494, in run
    await self.get_access_control_docs(generator)
  File "/app/connectors/es/sink.py", line 721, in get_access_control_docs
    async for doc in generator:
  File "/app/connectors/logger.py", line 247, in __anext__
    return await self.gen.__anext__()
  File "/app/connectors/es/sink.py", line 521, in _decorate_with_metrics_span
    async for doc in generator:
  File "/app/connectors/sync_job_runner.py", line 513, in generator
    async for doc in self.data_provider.get_access_control():
  File "/app/connectors/sources/network_drive.py", line 787, in get_access_control
    for user in self.read_user_info_csv():
  File "/app/connectors/sources/network_drive.py", line 750, in read_user_info_csv
    "user_sid": row[1],
IndexError: list index out of range

Expected behavior

The CSV is read and DSL features configured.

Screenshots

image

image

Environment

Using the example csv:

andrew@worknuc:~/connectors-config$ cat mapping.csv
sid_1_network_drives,user_1_enterprise_search
sid_2_network_drives,user_2_enterprise_search

Additional context

moxarth-elastic commented 1 month ago

Hi @A-Hall, this mapping csv is that of network drive connector standalone package. The new framework has a different format. Thank you for raising the issue, we'll update the elastic docs with sample format, meanwhile here is the correct format: name;user-sid;groups(optional comma separated list)

user1;S-1;S-11,S-22
user2;S-2;S-22

Note that the delimeter is ; and not comma for this CSV.

moxarth-elastic commented 1 month ago

@A-Hall did you get a chance to test the DLS with this CSV format?

Hi @A-Hall, this mapping csv is that of network drive connector standalone package. The new framework has a different format. Thank you for raising the issue, we'll update the elastic docs with sample format, meanwhile here is the correct format: name;user-sid;groups(optional comma separated list)

user1;S-1;S-11,S-22
user2;S-2;S-22

Note that the delimeter is ; and not comma for this CSV.

A-Hall commented 1 month ago

Yep, that appears to be working as expected. Thanks for the info!

moxarth-elastic commented 1 month ago

Hi @A-Hall, this mapping csv is that of network drive connector standalone package. The new framework has a different format. Thank you for raising the issue, we'll update the elastic docs with sample format, meanwhile here is the correct format: name;user-sid;groups(optional comma separated list)

user1;S-1;S-11,S-22
user2;S-2;S-22

Note that the delimeter is ; and not comma for this CSV.

@leemthompo We should add the CSV format in the network drive documentation to avoid the confusion. Can you please update the doc as follows:

For Connector Client,

Update the identity_mappings under Configuration section

danajuratoni commented 4 days ago

@leemthompo it would be great to have this doc update for 8.16. Thanks!