alpha
Login
or
Join now
zzstoatzz.io
/
zds
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
zig pds
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Read create account auth before body
author
zzstoatzz
date
2 months ago
(May 21, 2026, 11:37 AM -0500)
commit
afa92b1b
afa92b1b739182e32eb6b9319219fbe601507611
parent
da32c0fa
da32c0fa7bdfc22ea3cb7e844735709765bc7745
+5
-4
1 changed file
Expand all
Collapse all
Unified
Split
src
atproto
server.zig
+5
-4
src/atproto/server.zig
View file
Reviewed
···
46
46
}
47
47
48
48
pub fn createAccount(request: *http.Server.Request) !void {
49
49
+
const authorization = http_api.headerValue(request, "authorization");
49
50
var body_buf: [8192]u8 = undefined;
50
51
const body = try http_api.readBody(request, &body_buf);
51
52
···
71
72
}
72
73
73
74
const existing_did = zat.json.getString(parsed.value, "did");
74
74
-
if (existing_did == null and http_api.headerValue(request, "authorization") == null) {
75
75
+
if (existing_did == null and authorization == null) {
75
76
return http_api.xrpcError(request, .bad_request, "InvalidRequest", "zds currently requires a did for account migration");
76
77
}
77
78
const did = existing_did orelse {
···
82
83
return http_api.xrpcError(request, .bad_request, "InvalidDid", "invalid did");
83
84
}
84
85
std.debug.print("xrpc createAccount attempt did={s} handle={s}\n", .{ did, handle });
85
85
-
try verifyCreateAccountServiceAuth(request, allocator, did);
86
86
+
try verifyCreateAccountServiceAuth(request, allocator, authorization, did);
86
87
87
88
const account = store.createAccount(allocator, handle, email, password, did, false) catch {
88
89
std.debug.print("xrpc createAccount rejected account_exists_or_store_error did={s} handle={s}\n", .{ did, handle });
···
139
140
.{ .name = "connection", .value = "close" },
140
141
};
141
142
142
142
-
fn verifyCreateAccountServiceAuth(request: *http.Server.Request, allocator: std.mem.Allocator, did: []const u8) !void {
143
143
-
const raw_header = http_api.headerValue(request, "authorization") orelse {
143
143
+
fn verifyCreateAccountServiceAuth(request: *http.Server.Request, allocator: std.mem.Allocator, maybe_authorization: ?[]const u8, did: []const u8) !void {
144
144
+
const raw_header = maybe_authorization orelse {
144
145
std.debug.print("xrpc createAccount service_auth missing did={s}\n", .{did});
145
146
return http_api.xrpcError(request, .unauthorized, "AuthenticationRequired", "service auth required to migrate an existing did");
146
147
};