Urgent.News

What's breaking now, across thousands of outlets.

Tech

GitHub Actions Secrets: 8 Common Mistakes and Fixes

You build a small automation that posts to Discord when your website goes down. To make it work, you paste the webhook URL into your script. It works on the first try, so you commit it and move on. Months later, you make the repo public to share it. Now anyone can read that URL, and anyone can post to your Discord channel. Secrets are one of those things that feel like a small detail until they…

GitHub Actions provides a convenient way to automate tasks in your repository, but secrets such as API keys, passwords, tokens and webhook URLs can easily leak if not handled properly. Here are eight common mistakes and how to fix them:

1. Hardcoding secrets in files: Instead of placing the secret directly in your script or workflow file, store it as a repository secret in the Settings > Secrets and variables > Actions section. Reference it in your workflow using the env keyword: - name: Send alert env: WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }} run: python alert.py

2. Printing secrets in logs: While GitHub attempts to hide secret values in logs, it's not guaranteed. Avoid printing sensitive data in your debug commands. If you need to verify a secret is set, check if it's empty instead of displaying its contents.

3. Trusting GitHub's log masking: Automatic redaction of recognized secrets in logs is not foolproof. If a secret is encoded or split into multiple parts, it may still appear in plain text. Store each secret as a single value and explicitly hide it using the add-mask command: - run: echo ::add-mask::$CUSTOMER_ID

4. Using overly powerful keys: Grant the minimum required permissions to a key. Use separate keys for each project and consider using restricted keys instead of your primary login credentials.

5. Exposing GITHUB_TOKEN: Every workflow run has a built-in token called GITHUB_TOKEN with potentially excessive permissions. Set read-only access as the default and grant additional permissions only when necessary. Specify permissions at the top of your workflow file: permissions: contents: read

6. Running workflows from pull requests: Public or forkable repositories should avoid running workflows from pull requests, especially when triggered by pull_request_target. Limit workflow execution to direct pushes or specific branches to avoid exposing secrets.

7. Running untrusted text in commands: User-provided input, such as issue or pull request titles, can contain malicious commands that may execute with your secrets. Treat such values as plain text by storing them in environment variables first: - env: TITLE: ${{ github.event.issue.title }} run: echo "New issue: $TITLE"

8. Using unverified third-party actions: Be cautious when using actions created by others. Prefer actions from GitHub itself or well-established, maintained projects. Review the action's functionality before granting it access to secrets. Pin the action to a specific commit SHA instead of a version tag to avoid potential code changes.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Hacktoberfest Weekend Challenge

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend What I Built One Liner is a one-page web app that turns long, over-the-top posts into a single line saying what they…

  • One Liner app condenses long posts into single lines
  • App runs entirely on user's device, no data shared
  • Open-weight models used locally via WebLLM and WebGPU

Sanity vs Payload CMS vs Contentful: Pricing Comparison 2026

Sanity, Payload CMS, and Contentful pricing in 2026 looks radically different depending on how you count. Sanity charges per project and API usage, Payload is open-source but carries real…

  • Sanity charges per project and API usage, with a free tier for small sites.
  • Payload CMS is open-source with infrastructure costs, offering self-hosting options.
  • Contentful bills per seat with steep price increases at scale, suitable for larger teams.

Zinc Whiskers: The Silent Contamination Threat Under AI Data Center Floors

A Routine Maintenance Check Turns Into Sudden AI Cluster Failure In the controlled environment of a large-scale data center supporting continuous AI model training, technicians initiated a scheduled…

  • Technicians discovered zinc whiskers on underfloor system during routine inspection.
  • Whiskers originated from electroplated hardware and traveled via high-velocity airflow.
  • Recovery involved replacing components, installing filters, and switching materials.

More from Saturday 3 October →