SShortSingh.
Back to feed

How Python's Fernet Library Uses Symmetric Encryption to Protect Stored Credentials

0
·23 views

Desktop applications that store passwords or API keys locally face a security risk when saving credentials as plain text, since those files can be exposed through backups, sync folders, or accidental sharing. Symmetric encryption addresses this by using a single key to both encrypt and decrypt data within the same application, making it well-suited for local credential storage. Python's cryptography library offers Fernet, a ready-to-use recipe that combines AES encryption, HMAC-based integrity verification, and URL-safe Base64 encoding into one secure package. Unlike plain encryption, Fernet's built-in HMAC check ensures that any tampering with the stored token causes decryption to fail entirely, protecting data integrity alongside confidentiality. The primary challenge with this approach lies in key management, as losing the encryption key renders stored data permanently unreadable, making secure and redundant key storage a critical part of any implementation.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How to Build a Full-Stack RAG Pipeline Using React, Node.js, and MongoDB

A technical walkthrough published on DEV Community explains how to extend a standard React-Express-MongoDB stack with a Retrieval-Augmented Generation (RAG) pipeline for AI-powered applications. The architecture works by splitting uploaded documents into smaller chunks, converting each chunk into vector embeddings, and storing them in MongoDB Atlas for semantic search. When a user submits a question, it is also converted into an embedding and compared against stored vectors to retrieve the most relevant document sections. Those sections are then assembled into a prompt and passed to a large language model, which generates a context-aware response returned to the React frontend. The article also highlights production considerations such as authentication, rate limiting, caching, and hybrid search to move beyond a basic demo.

0
ProgrammingDEV Community ·

Workflow Separates AI-Generated Release Notes from Human-Owned Upgrade Promises

A proposed developer workflow addresses the risk of AI-generated release notes presenting unverified migration claims as reliable facts. The approach splits release communication into two distinct files: a machine-compiled inventory of git commits, file changes, and public symbols, and a separate reviewer-owned contract covering upgrade commands, compatibility guarantees, and breaking changes. Models are permitted to draft summary prose only from the facts file, while the contract must be filled exclusively by a human reviewer who can verify each claim. If any cell in the reviewer contract remains blank, the changelog gate is designed to fail, preventing unverified promises from reaching users. The goal is to ensure that support tickets are not the first real test of an upgrade path by making the distinction between compiled inventory and human warranty visible before release.

0
ProgrammingDEV Community ·

SMTP 250 OK Is Not Enough: Developer Logs 24% Bounce Rate on Verified Emails

A developer discovered on July 15 that 12 out of 50 email addresses bounced despite all returning a 250 OK response during prior SMTP handshake verification. The 24% failure rate exposed a key limitation of relying solely on SMTP checks, which cannot detect role accounts, catch-all domains, or greylisting behavior. To investigate, the developer ran the same list through a third-party API that checks MX records, breach history, role-account flags, and provider identity. The deeper validation revealed metadata that standard SMTP handshakes do not surface, such as whether an address is a role account or has been flagged in known data breaches. The findings highlight why multi-layered email validation is more reliable than SMTP verification alone for production mailing campaigns.

0
ProgrammingDEV Community ·

How to prevent AI coding agents from making destructive changes without human approval

AI coding agents can edit files, run commands, and alter configurations in seconds, raising questions about authority rather than capability. A proposed governance framework classifies agent actions into low-impact reversible tasks, high-risk destructive operations, and undefined-authority situations that require a human approval gate. Before executing any hard-to-reverse action, the agent must document the impact, a rollback path, the justification, and explicit human sign-off — otherwise execution halts. The framework also enforces evidence-based success claims, meaning an agent can only mark a change complete when observable proof exists, not merely the absence of visible errors. A free Portuguese-language starter kit with four policy and checklist files has been published on GitHub, while a more comprehensive paid governance kit is available for R$39.90.