__jmcantrell__ has quit [Ping timeout: 272 seconds]
blacknova has joined #ruby
grenierm has joined #ruby
<blacknova>
hi, anyone familiar with Plaid API's ruby quickstart sample app? https://github.com/plaid/quickstart/blob/master/ruby/app.rb it seems to use Sinatra which uses Rack::Protection and trying to get it to stop thinking localhost calls are "attacks". Tried changing L15 to `use Rack::Protection, except: [:json_csrf, :host_authorization]` and restarted their container to no avail :/
<blacknova>
Any help appreciated!
TomyLobo has quit [Ping timeout: 276 seconds]
<blacknova>
tried adding `use Rack::Protection::HostAuthorization, permitted_hosts: ["localhost"]` but still keep getting `quickstart-ruby-1 | W, [2025-04-28T02:24:42.942950 #1] WARN -- : attack prevented by Rack::Protection::HostAuthorization`
<mange>
If you're running in a container then the requests won't be coming from "localhost", they'll be coming from another IP address that represents the host from inside the container. 172.19.0.2 is a reserved IP, so I assume that's it.
<blacknova>
had to rebuild the container as nothing was working
<blacknova>
I don't understand why this is so hard
<blacknova>
this Debian ("Bullseye") container doesn't have `ip addr...` but `/etc/hosts` shows what the container's IP is and I assume source IP is from that message
gr33n7007h has quit [Quit: WeeChat 4.6.1]
LainIwakura has quit [Quit: Client closed]
<mange>
The source IP isn't the container's IP, it's the host's IP from the container's perspective. Can you just whitelist 172.16.0.0/12? That's the relevant block that Wikipedia lists as reserved for private networking (there are others, but I don't think they're relevant here).
gr33n7007h has joined #ruby
LainIwakura has joined #ruby
Guest62 has quit [Ping timeout: 240 seconds]
<blacknova>
mange: yes, I know... note this Plaid stack has two containers (`quickstart-frontend-1` + `quickstart-ruby-1`). The IP would be from the frontend container I believe
<blacknova>
mange: is there a way I can lint a ruby file for errors via the CLI via an apt package? I'm debugging this container at runtime and if there's any sort of ruby syntax issue, the entire container never starts up and I can't easily fix the issue
<mange>
ruby -c will check for syntax issues, if that's all you're looking for. I would have expected a syntax error to show up in the logs of the process, though (likely in the container's logs, but maybe in a file somewhere).
<mange>
Sorry that I can't really help to dig into your issues at the moment. I don't suppose you know anything about the Ruby GraphQL AST representation, do you? :P
<mange>
In the graphql-ruby Gem, that is.
<blacknova>
mange: thanks, alas I am a completely new to ruby so probably not :( are you getting an erro?
<blacknova>
error
<mange>
I'm just trying to work out how to expand a FragmentSpread term in the AST. I think I've got it though - look up the fragment by name in the context.query.fragments Hash, then take the #selections of that.
schn31d3r has joined #ruby
<blacknova>
ok, syntax checks out but absolutely nothing I do to the file (less just renaming it) has had any effect. I am questioning if my changes are even being honored... the container's entry point is basically a shell script that runs a bash script that runs `bundle exec ruby app.rb`
<mange>
Are you rebuilding your image between each run? The Dockerfile in that repo has "COPY . .", so unless you're using a volume or something it will have copied the files at the point when you built the image, and future updates outside the image won't be affecting it.
<blacknova>
no, I'm just restarting the container
<mange>
Yeah, so your changes won't be doing anything to the files in the container. You can either use a volume to mount your directory inside the container, or you can rebuild the container each time.
<blacknova>
when I docker exec -it back into it, the changes are persisting though
<mange>
Oh, you're changing them *in* the container? How are you running your process?
<blacknova>
the entrypoint starts ruby, restarting the container should just restart that
<mange>
But if you use docker run, doesn't it start a new container from the image?
<blacknova>
if that were true my changes should revert each time, no?
<mange>
Oh, okay, that might retain the container.
<blacknova>
I could be just not working with Rack::Protection::HostAuthorization correctly 🤷 going to try replacing it with a basic Hello Sinatra block of code?
<blacknova>
hmm, just getting a spinning loading in the browser tab if I just hit localhost:3000 now...
<blacknova>
nothing in logs...
<blacknova>
does ruby itself create logs?
<blacknova>
I don't get it... like literally NOTHING works... sigh
grenierm has joined #ruby
<blacknova>
is that hello sinatra (world) code look correct?
<blacknova>
ok, localhost:3000 keeps pulling up the node frontend, if I hit localhost:8000 in Chrome, I get `ERR_EMPTY_RESPONSE`
<blacknova>
nothing in docker logs
<blacknova>
hmmm, ruby is running but nothing is bound on 8000 inside the container
<blacknova>
outside the container `docker ps` shows 8000 is mapped correctly
micheke1L has joined #ruby
micheke1L has quit [Client Quit]
Guest72 has joined #ruby
Guest72 has quit [Ping timeout: 240 seconds]
infinityfye has joined #ruby
gr33n7007h has quit [Ping timeout: 260 seconds]
gr33n7007h has joined #ruby
R2 has joined #ruby
R2robot has quit [Ping timeout: 248 seconds]
R2robot has joined #ruby
R2 has quit [Ping timeout: 260 seconds]
R2 has joined #ruby
R2robot has quit [Ping timeout: 248 seconds]
niv has quit [Read error: Connection reset by peer]
niv has joined #ruby
nmollerup has joined #ruby
sarna has quit [Ping timeout: 252 seconds]
sarna has joined #ruby
<mange>
Anyone around who knows Arel? Anyone know how I can get the explain output for a query represented by a SelectManager? Using .to_sql leaves bind parameters but doesn't supply arguments, and ActiveRecord::Base.connection.explain seems to have the same problem.
grenierm has quit [Ping timeout: 240 seconds]
<mange>
Okay, looks like I can get something working with ActiveRecord::Base.connection.send(:to_sql_and_binds, arel) to get the SQL string and arguments, then I can call .explain with them. Not ideal to use a private method, but it works.
wbooze has quit [Quit: Leaving]
sarna has quit [Ping timeout: 265 seconds]
wbooze has joined #ruby
LainIwakura has joined #ruby
LainIwakura has quit [Client Quit]
LainIwakura has joined #ruby
Milos has quit [Ping timeout: 248 seconds]
LainIwakura has quit [Client Quit]
LainIwakura has joined #ruby
Milos has joined #ruby
blacknova has quit [Quit: Connection closed for inactivity]
GreenResponse has joined #ruby
mange has quit [Remote host closed the connection]
sarna has joined #ruby
sarna has quit [Ping timeout: 265 seconds]
user71 has joined #ruby
Goodbye_Vincent1 has quit [Read error: Connection reset by peer]
o0x1eef has joined #ruby
Tempesta has quit [*.net *.split]
LainIwakura has quit [Quit: Client closed]
Tempesta has joined #ruby
Tempesta has joined #ruby
sarna has joined #ruby
gemmaro_ has quit [Ping timeout: 260 seconds]
LainIwakura has joined #ruby
gemmaro has joined #ruby
infinityfye has quit [Read error: Connection reset by peer]
chromis has quit [Quit: Connection closed for inactivity]
eddof13 has joined #ruby
eddof13 has quit [Quit: eddof13]
GreenResponse has quit [Quit: Leaving]
delvarus has joined #ruby
wbooze has quit [Read error: Connection reset by peer]