Review fixes: no duplicate invoices, safer logins and redirects, one charge per click
Invoicing: the invoice request is marked before it goes to Billingo; a retry after a lost answer looks the invoice up under the invoice's own partner instead of issuing a second one. An invoice issued but never e-mailed counts as issued (downloadable). A Hungarian company with only an EU VAT number is invoiced without a domestic tax number, the EU number in the comment. Security: the login redirect takes only plain local paths (no backslash); the waitlist rate limit and share visits use X-Real-IP, which Caddy sets from Cloudflare's address, not the spoofable first X-Forwarded-For entry; a Google/Apple sign-in to an unconfirmed password account removes its password and sessions; a person's birth data can no longer be published through a share. Credits and jobs: analysis requests are serialized per user, so a double click queues and pays once; a forecast analysis also fixes a person's birth data; admins can restart stuck tarot readings; a worker forgets an attempt an admin restarted, so a stop does not requeue it; two people accepting one comparison invite at once get one comparison. Expired invitations are no longer accepted by e-mail, and unsubscribing revokes the invitation's promo codes too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -28,8 +28,10 @@ async function forward(req: NextRequest, ctx: { params: Promise<{ path: string[]
|
||||
const value = req.headers.get(name);
|
||||
if (value) headers.set(name, value);
|
||||
}
|
||||
const forwardedFor = req.headers.get("x-forwarded-for");
|
||||
if (forwardedFor) headers.set("x-forwarded-for", forwardedFor);
|
||||
// The visitor's address as Caddy set it (from Cloudflare's CF-Connecting-IP,
|
||||
// overwriting any the browser sent).
|
||||
const realIp = req.headers.get("x-real-ip");
|
||||
if (realIp) headers.set("x-real-ip", realIp);
|
||||
|
||||
let res: Response;
|
||||
try {
|
||||
|
||||
@@ -13,10 +13,14 @@ import { GoogleLogin } from "./GoogleLogin";
|
||||
|
||||
export const metadata: Metadata = { title: "Belépés" };
|
||||
|
||||
/** Only local paths, so the login cannot redirect to another site. */
|
||||
/**
|
||||
* Only local paths, so the login cannot redirect to another site: one leading
|
||||
* slash, no backslash (browsers read "/\\evil.com" as "//evil.com") and no
|
||||
* control characters.
|
||||
*/
|
||||
function safeTarget(value: string | string[] | undefined): string {
|
||||
const v = Array.isArray(value) ? value[0] : value;
|
||||
return v && v.startsWith("/") && !v.startsWith("//") ? v : "/";
|
||||
return v && /^\/(?![/\\])[^\\\u0000-\u001f]*$/.test(v) ? v : "/";
|
||||
}
|
||||
|
||||
async function loadConfig(): Promise<PublicConfig | null> {
|
||||
|
||||
Reference in New Issue
Block a user