Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending query parameter in int array instead of string #231

Open
shu-bc opened this issue Jun 22, 2024 · 0 comments
Open

Sending query parameter in int array instead of string #231

shu-bc opened this issue Jun 22, 2024 · 0 comments

Comments

@shu-bc
Copy link

shu-bc commented Jun 22, 2024

After updating activegraph from v10.0.1 to v11.4.0 and neo4j-ruby-driver to v4.4.5., authentication logic in my application stops working because it cannot find data from Neo4j database, which is running in docker using image neo4j:4.0.10-enterprise.

Authentication code looks like this:

authentication_token = headers[token_param_name]
User.find_by(authentication_token: authentication_token)

In query log, I found authentication_token parameter is strangely int array not string.

2024-06-22 03:27:57.371+0000 INFO  0 ms: bolt-session   bolt    neo4j-ruby/4.4.5                client/172.19.0.5:54638 server/172.19.0.3:7687> neo4j -  - MATCH (n:`User`) WHERE (n.authentication_token = $n_authentication_token) RETURN n LIMIT $limit_1 - {n_authentication_token: [111, 83, 80, 74, 89, 72, 111, 103, 49, 80, 70, 85, 117, 121, 107, 45, 51, 107, 74, 98, 65, 81], limit_1: 1} - {}

Hard coding token, or sending token by query string work perfectly well.

User.find_by(authentication_token: 'tokenhere')
User.find_by(authentication_token: params[:token])

I tried to create new instance of the string by dup, clone, String.new, they all failed.

authentication_token = headers[token_param_name].dup
authentication_token = headers[token_param_name].clone
authentication_token = String.new(headers[token_param_name])

But creating new string by concat each char of the original string works.

    authentication_token = ''.dup
    headers[token_param_name].each_char do |char|
      authentication_token << char
    end

I am sure that activegraph gem is not the cause, since sending query directly using this exmple code reproduces the same problem.

  • ruby 3.1.6
  • rails (6.1.7.7)
  • puma (6.4.2)
  • rack (2.2.9)
  • grape (1.8.0)
  • activegraph (= 11.4.0)
  • neo4j-ruby-driver (4.4.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant