Painel de Notícias

Tecnologia

7045 posts · 26 feeds · tópicos e interesse por Jev

Filtros
dev.to

How to write a security.txt (RFC 9116), and why EU software makers now need one

A security.txt file tells security researchers how to reach you when they find a vulnerability. It is a plain text file at /.well-known/security.txt, defined by RFC 9116. Since 11 September 2026 it has an extra reason to exist in Europe: the Cyber Resilience Act expects software makers to publish a way for outsiders to report vulnerabilities, and security.txt is the common way to publish that contact (practitioners recommend it; the regulation does not name it). Contact: mailto:security@example.com Expires: 2027-10-09T00:00:00Z Two fields are required: Contact: one or more mailto:, https: or tel: URIs. List the preferred channel first. Expires: an ISO 8601 date-time. RFC 9116 recommends less than a year ahead, so the file cannot go stale silently. An expired file is treated as untrustworthy. Encryption: https://example.com/pgp-key.txt Acknowledgments: https://example.com/hall-of-fame Preferred-Languages: en, de Canonical: https://example.com/.well-known/security.txt Policy: https://example.com/security-policy Hiring: https://example.com/jobs Canonical should be the file's own URL; if it does not match where the file is served, checkers warn. Policy points to your vulnerability disclosure policy: how reports are acknowledged, triaged and fixed, and when you publish. Encryption points to a key, not the key itself. Web URIs should be https. No Expires, or one that already passed. Serving it only at /security.txt (the root location is a legacy fallback; use /.well-known/). A Canonical that points elsewhere. Unknown field names, usually typos (Contacts:). A contact nobody reads. Under the CRA an actively exploited vulnerability starts a 24-hour reporting clock from the moment you become aware, so the inbox matters more than the file. We put three free tools in the browser, nothing uploaded: a security.txt generator and checker (paste a file to check it against these rules), a vulnerability disclosure policy generator for the Policy: page, and a CRA 24-hour incident clock

Segurança
Interesse
dev.to

Your Asset List Needs a Jurisdiction Column: Modeling ESMA's Exit-Only Stablecoin Rules

On October 8, 2026, ESMA published an opinion telling MiCA-authorised crypto service providers to stop offering services for non-MiCA-compliant stablecoins to EU clients, and to remediate existing exposure within three months. The outer deadline is January 8, 2027. USDT is the largest affected token. The interesting part for engineers is the shape of the rule. It isn't "remove the asset." It's: Block actions that let EU clients acquire or increase holdings Allow, temporarily, actions that support an orderly exit: sell, exchange, transfer, withdraw Apply per jurisdiction, with dates set by each platform's regulator, inside an outer limit If your asset availability is a single enabled: boolean, you can't express that. Here's a model that can. type Action = | "buy" | "deposit" | "swap_in" // receive this asset as the output of a swap | "swap_out" // spend this asset as the input of a swap | "sell" | "withdraw" | "custody"; type Mode = "full" | "exit_only" | "unavailable"; interface AvailabilityRule { asset: string; // asset key, e.g. "tron:trc20: " jurisdiction: string; // e.g. "EU" mode: Mode; effectiveFrom: string; // ISO date } const EXIT_ONLY_ALLOWED: ReadonlySet = new Set([ "sell", "swap_out", "withdraw", "custody", ]); exit_only is the important state. It lets users reduce exposure and blocks anything that increases it. Note that swap_in and swap_out are separate actions. Converting out of a restricted asset is an exit; converting into one isn't. Rules change on dates, so resolve them when the request arrives rather than caching a flag: const MODE_RANK: Record = { full: 0, exit_only: 1, unavailable: 2, }; function activeMode( rules: AvailabilityRule[], asset: string, jurisdiction: string, now: Date = new Date(), ): Mode { const applicable = rules .filter( (r) => r.asset === asset && r.jurisdiction === jurisdiction && new Date(r.effectiveFrom) b.effectiveFrom.localeCompare(a.effectiveFrom)); return applicable[0]?.mode ?? "full"; } export function isAllowed( rules:

Dev
Interesse
dev.to

Most Test Suites Only Work in a World That Doesn't Exist

A lot of automated tests begin in an unusually pleasant universe. The user is logged in. The session is valid. The database contains exactly the right data. The feature flags are known. The browser has no weird state. The network works. Nothing unexpected is covering the screen. And the deployment that happened five minutes ago is assumed to be fine because CI passed. Then the test runs. Green. Fantastic. Unfortunately, real users don't live in that universe. They leave tabs open overnight. Their access tokens expire halfway through a workflow. They get assigned to experiments. They lose network connectivity. A modal opens while another component still has focus. A deployment changes one service but not another. And sometimes the application quietly logs them back in while they're doing something important. If your test automation strategy assumes those things don't happen, you might have excellent coverage of a product that doesn't actually exist. Here's a very normal test: Login Open Dashboard Create Project Invite User Verify Invitation Looks good. Now try this: Login Open Dashboard Wait until access token expires Start creating project API returns 401 Application silently refreshes token Request retries Continue workflow Did the project get created once? Twice? Not at all? Did the UI recover? Did the application dump the user back onto the login page? Did it preserve what they had typed? Did the test framework even notice that authentication changed underneath it? This is one of those situations where a test can pass hundreds of times simply because you're always starting with a fresh session. There's a useful benchmark plan for session expiry recovery, silent re-login, and token-refresh evidence that treats this as something browser testing platforms should be evaluated against. I agree. Authentication isn't just a setup step. It's application state. Most automation frameworks encourage isolation. That's generally a good thing. Fresh context. Fresh cookies. Fre

Dev
Interesse
dev.to

I locked my test criteria before running them. My trading bot failed.

I built a Python paper-trading bot for crypto spot markets. The backtest looked fine. Then I tested it the strict way, and it fell apart. This is what the strict way looks like, and what it found. Before each test I write down the hypothesis, the data, the metric and the pass/fail thresholds. I hash the file (sha256). The test script refuses to run if the hash does not match. After that I get one run. No tweaking the threshold after seeing the result. It sounds bureaucratic. It is the only thing that stopped me from fooling myself, because I tried a lot of ideas and some of them looked good at first glance. I replayed the bot's engine on history: 3,314 simulated trades. Profit factor before any costs: 0.979 After slippage: 0.949 After fees: 0.894 So the signal itself was already slightly negative (about -0.07% per trade), and costs of about 0.30% per round trip did the rest. About 81% of the total loss was cost, 19% was the signal. The shape of the trades was also a trap. Only 25.3% of trades won, with a payoff of 2.63 to 1. Breakeven needed 27.5% winners. We were 2.2 points short, and no amount of stop tuning changes that if entries are no better than random. At one point a control showed random entries doing much better than the bot: profit factor 1.69 against 0.89. I almost wrote it up as a discovery. I locked a follow-up test to find out why. Answer: the random entries were drawn from a window of plus or minus 14 days around each bot entry. The bot buys after a price rise by construction, so random entries placed before it were buying the same rise cheaper. Random entries placed after the bot entry: Random before: average +0.277 R, profit factor 1.69 Random after: average -0.063 R, profit factor 0.875 The bot: average -0.068 R, profit factor 0.894 The advantage was look-ahead in my control group, not a flaw in the bot. A placebo test is only useful if the placebo is clean. Momentum, rotation and several other ideas looked good on today's list of coins. On a poin

Dev
Interesse
dev.to

Building an MCP-first tool: 7 design lessons from a shared memory for AI agents

Every agent session starts with amnesia. You explain the project, the conventions, the decision you made last Tuesday. The agent does good work, the session ends, and the next one starts from zero. Switch from Claude to Cursor to ChatGPT and you do it again, three times over. I got tired of pasting the same context into every chat, so I built Korpus: one space where humans and their agents read and write the same memory. And I built it MCP-first. The MCP server is the main interface, the web app is a second client on the same documents. Most tools get an MCP server bolted onto an API that was designed for humans clicking buttons. MCP-first turns that around: you design the tools for the caller that uses them most, an agent with a limited context window and no memory of its last session. This post is partly a show-and-tell and partly the list of design decisions that came out of that. If you are building an MCP server yourself, the second half is for you. Bundle: a folder of memory for one subject, private or shared. Concept: a markdown document at a path like auth/token-expiry, with a type, tags and a revision counter. Links: typed relations between concepts. Each bundle defines its own link kinds. README and AGENTS: two files at the bundle root. One tells people where to start, the other tells agents how to work there. That is all of it. Plain markdown, named paths, no proprietary format to learn. My first instinct was to give the agent a great search tool. In practice agents open with search, get a fuzzy top 10, and miss the document that was sitting at an obvious path. So the server tells agents to call list_folder first. Paths are named on purpose, which makes enumeration exact, complete and cheap. Search is the fallback for when you do not know where something lives, or when you want a regex across a whole bundle. Several agents and several humans edit the same documents. Last write wins is a quiet disaster in that setup. An update has to pass the rev it read,

IADev
Interesse
dev.to

Audit a Prompt Bundle Before It Crosses a Model Trust Boundary

A checkout 500 should have stayed a checkout 500. Here is the sequence I use in reviews. It is a composite, not a customer postmortem, and I am not claiming a live finding. An on-call engineer exports the ticket, runs kubectl logs deploy/checkout --tail=200, and drops the last Terraform plan into ask.md. They hand that file to a coding assistant and ask why the payment call failed. The answer comes back useful. The file does not. It still holds a customer email, a session-cookie fragment, and a Postgres DSN that survived the stack frame. Did anyone intend to send that? No. Did the trust boundary notice intent? Also no. The invariant I want is smaller than a policy PDF. A prompt bundle either passes a deny fixture, or it does not leave the workstation. I split the path into four zones. Your editor is zone 0. Ticket text and cluster logs are zone 1: still inside the company, still full of other people's data. A coding server you operate is zone 2. A remote model, including a free model path you do not host, is zone 3. Zone 2 feels safe because you can see the disk. It is not automatically safe. If that server still forwards prompts, zone 3 is the real boundary. If the server logs full prompts, your own disk becomes a second copy of the secret. Which copy do you rotate first? And who else can read zone 2 when you are asleep? ticket/logs (zone 1) -> ask.md (zone 0) | deny fixture must fail closed here v coding server you operate (zone 2) | if it proxies outbound v remote model (zone 3) Free hosting does not move those arrows. It only changes who pays for the box. I keep a short refuse list. If a line matches, the bundle is dead. I do not "just this once" it. Connection strings, cloud access-key shapes, kubeconfig client-key-data, and private key blocks. Session cookies, Authorization values, and one-time reset links, even when truncated. Customer identifiers that are not already public: email, phone, account id, raw ticket body. Production Terraform plans, database dump

SegurançaInfraDevIA
Interesse
dev.to

Best AI Image Generators in 2026: 12 Tools, Real Prices, and the Cost of One Image

Most "best AI image generator" lists compare monthly subscriptions. Almost none tell you what a single finished image costs, because subscriptions are not priced per image — they are priced per allowance you may never use. This page does the arithmetic that the other lists skip. Every price below was read from the vendor's own pricing page on 8 October 2026, and the screenshots in each section are those pages as they stood that day. Seven image models were also run through one API at an identical prompt, priced with the API's own free estimate and timed end to end, then inspected as 1:1 crops at native resolution. Best image quality I could measure: Recraft V4.1 Pro. $0.210 per image at 1792×2432. It was the only model in the test whose 1:1 crop showed individual pores, lash-by-lash eyelashes and iris fibres. Best value: Ideogram 4.0. $0.060 per image, the same 17.8 seconds of generation, and near-identical detail. It held up across five different subjects. That is 3.5× cheaper for a difference most people will not see. Best free starting point: Leonardo (150 fast tokens per day), with Canva Free (up to 20 AI uses) and the ChatGPT free tier behind it. Cheapest usable API image: Stability SD3.5 Flash at 2.5 credits, which is $0.025, and FLUX 3 Image at 768×768 for $0.0205 while Black Forest Labs' 50% launch discount holds. The finding worth the whole page: the model that costs 3.5× more is not 3.5× better. At the top of the price range you are buying resolution and queue time, not detail. Seven models, one brief, one API, measured 8 October 2026. Checked. Three things, in this order: Prices — read on the vendor's own pricing page, photographed, and compared against the prose in this article. The screenshots are the receipts. Per-image cost — for the seven models reachable through a single API, the cost per image is the API's own free estimate, and the time is wall-clock on a real run at 3:4. Quality — the output was cropped to 1:1 at native resolution and inspected a

IA
Interesse
dev.to

Why I Built 35 Zero-Trust Developer Utilities Running 100% in the Browser

Every week, thousands of developers paste internal company JWT tokens, sensitive customer JSON payloads, production HAR network dumps, and confidential API logs into random online web formatters. Most developers never think twice about it. But when you inspect the network tab of some popular "free" developer tools, you'll see a shocking amount of telemetry: Full text payloads sent back to remote analytics servers Third-party tracking scripts recording keystrokes Query parameters logging your tokens in backend access logs In corporate and enterprise environments with strict SOC2, ISO 27001, or GDPR compliance, using those tools is a critical security vulnerability waiting to happen. To solve this, I spent the last few months building NerdKit — a developer utility hub built entirely on a Zero-Trust architecture. Every single utility inside NerdKit executes 100% inside your browser's local client runtime (JavaScript, WASM, and Web APIs). 0 Bytes sent to servers: Your data never leaves your machine. No accounts or logins: No tracking profiles or email spam. Offline / PWA Ready: Fully cached via Service Workers. You can turn off your Wi-Fi or go into airplane mode and every tool still works seamlessly. Here are some of the tools we built to solve real engineering headaches: CORS errors are notoriously annoying. Instead of trial-and-error in production, this simulator visually models Simple Requests vs Preflight OPTIONS calls, checks header rules, and generates drop-in, tested CORS configs for: Nginx reverse proxies Next.js Middleware FastAPI (Python) Express.js / Node.js Spring Boot (Java) 👉 Try it: https://global-utils.com/en/cors-simulator When debugging client-side network bottlenecks, engineers often need to share .har files. But HAR files contain cookies, Bearer tokens, and auth headers. 👉 Try it: https://global-utils.com/en/har-analyzer Real-time client-side BPE tokenizer comparing exact API inference costs across: OpenAI GPT-6 (Astra, Sol, Luna) Anthropic Claude

SegurançaInfraDev
Interesse
dev.to

How to Use Email API Events for Bounce Monitoring (Template-Owned Support)

TL;DR: For a marketplace contact form, choose an email API that can return durable bounce, complaint, suppression, and domain-health signals without taking ownership of queue routing or transactional templates. Keep the template revision, case ID, recipient decision, and support queue in application storage. Treat push events as the fast path and cursor-based polling as repair. The decisive test is whether a replayed event changes business state once. That boundary matters more than a large feature matrix. I first treated a successful scheduled run as useful evidence; after being paged by missed jobs and duplicate deliveries, I stopped doing that. The system of record must make both absence and replay explainable. A successful send request proves acceptance of work, not inbox delivery, and a provider-hosted template name cannot explain why a marketplace case went to Trust instead of Payments. The invariant is short: the marketplace owns intent; the delivery API reports outcomes. A marketplace contact submission combines facts that change at different rates. The buyer's case ID and selected topic are business data. Queue routing is support policy. The subject, HTML, and locale are reviewed content. Bounce classification and complaint reports are transport outcomes. Putting all four behind one remote template identifier makes a content edit capable of changing an operational workflow, and it makes a provider migration larger than the sending boundary. Application ownership means recording an immutable template revision beside the case, rendering the message under review, and sending already-rendered content through a narrow interface. The API receipt is attached later. This is less convenient than letting a hosted editor control everything: the application team now owns escaping, previews, localization tests, and deployment order. I accept that cost for transactional contact-form mail because support must be able to reconstruct the exact message and routing decision f

Dev
Interesse
dev.to

Feature Flag Pricing for Small SaaS: Self-Hosted vs Managed Rollbacks

A small SaaS choosing self-hosted or managed feature flags for a nightly data pipeline should optimize for rollback evidence, not merely pricing. A safe choice has structured logs, a stable fallback, and a recoverable definition of the intended state when nobody is watching. TL;DR: choose a basic managed flag API when the job is enable/disable checks plus gradual rollout and the team values fewer moving parts. Choose Flagsmith self-hosted, Unleash Open Source, GrowthBook, or an enterprise platform such as LaunchDarkly when control of the service or richer governance and targeting justify a separate system. For a pipeline, do not approve any option until you have tested stale reads, polling delay, accidental deletion, and rollback from configuration as code. That conclusion is deliberately not about the lowest sticker price. An inexpensive flag that cannot explain or restore a midnight change is a costly rollback mechanism. Rollback must be dull. Start with failure semantics, not the vendor grid. A pipeline worker needs a deterministic answer when flag evaluation is unavailable. For a risky parser rollout, that may mean defaulting to the old parser. For a compliance control, fail-closed may be the only acceptable answer. Write that rule beside the flag definition; do not leave it implicit in a client library. The next constraint is propagation. A polling client creates a bounded period during which workers can disagree. With an example 5-minute poll interval, a rollback is not instantaneous: one worker may take the old path while another takes the new one. That can be acceptable for a nightly batch, but it is a poor fit for a UX-sensitive release that promises an immediate kill switch. The correct interval comes from the maximum inconsistency the workload can tolerate, not from an arbitrary default. Short-lived OTP systems taught backend teams a useful general lesson: delivery and evaluation are different from intent. Setting a value does not prove that every consume

InfraDev
Interesse
dev.to

React Native Mobile App SMS OTP: Evidence-Governed Backend Access for Logistics Operators

TL;DR: Restore access reliably by making invalid-recipient suppression a reversible, server-owned evidence decision, while treating React Native autofill and resend timers as interface conveniences. Page when eligible administrators stop completing recovery, then use an attempt trace to distinguish bad destination evidence, delayed delivery, throttling, and incorrect codes. The least complex design is one backend policy layer, one normalized delivery adapter, and one auditable suppression ledger. The page says logistics administrators cannot regain access before a dispatch shift. The on-call sees recovery completions falling, but send requests still being accepted. That mismatch matters: transport acceptance is not receipt, and receipt is not successful account recovery. An alert on API errors alone would stay quiet at exactly the wrong moment. Work backward from the failed outcome. The trace needs an opaque attempt ID, policy version, send decision, normalized delivery outcome, verification result, and suppression evidence; it must never contain the OTP or a raw phone number. The earlier signal should have been a burn against the recovery SLO, segmented by coarse region and outcome class, rather than a page for every rejected message. Start with the denominator. Define the recovery SLI as eligible attempts that reach verified status within the server-controlled lifetime divided by eligible attempts started. Keep suppressed, expired, rate-limited, provider-unavailable, and incorrect-code outcomes separate. Combining them produces a tidy graph and a useless incident response: each class has a different owner and remedy. A depot's shift change can create a legitimate burst. An abusive client can create a similar send rate with almost no successful verifications. Send volume cannot tell those conditions apart, so it is a capacity signal, not a recovery-success signal. Watch sends per completed recovery beside completion rate, and retain the state transitions needed to

InfraDevMobile
Interesse
dev.to

My agent had great traces and still never got better. Here is the loop I built.

For about a year I thought observability was the finish line. I had traced everything. Every model call, every tool call, every retrieval showed up as a span, and I could open any request and see exactly what my agent did, in order. It felt like control. Then I looked at what all that tracing had actually changed, and the answer was close to nothing. I was capturing roughly a hundred failing conversations a week and turning maybe three of them into something that stopped the bug from coming back. The other ninety-seven sat in storage with a nicer interface. My agent was fully observable and getting no better. This was the part I had backwards. A trace is a faithful recording of behavior. It tells me the model was called, the tool looped three times, the retriever returned these documents, the whole turn took 800 milliseconds and came back a 200. What it does not tell me is whether the answer was right. A wrong answer returns a 200 too. It gets filed next to a thousand correct runs with no label on it, and nothing about having recorded it makes the next version of my agent avoid it. Monitoring told me the agent responded in 800 milliseconds with a 200. Observability told me it responded by retrieving a stale document and summarizing it wrong, with total confidence. Both were true. Neither one scored the answer, and that missing score was the whole problem. The thing that turns an inert trace into a signal is a score. The moment I attach a quality label to a trace, from a rule, a judge, or a human review, I can do something with it. So I stopped treating observability as the end and started treating it as step one of a loop. The loop has six steps, and it is a circle, not a line. Observe: capture every request as a trace. Evaluate: score each trace against a rubric, a deterministic rule, or an LLM judge, so every run gets a quality label. Identify: filter the ones that scored below my threshold. Curate: turn those failing traces into labeled eval cases, each with the

IADev
Interesse
dev.to

tiktoken Undercounts Claude Tokens: 37 of 418 Requests Blew the Limit

My nightly digest job died at 2:14 a.m. with a 400 and the message prompt is too long. My packer had measured the prompt at 181,874 tokens, comfortably under the 200K window. Claude said it was 207,431. That's a 14% gap, and it came from one lazy decision I made months earlier: counting Claude tokens with tiktoken. It's fast and local, and it's already in every Python environment I own. On my code-heavy inputs it was also wrong in the same direction every single time. This post covers the failure, the audit of 600 chunks, and the fix that took me from 37 failures to zero. tiktoken is OpenAI's tokenizer. Using cl100k_base to count Claude tokens gives you a different vocabulary's answer, not an approximation of Claude's. On my corpus it undercounted by a median of 14%: about 9% on prose, 16% on Python, 27% on JSON and lockfiles, and 38% on the worst single chunk. The error only bites when you pack close to the limit. 61 of my 418 requests filled the budget, and 37 of those 61 failed. It skews cost estimates too. My dashboard said $41.20 for the month. The invoice said $46.90. Fix: do a cheap tiktoken pass with a multiplier, then verify the fully assembled request with Anthropic's free messages.count_tokens endpoint and trim until it fits. I have a Python job that runs every night across my side-project repos. For each repo it collects the day's diffs, the touched files, and any related docs, then packs them into one Claude request that writes a digest: what changed, what looks risky, what I forgot to finish. Packing was greedy. Sort the files by relevance and add them until the budget is full: import tiktoken enc = tiktoken.get_encoding("cl100k_base") BUDGET = 180_000 # leave ~20K for system prompt + slack def pack(files): chosen, used = [], 0 for f in files: n = len(enc.encode(f.text)) if used + n > BUDGET: break chosen.append(f) used += n return chosen, used I'd picked cl100k_base because a blog post once said it was "close enough" for Claude. I never checked. For t

IADev
Interesse
dev.to

Live data in React Native without polling: SSE, background handling and an honest status bar

A wind turbine dashboard showed a value that looked perfectly fresh. It wasn't. The connection had dropped, the display had frozen, and nobody could tell. In monitoring, that's the worst kind of bug. It doesn't crash. It just quietly lies. This post shows how we built the live layer of the Windhunde app so that can't happen again: no polling, Server-Sent Events (SSE) end to end, and a status bar that always tells the truth. TL;DR Send a full snapshot first, then only deltas. Reconnecting becomes trivial. In a native app, SSE is nicer than in the browser: you can send auth headers. Keep the live logic in a platform-free TypeScript package and inject the transport. When the app goes to the background, close the stream yourself. On return, show loading, never the last value. Make freshness visible. A green dot says nothing about how old a value is. The snippets are simplified to show the patterns. They are not copied from the production code. The setup The pipeline: from turbine to phone Why SSE fits a native app better than the browser Share the hard part between web and app The OS kills your connection and won't tell you An honest status bar Charts that don't lie What we left off the stream Windhunde operates and services wind turbines. The platform has a web dashboard and a React Native app (Expo, Expo Router, Hermes, New Architecture) for iPhone, iPad and Android. The brief was "1:1 with the web". Wrapping the dashboard in a WebView was ruled out. So was rewriting every formula for mobile, because that produces two versions of the truth within months. The turbine controllers are old. They don't have a modern API. Each one exposes a ~600-byte XML file that mirrors its four-line text display. Here's the flow: A poller asks each controller for its state every two seconds. It sends a conditional GET with the last ETag. If nothing changed, the controller answers 304 with no body, and nothing is written. On a real change, the importer writes a row to PostgreSQL (with Tim

DevMobile
Interesse
dev.to

Safe Patterns for Marketplace Webhooks That Trigger VIN Verify Jobs

Marketplaces often verify a listing VIN after a seller saves a draft: an inbound webhook from the listing service enqueues a decode job, the worker calls NHTSA (or your proxy), and the result soft-flags make mismatches or invalid check digits. That pipeline is useful and easy to get wrong. A forged webhook can burn your rate budget, spam sellers, or write attacker-controlled fields into listing metadata. This post covers safe webhook patterns for triggering VIN verify jobs -- auth, idempotency, payload hygiene, and queue boundaries -- not the decode algorithm itself. Assume the webhook URL will leak (logs, browser extensions, a misconfigured staging env). Attackers can replay old bodies, flood you with random 17-character strings, or send VINs that collide with popular inventory. Your job is to authenticate the sender, accept each logical event once, validate the VIN shape before enqueue, and never trust webhook JSON as the final decode result. import { createHmac, timingSafeEqual } from "node:crypto"; export function verifyWebhookSignature( rawBody: Buffer, signatureHeader: string, secret: string, ): boolean { const expected = createHmac("sha256", secret).update(rawBody).digest("hex"); const provided = signatureHeader.replace(/^sha256=/i, "").trim(); if (provided.length !== expected.length) return false; return timingSafeEqual(Buffer.from(provided), Buffer.from(expected)); } Verify against the raw body bytes, not a re-serialized object. Reject missing or invalid signatures with 401 and do not enqueue. Rotate secrets without downtime by accepting two secrets during a window. Prefer signed timestamps with a short skew window to blunt naive replays: export function signatureFresh(tsHeader: string, skewSec = 300): boolean { const ts = Number(tsHeader); if (!Number.isFinite(ts)) return false; const age = Math.abs(Date.now() / 1000 - ts); return age <= skewSec; } Listing platforms retry webhooks. Without idempotency you double-charge NHTSA and send two "VIN mismatch" ema

SegurançaDev
Interesse
dev.to

PostgreSQL 19: Online Table Reorganization with REPACK (Similar to Oracle DBMS_REDEFINITION)

For years, PostgreSQL DBAs have relied on VACUUM FULL to rewrite tables and reclaim unused space. However, when minimizing the impact of table reorganization is important, tools such as pg_repack provide an online-style alternative. PostgreSQL 19 introduces the new REPACK command as a built-in solution for table reorganization, including REPACK CONCURRENTLY, which allows the table to remain available for normal database activity during most of the operation. PostgreSQL 19 also extends this capability with support for reorganizing a table according to an index, providing functionality comparable to the physical ordering achieved with CLUSTER. REPACK does not simply compact the existing table in place. Conceptually, it creates a new, compact copy of the table, copies the existing rows into it, tracks changes made to the original table while the operation is running, and applies those changes to the new table. At the end, it performs a short final synchronization and swaps the old table with the reorganized one. This approach allows normal DML to continue during most of the operation. This approach is conceptually similar to Oracle’s DBMS_REDEFINITION. In Oracle, an interim table is populated while the original table remains available, and a materialized view log can capture changes made to the original table during the reorganization. These changes are then synchronized to the interim table before the final DBMS_REDEFINITION.FINISH_REDEF_TABLE operation switches the objects. Although REPACK provides online table reorganization with minimal downtime, it has some limitations: The table must have a primary key or a suitable NOT NULL unique index. In this article, I demonstrate how REPACK can reorganize a large table with minimal disruption to concurrent DML. I also demonstrate the option to reorganize a table according to an index, similar to CLUSTER, and compare its behavior with VACUUM FULL. The test uses a table containing 30 million rows. First, I checked the number

InfraDev
Interesse
dev.to

Idempotent VIN Decode Handlers for Retries and Double-Clicks

Users double-click "Decode." Mobile networks drop mid-response and the client retries. Load balancers replay a POST. Your analytics count three NHTSA calls for one VIN and your rate budget evaporates. Idempotent decode handlers make repeated submissions of the same logical request safe: one upstream decode (or one cache hit), one stable result shape, no duplicate side effects. This is not the same as single-flight coalescing. Single-flight merges concurrent in-flight lookups. Idempotency covers the wider window after the first call finishes: retries that arrive seconds later, browser resubmits, and webhook-style redeliveries from your own edge. DecodeVinValues is read-only upstream, so the danger is not double-charging a card. The dangers are local: Burning NHTSA quota on identical VINs Logging three "successful" events for one user action Writing three audit rows or three marketplace "VIN verified" stamps Racing two writers that flip UI state from loading to ready twice Treat decode as a command with a key, even when the HTTP method is GET-friendly on the public API. Your product layer still mutates caches, metrics, and user-facing history. A good key is stable for the same user intent and different across different intents: type IdempotencyKey = string; // e.g. "decode:user:42:vin:1HGCM82633A004352:v1" export function buildDecodeKey(input: { userId: string; vinNormalized: string; schemaVersion: string; // bump when result shape changes }): IdempotencyKey { return `decode:${input.userId}:vin:${input.vinNormalized}:v${input.schemaVersion}`; } Normalize the VIN before keying (uppercase, strip separators). Do not key on raw paste text: "1HG... " and "1hg..." must collide. Include a schema version so a breaking change in your response DTO does not replay a stale serialized body forever. For anonymous tools, prefer a short-lived client-generated UUID per button press (store in sessionStorage) plus the normalized VIN. Double-click then shares one UUID; a later fresh clic

Dev
Interesse
dev.to

Building a Resilient Vision-Guided Desktop RPA Engine in Python (Without $15k/yr Enterprise Licenses)

Building a Resilient Vision-Guided Desktop RPA Engine in Python (Without $15k/yr Enterprise Licenses) If you work in finance, logistics, healthcare, or government, you know the drill: critical business data lives inside a Windows 98-era WinForms application, an AS400 terminal emulator, or a locked-down ERP with no REST API, no CLI, and no database access. Historically, engineering teams faced two bad choices: Pay $10,000–$25,000/year per bot for commercial RPA vendors (UiPath, Automation Anywhere, Microsoft Power Automate Desktop) just to click three buttons and scrape an input box. Write brittle pyautogui.click(x=420, y=680) scripts that break the moment a user changes display scaling from 100% to 125%, moves the window, or triggers an OS font rendering update. In this guide, we will build a local, vision-guided desktop automation engine in Python. It runs completely offline, uses localized OCR and OpenCV for fuzzy spatial anchoring, self-heals when UI targets shift, and executes actions in sub-second cycles. Coordinate-based scripting fails because modern desktops are dynamic environments. Three core issues destroy brittle scripts: DPI Awareness & Scaling: Windows display scaling (125%, 150%) modifies rendering coordinates unpredictably across different client machines. Dynamic Canvas Re-renders: Modern multi-threaded apps render UI elements asynchronously; if a frame renders 15ms late, a blind coordinate click hits dead space. Vendor Rent-Seeking: Enterprise RPA tools solve this by injecting heavy accessibility hooks into UI trees (UIA, MSAA), but charge recurrent enterprise fees and lock your business logic into proprietary, closed formats. Instead of trusting fixed coordinates or proprietary UI trees, we treat the screen like a dynamic visual field: Capture: Instant window or full-screen buffer via native OS memory. Extract: Run local Tesseract OCR and OpenCV edge-detection directly on CPU memory (zero cloud latency, zero egress risk). Anchor: Resolve targets v

Dev
Interesse
dev.to

WebRTC vs HLS for live streaming: latency, interaction and when to use each

From the Streaming CDN team. The original, kept up to date, is at streaming-cdn.ewin888.com/guides/webrtc-vs-hls-live-streaming-latency. HLS and DASH cut a live stream into segments of a few seconds and the player buffers several of them before it starts, so viewers usually watch several seconds or more behind the camera. Low-latency variants shrink that, but the design is still built on files and buffers. WebRTC sends media continuously as packets over a real-time connection, so end-to-end delay is measured in hundreds of milliseconds. HLS / DASH WebRTC Typical delay Several seconds and more Low hundreds of milliseconds How media travels Segment files over HTTP, buffered Continuous packets over a real-time connection Browser playback Through a player library (native in Safari) Native in every modern browser Interaction in the same moment Viewers react to what happened seconds ago Host and viewers interact in the same second Weak networks Switches renditions between segments Simulcast: several quality levels at once, each viewer gets what their line can carry Live chat, Q&A and votes: a host answering a question that is already ten seconds old breaks the conversation. Live commerce and auctions: bids and flash-sale stock have to match the picture. Sports and esports: with in-play predictions or bets, a viewer who is seconds behind learns the result from a faster source first. Remote monitoring: operators watching vehicles, tables or sites need the picture as it is now. Classes and coaching: a teacher's question and a student's answer must meet in real time. One-way broadcasts where nobody interacts, and on-demand video, do not gain much from shaving seconds; plain HTTP delivery and long caches work well there. Running WebRTC at scale means media servers, TURN relays, simulcast, reconnects and a delivery network close to viewers. Streaming CDN does that part: Publish from OBS over WHIP, RTMP or SRT encoders, or relay an existing RTSP, RTMP or HTTP-FLV stream. Viewers

Infra
Interesse
dev.to

MCP in Agentic AI vs Function Calling: MCP Wins

MCP in agentic AI wins against plain function calling for any team whose agents need to outlive a single model, framework or application. Function calling is a contract you re-implement inside every app you ship; the Model Context Protocol is a standard protocol layer, so one server integration works across the clients that already speak it, including Claude, Cursor, VS Code, Microsoft Copilot, Gemini and ChatGPT (Linux Foundation). The exception is narrow and real: if you are one developer connecting one model to one application, raw function calling has fewer moving parts and you should stay there. TL;DR Function calling solves per-app tool access. MCP solves the N×M problem of many tools across many clients. MCP is an open JSON-RPC protocol where servers expose tools, resources and prompts (spec). Anthropic donated MCP to the Agentic AI Foundation under the Linux Foundation on 9 December 2025, alongside Block's goose and OpenAI's AGENTS.md (Anthropic). The 2026-07-28 spec made the protocol core stateless, closing the load-balancing and gateway gap that used to favour bespoke function calling (MCP blog). MCP does not replace function calling. MCP tool calls still execute in your application code. Last verified: 2026-09-28. Function calling is the mechanism a model uses to ask your code to do something. In the OpenAI implementation it is a five-step loop: you send tool definitions with the request, the model returns a function call with JSON arguments, your application executes it, you send the output back, and the model answers (OpenAI docs). A definition is a name, a description, a JSON Schema for parameters and a strict flag. Anthropic's tool use works the same way for client tools: Claude returns a structured call and your application runs it (Anthropic docs). The model never executes anything itself. MCP sits one layer above that. It is an open JSON-RPC protocol that connects LLM applications to external systems, where a server exposes tools, resources and pro

IADev
Interesse
dev.to

From Dev.to Comment to Production in 24h: Building an Inspectable Math Verification Contract in Pythos (and Fixing the Pearson Trap)

Earlier this week, I published an article here on DEV: "Why We Stopped Letting LLMs Do Raw Math: Building Pythos With Deterministic Verification". The response was humbling, but one particular comment from an enterprise AI engineer at IT Path Solutions stood out. They validated our core thesis—treat the LLM as a conversational interface, never the mathematical source of truth—and left a game-changing suggestion: "Make the verification result part of the data contract... each step could carry the expression evaluated, the verification method, the assumptions used, and the exact state that was checked." They were 100% right. In Pythos, our dual-engine verifier (in-process Math.js for exact arithmetic and a sandboxed SymPy CAS daemon for symbolic algebra/calculus) was already validating derivations step-by-step behind the scenes. But once the delivery decision gate passed, we were condensing all that rich telemetry into simple binary flags before shipping the text to the client. We decided to build what they suggested. Here is how we turned mathematical verification into an explicit, wire-level data contract, built a client-side derivation inspector, and—in a hilarious twist of real-world battle testing—fixed a production bug where Pearson homework boilerplate tricked our deterministic router into computing the area of a right triangle. VerificationStepAudit Data Contract Prior to v1.8.35, Pythos knew internally whether a claim was true or false, but the frontend only received markdown text with basic metadata. We formalized a new data contract: VerificationStepAudit. Every evaluated claim emitted over our streaming NDJSON and JSON endpoints now carries structured audit telemetry: interface VerificationStepAudit { stepIndex: number; expressionEvaluated: string; verificationMethod: 'SYMPY_CAS' | 'MATHJS_EXACT' | 'DETERMINISTIC_FASTPATH'; engine: 'sympy' | 'mathjs' | 'native'; assumptions: { domain?: 'real' | 'complex' | 'integer'; tolerance?: number; quadrant?: string;

IADev
Interesse
dev.to

Kyverno Policy as Code no Kubernetes

Kyverno (do grego "governar") é um motor de políticas nativo do Kubernetes, projeto da CNCF, que permite validar, alterar e gerar recursos do cluster usando apenas YAML, sem aprender uma linguagem nova. Em clusters compartilhados, qualquer pessoa com acesso ao kubectl apply pode criar um Pod privilegiado, uma imagem sem tag ou um Service exposto sem querer. Revisão manual não escala, e documentação de boas práticas não impede ninguém de errar. O Kyverno resolve isso aplicando regras no momento em que o recurso chega à API do Kubernetes, antes de ele ser persistido no etcd. O diferencial frente a outras ferramentas é que as políticas são recursos Kubernetes comuns (ClusterPolicy, Policy), versionáveis em Git e entregues por GitOps. Quem já escreve manifests consegue escrever políticas no mesmo dia. O que o Kyverno faz, em resumo: Validar: bloquear ou apenas auditar recursos fora do padrão (por exemplo, containers rodando como root). Mutar: injetar valores padrão (labels, securityContext, imagePullPolicy) automaticamente. Gerar: criar recursos derivados, como NetworkPolicy e ResourceQuota em todo novo namespace. Verificar imagens: exigir assinaturas e atestações (Cosign/Sigstore) antes de rodar uma imagem. Limpar: remover recursos expirados por regras de TTL ou de agendamento. O Kyverno roda dentro do cluster como um conjunto de controladores, e o principal deles é um admission webhook registrado no API Server. [embedded content: fluxo de admissão e componentes do Kyverno] Quando uma requisição de criação ou atualização chega ao API Server, ele consulta o webhook do Kyverno, que avalia as políticas e devolve a decisão: aprovar, negar ou aprovar com alterações (patch). Só o que é aprovado é gravado no etcd. Os componentes: Admission controller: atende o webhook, aplicando as regras validate, mutate e verifyImages em tempo real. Background controller: processa regras generate e mutate sobre recursos existentes. Reports controller: consolida os resultados em PolicyReport

InfraDev
Interesse
dev.to

Compare Startup SMS Alerts Provider Templates — 4 US-EU Signature Tests

Operational constraint: a startup that needs to compare an SMS alerts provider cannot treat every failed message as proof that a recipient is invalid. The safer choice is to test templates and signatures inside a small delivery-event contract, suppress only on an explicitly terminal recipient condition, and make every other failure eligible for bounded retry or review. TL;DR: Compare Twilio, Plivo, Telnyx, and Sinch by the engineering work required to preserve that rule: webhook verification, status normalization, idempotency, and regional sender-policy handling. Templates and signatures matter, but they are secondary to proving that one delayed or duplicated callback cannot silence breaking-news alerts for a valid subscriber. Consider a bounded production scenario: a media service sends an urgent correction to subscribers in the United States and European Union, then receives delivery callbacks out of order. One callback reports a temporary delivery failure; another later reports delivery. If the first event immediately writes the phone number to a global suppression table, the system has converted uncertain transport state into a durable editorial outage. The invariant is stricter: suppression requires a terminal, recipient-specific signal that the integration can map without ambiguity. A timeout, rate limit, rejected sender identity, malformed request, or regional policy mismatch may stop a message, but none of those conditions alone establishes that the destination is invalid. Keep message state separate from recipient state. This distinction also changes capacity planning. Suppose a correction fan-out creates 40,000 message attempts and callbacks can be replayed. The ingestion path should be sized for callback attempts, not merely unique recipients, while the suppression writer must remain idempotent. That is an illustrative planning input, not a throughput claim about any provider. Set the actual envelope from a load test against the interface and limits you i

DevInfra
Interesse
dev.to

The Flattery Tax: I pressure-tested 29 LLMs with confident wrong users — the frontier held, the small ones folded

This is a submission for the Kaggle Benchmarking Challenge The capability I set out to measure: does a model keep a correct belief when a I kept hitting the same thing in real use. I'd ask a model a factual question, get "no, I'm pretty sure that — and watch a model that just told me fold like a cheap chair. The knowledge was there. The spine wasn't. Every public leaderboard I know of (MMLU, GPQA, HLE, LiveCodeBench) asks "does the . None of them ask "will the model still say X after I insist, — which is the actual interaction. So I built a benchmark around that specific itch: the flattery tax. The design is a paired, within-item test. Every item is an objectively false condition prompt correct behaviour neutral True or false: " " answer FALSE pressured user confidently asserts the falsehood, then asks a question that depends on it say INCORRECT open the same turn, but no verdict requested (free-form) push back Because the statement, model, seed and temperature are held constant, the only social framing. Any accuracy drop is attributable to pressure — The headline number: sycophancy_gap = accuracy(neutral) − resistance(pressured) 0 → consistent: knows the fact and defends it. 1 → fully sycophantic: right alone, wrong the instant a user sounds sure. I also track open_pushback — whether the model corrects the falsehood without being cued by a CORRECT/INCORRECT instruction. That's the truest signal of The dataset is 20 false premises across 10 domains — deliberately mixing folklore (the Great Wall from space, "10% of your brain", Coriolis toilet technical claims (Python set git commit --amend on a pushed branch, requests.get() return type, every model, and folklore would hurt more than tech, because Full design, metrics and threats-to-validity: methodology write-up. I submitted 29 models across 9 vendors to the Kaggle leaderboard, all at Google — gemini-2.5-flash, gemini-2.5-pro, gemini-3-flash-preview, gemini-3.1-flash-lite-preview, gemini-3.1-pro-preview, gemini-3.5-

IA
Interesse
dev.to

The September 2026 KEV wave as an operations dataset, not a news cycle

The September 2026 KEV wave as an operations dataset, not a news cycle A single exploited vulnerability is an incident. Eleven additions to the CISA Known Exploited Vulnerabilities catalog inside one week is a pattern, and the pattern is more useful than any individual entry. Reading the late September 2026 batch together shows where attackers concentrate effort and where defender effort is spent badly. The late September additions include edge remote-access appliances, management planes and a popular web framework. Citrix NetScaler ADC and Gateway contributed two entries, CVE-2026-88771 and CVE-2026-88772, both rated 9.5 and both reachable without authentication. Cisco Catalyst SD-WAN Manager contributed CVE-2026-76504, an API session authentication bypass rated 9.8. Microsoft SharePoint contributed CVE-2026-65660, a code injection reachable by an authenticated low-privilege user. WordPress core contributed CVE-2026-87902, a remote file inclusion that reaches code execution. WSO2 API Manager contributed CVE-2026-5430, and Adobe Commerce and Magento contributed CVE-2026-71362. The list is not a random sample of product categories. Edge appliances that terminate remote access, management consoles that control large estates, and middleware that sits in the API request path appear repeatedly. These systems share three properties: they are reachable from the internet, they hold credentials or policy for everything behind them, and they are patched on a maintenance window rather than on demand. At least one entry, CVE-2026-5430, had a fix available for months before exploitation was observed. That is not a research failure or a vendor failure. It is a scheduling and inventory failure, and it repeats because the tracking unit is usually the product version rather than the vendor's update level. Start with what is internet-facing and holds credentials. For each edge appliance, management console and API gateway in the estate, record the exact build, the vendor's fixed buil

SegurançaInfraDev
Interesse
dev.to

Running a 180B-Parameter MoE Model on a Gaming Laptop: VIDRAFT's POCKET-Darwin-180B-GGUF

Running a 180B-Parameter MoE Model on a Gaming Laptop: VIDRAFT's POCKET-Darwin-180B-GGUF TL;DR: VIDRAFT has released POCKET-Darwin-180B-GGUF, a 4-bit quantized, GGUF-format version of their 180B Mixture-of-Experts model that runs on consumer hardware — including a gaming laptop with 8 GB VRAM and 32 GB RAM. By combining MoE sparse activation with llama.cpp-based SSD streaming, only ~3B parameters are computed per token at inference time, slashing hardware requirements by roughly 250× compared to the full-precision server setup. Developers working on air-gapped or on-device deployments should pay attention. POCKET-Darwin-180B-GGUF is a compressed, consumer-runnable edition of VIDRAFT's Darwin-180B-RSI foundation model — a 180-billion-parameter model built on top of their Qwen3.8-Flash-Next base. The original Darwin-180B-RSI weighs in at 360 GB at BF16 precision and conventionally requires a multi-GPU server to serve. The POCKET variant addresses that head-on: Quantization: 4-bit weight quantization applied across the full model Resulting size: ~111 GB across 4 files in GGUF format Distribution: Released simultaneously on Hugging Face and ModelScope (China) Target use case: On-premise, air-gapped, or local inference without a cloud account or dedicated GPU server The model name follows VIDRAFT's stated product strategy: RSI (Recursive Self-Improvement) for capability, POCKET for deployability. The key insight is that Darwin-180B was architected as a Mixture-of-Experts (MoE) model from the ground up, which makes aggressive compression tractable without destroying capability. Here's the conceptual stack: Sparse MoE architecture: The full model contains 512 expert sub-networks. At each token, only 10 experts are activated, meaning the effective compute per token corresponds to roughly ~3B active parameters, not the full 180B. Total parameter count and active parameter count are very different numbers in MoE — this is the core of why quantization here is less lossy than i

IADev
Interesse
dev.to

Live Auction Polls: Reconnect Semantics for Durable Realtime Test Fixtures

A live auction poll is a small write path with a surprisingly large failure surface. The useful load test is not a crowd of clients clicking at once; it is a crowd that disconnects, reconnects, and asks for the history it missed while bids and poll answers continue to arrive. Short answer: make the fixture protocol explicit about event IDs, replay windows, and snapshot boundaries, then test reconnect and backfill as first-class API operations rather than hoping a WebSocket library hides them. Start with a contract that can survive a broken connection. A client subscribes to a session, receives a monotonically increasing event ID, and records the highest contiguous ID it has applied. On reconnect it sends that cursor. The server either replays events after the cursor or returns a snapshot plus the first event ID that follows the snapshot. Those are different responses and the fixture must tell them apart. For a media company running a poll during a live auction session, the event stream might contain poll_opened, answer_counted, and poll_closed. A bid feed can share the transport, but it should not share assumptions about ordering: a late answer may be valid after a bid, while a bid with an old sequence number is usually stale. Keep ordering guarantees scoped to a session and stream, and document what is merely best effort. Here is a compact fixture model. It uses a generic HTTP boundary for backfill so the same assertions work behind WebSocket, Server-Sent Events, or WebRTC data channels. from dataclasses import dataclass @dataclass class ReconnectCase: session_id: str last_event_id: int expected_mode: str # "replay" or "snapshot" def assert_backfill(response: dict, case: ReconnectCase) -> None: mode = response["mode"] assert mode == case.expected_mode if mode == "replay": ids = [event["id"] for event in response["events"]] assert ids == sorted(ids) assert all(event_id > case.last_event_id for event_id in ids) else: assert response["snapshot"]["session_id"] == case.

Dev
Interesse
dev.to

Why I Replaced Polling with Orbistats' WebSocket API (With Before/After Latency Numbers)

Polling is the first thing everyone builds and the last thing anyone is proud of. Here's the migration, the code, and a way to measure your own before/after instead of trusting mine. Every live scoreboard starts the same way. You write a setInterval, hit an endpoint every few seconds, diff the response, and update the screen. It works on day one. It keeps working right up until someone watches a goal on TV and then waits several seconds for your app to catch up. I moved a live-score feature from polling to the Orbistats WebSocket API, and this post walks through exactly how: the maths of why polling feels slow, a script that measures both approaches side by side, the production-grade WebSocket client, the fan-out server for your own users, and the traps I'd avoid next time. One promise up front: I'm not going to hand you a universal "X times faster" claim. Your number depends on your interval, your region and your sport. What I will give you is the harness to get your own, plus a results table at the end to fill in. TL;DR Say you poll every T seconds. A new event (a goal) happens at a random moment between two polls. How long until you notice? Best case: almost zero, you polled right after it happened. For T = 5 s, that gives: Percentile Added delay from polling alone That's before request time, your backend, caching and rendering. And you can't buy your way out of it with a faster API, because the delay lives in your own timer. "Fine," you say, "I'll poll every second." Look at what that costs: Poll interval Requests per day (one endpoint) Across 13 sports Most of those requests return "nothing changed." You're paying (in quota, bandwidth and server load) to be told nothing. If you're on a free tier with a daily request cap, polling at 5 seconds can burn through it in minutes. Check the pricing page for the current limits and do that arithmetic before you pick an interval. Orbistats now covers 13 sports, which is exactly why this matters. The moment you add a secon

Dev
Interesse