Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/apify-security-basics

@820dfc8
Run it yourself

Secure Apify API tokens, configure proxy access, and protect Actor data. Use when hardening API key management, setting up environment-specific tokens, rotating a leaked token, or auditing Apify security configuration. Trigger with "apify security", "apify secrets", "secure apify token", "apify API key security", "rotate apify token".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/apify-security-basics

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesexamples.md

≈522 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Apify Security — Worked Examples

End-to-end walkthroughs that combine the individual steps in implementation.md into complete scenarios.

Example 1: Bootstrap a new project securely

# 1. Add secrets to .gitignore BEFORE creating .env
cat >> .gitignore <<'EOF'
.env
.env.local
.env.*.local
storage/
EOF

# 2. Create the local .env with your dev token
echo 'APIFY_TOKEN=apify_api_dev_token' > .env

# 3. Confirm nothing is tracked
git status --short   # .env must NOT appear
// 4. Fail fast at startup if the token is missing or malformed
import { requireToken } from './security';
const token = requireToken(); // throws if unset, warns on bad prefix

Example 2: Rotate a token across all environments

# Generate a new token in Console > Settings > Integrations, then:
NEW_TOKEN=apify_api_NEW_TOKEN

# Push to every environment secret store
gh secret set APIFY_TOKEN --body "$NEW_TOKEN"
vercel env add APIFY_TOKEN production

# Verify the new token authenticates before revoking the old one
curl -sf -H "Authorization: Bearer $NEW_TOKEN" \
  https://api.apify.com/v2/users/me | jq '.data.username'

# Only after a successful 200: revoke the old token in Console.

Example 3: Verify a webhook and sanitize before storage

import { verifyWebhookPayload, sanitizeForDataset } from './security';

app.post('/webhook', async (req, res) => {
  const ok = await verifyWebhookPayload(req.body, apifyClient);
  if (!ok) return res.status(401).send('unverified run');

  const clean = sanitizeForDataset(req.body.resource ?? {});
  await dataset.pushData(clean); // PII fields already redacted
  res.sendStatus(200);
});

Example 4: Audit git history for a leaked token

# Search the entire history (all branches) for the token prefix
git log --all -p -- '*.env' '*.json' | grep apify_api_

# If a match is found: rotate immediately, then scrub with BFG
bfg --replace-text <(echo 'apify_api_==>***REMOVED***') .
git reflog expire --expire=now --all && git gc --prune=now --aggressive

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    The skill provides security best practices for Apify, including secret management and data sanitization. It is generally safe, although it handles external data from webhooks which presents a standard surface for indirect prompt injection.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 820dfc8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 4 months ago
What it can do
Reads files Edits files
version
1.5.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
[
  "saas",
  "scraping",
  "automation",
  "apify"
]
All 4 allowed tools
ReadWriteEditGrep
Other metadata
compatibility
Designed for Claude Code

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/apify-security-basics