-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Web Bot Auth #1609
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
Web Bot Auth #1609
Changes from all commits
4d7b7d1
6cd8202
02198de
c38d9a3
9971816
a1fb11a
1ed61d4
d365240
fca29a8
c6c0492
172481d
bf0be60
8db6477
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ const Notification = @import("../Notification.zig"); | |
| const CookieJar = @import("../browser/webapi/storage/Cookie.zig").Jar; | ||
| const Robots = @import("../network/Robots.zig"); | ||
| const RobotStore = Robots.RobotStore; | ||
| const WebBotAuth = @import("../network/WebBotAuth.zig"); | ||
|
|
||
| const Allocator = std.mem.Allocator; | ||
| const ArenaAllocator = std.heap.ArenaAllocator; | ||
|
|
@@ -702,6 +703,12 @@ fn makeRequest(self: *Client, conn: *Net.Connection, transfer: *Transfer) anyerr | |
| try conn.secretHeaders(&header_list, &self.network.config.http_headers); // Add headers that must be hidden from intercepts | ||
| try conn.setHeaders(&header_list); | ||
|
|
||
| // If we have WebBotAuth, sign our request. | ||
| if (self.network.web_bot_auth) |*wba| { | ||
| const authority = URL.getHost(req.url); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be the origin? The doc's say "This should be equal to the value of the Host header sent by the request." If you access
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This does return the port. If we used |
||
| try wba.signRequest(transfer.arena.allocator(), &header_list, authority); | ||
| } | ||
|
|
||
| // Add cookies. | ||
| if (header_list.cookies) |cookies| { | ||
| try conn.setCookies(cookies); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe these have well know meaning to users, but should we validate these? They're used very specifically, like this shouldn't include the protocol and shouldn't include the trailing slash. I realize that's what a "domain" is..but..
Also, keyid has to be base64 encoded. WE'll generate invalid JSON if this isn't well formed. Will that be an issue? Or will things just fail gracefully?