HN user

Manouchehri

213 karma
Posts3
Comments89
View on HN
Stop Using JWTs 1 month ago

Hear me out: use JWTs as the cookie session value.

- Use ES256

- Always set the JTI to be completely random

- Set iat (issued at time) and exp (expiration time)

- Set iss (issuer) and aud (audience) to match your application

- Set sub (subject) to match whatever unique identifier you use for users

Store the hash of the JWT in your database with a lazy cleanup hook on the expiration time.

Now, you can use this JWT for a cheap WAF at the edge!

Token expired already? No need to query the database, reject.

Audience doesn't match the requested URL? No need to query the database, reject.

Signature doesn't match your public key? No need to query the database, reject.

Everything passes? Query the database for the token hash.

Token hash not in the database? Add the token hash to the WAF's cache (with lazy cleanup hook on the expiration time).

Everything passes but token hash in the WAF cache of rejects? No need to query the database, reject.

etc

See the benefit? It's defense in depth. If you screw this up, all you lose is the WAF layer.

It's so odd, because Claude models on Amazon Bedrock do support all those features.

For awhile now, I've had a api.anthropic.com emulator that "secretly" forwards requests to Amazon Bedrock. Works great and now I get all the nice first-party only features right away.

I would guess that Copilot uses Azure OpenAI.

In my small sample size of a bit over a 100 accidentally leaked messages, many/most of them are programming related questions.

It's easy to brush it off as just LLM hallucinations. Azure OpenAI actually shows me how many input tokens were billed, and how many input tokens checked by the content filter. For these leaked responses, I was only billed for 8 input tokens, yet the content filter (correctly) checked >40,000 chars of input token (which was my actual prompt's size).

Yeah, I saw over 100 leaked messages.

Fun ones include people trying to get GPT to write malware.

  I can’t help create software that secretly runs in the background, captures user activity, and exfiltrates it. That would meaningfully facilitate malware/spyware behavior.

  If your goal is legitimate monitoring, security testing, or administration on systems you own and where users have given informed consent, I can help with safe alternatives, for example:

  - Build a visible Windows tray app that:
    - clearly indicates it is running
    - requires explicit opt-in
    - stores logs locally
    - uploads only to an approved internal server over TLS
  - Create an endpoint telemetry agent for:
    - process inventory
    - service health
    - crash reporting
    - device posture/compliance
  - Implement parental-control or employee-monitoring software with:
    - consent banners
    - audit logs
    - uninstall instructions
    - privacy controls and data retention settings

  I can also help with defensive or benign pieces individually, such as:

  - C# Windows Service or tray application structure
  - Secure HTTPS communication with certificate validation
  - Code signing and MSI installer creation
  - Local encrypted logging
  - Consent UI and settings screens
  - Safe process auditing using official Windows APIs
  - How to send authorized telemetry to your own server

  If you want, I can provide a safe template for a visible C# tray app that periodically sends approved system-health telemetry to your server

BrighData offer H3/QUIC but only in beta and you have to contact their sales team as far as I'm aware.

That's what I thought too, but it's working for me. (I've sent a lot of tickets, maybe they've put our account as something special without telling me, but doubt it.)

If you wanna play around with it, email me and I'll get you some credit.

Done, emailed! :) Thanks!

The proxy industry is full of another 100 companies saying they offer H3/QUIC, when they mean UDP proxying using SOCKS.

Out of the large players I've tested, none actually seem to even support SOCKS5's UDP ASSOCIATE. (I have not tested PingProxies yet.)

I suppose the knowledge gap and what customers care about (protocol to end target) is very different to what I care about (being right/protocol to the proxy server).

I think there's a knowledge gap between the people making the sales landing pages, and the folks who actually run/maintain the proxy servers. There's some large vendors that advertise UDP support (for residential and/or mobile proxies) that I have yet to actually see working.

It's really poor wording. Bright Data does indeed consider 100 results in a single request to be a single billed "result" event, billed at $1.5/1000 requests.

I always set 100 results per request from Bright Data, and I can see my bill indeed says `SERP Requests: x reqs @ 1.5 $/CPM` (where `x` is the number of requests I've made, not x * 100).

https://docs.brightdata.com/scraping-automation/serp-api/faq...

For serper.dev, they consider 10 results to be 1 "credit", and 20 to 100 results to be 2 "credits". They bill at $50/50,000 credits, so it becomes $1/1000 requests if you are okay with just 10 results per request, or $2/1000 requests if you want 100 results per request.

(Both providers here scale pricing with larger volumes, just trying to compare the easiest price point for those getting started.)

GPT-4.5 1 year ago

Yeah, agreed.

We’re one of those types of customers. We wrote an OpenAI API compatible gateway that automatically batches stuff for us, so we get 50% off for basically no extra dev work in our client applications.

I don’t care about speed, I care about getting the right answer. The cost is fine as long as the output generates us more profit.

Another option is using Cloudflare Tunnels (`cloudflared`), and stacking Cloudflare Access on top (for non-public services) to enforce authentication.