jmservera/aithena/security-patterns

Claude Code and agent skill by jmservera/aithena

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

CI workflow security, secrets handling, security scanning, and logging security patterns

Install

npx vskill@latest install jmservera/aithena/security-patterns

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as jmservera/aithena/security-patterns.

Context

Apply when writing/reviewing GitHub Actions workflows, handling secrets, configuring security scanners, or implementing error logging in production services. Defense-in-depth across CI/CD and application layers.

Pattern 1: Secrets Handling in GitHub Actions

Rule: Use with: Parameters, NOT Step env: Blocks

❌ Insecure — secret in env block:

yaml
- name: Assign issue
env:
TOKEN: ${{ secrets.MY_TOKEN }}
run: gh issue edit ...

✅ Secure — inline with parameter:

yaml
- name: Assign issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.MY_TOKEN }}
script: |
await github.rest.issues.addAssignees({...});
Additional Secret Rules
  • Always use `${{ secrets.X }}` syntax — GitHub masking only works with this syntax
  • Never pipe secrets: ${{ secrets.X }} | command exposes in process list
  • Always quote expansions: "${{ env.VAR }}" prevents word splitting
  • Use `::add-mask::` for sensitive output before passing to commands that might echo
  • Token scope: least privilege — use GITHUB_TOKEN for single-repo CI, fine-grained PATs for cross-repo
Token Scope Reference
TokenScopeUse Case
GITHUB_TOKENPR + repo contextCI/CD in same repo
Fine-grained PATSpecific repos + permsDependabot, external tools
GitHub App tokenApp permissions onlyBot automation

Pattern 2: Bot-Condition Guards

For auto-approving copilot PRs, use pull_request_target with author detection:

yaml
on:
pull_request_target:
types: [opened, synchronize]
jobs:
approve:
if: contains(fromJson('["copilot-swe-agent[bot]"]'), github.event.pull_request.user.login)
permissions:
actions: write

Critical: Never use actions/checkout on PR code in pull_request_target workflows. API-only operations, verified author check.

Pattern 3: Security Scanner Configuration

Bandit (Python SAST)
  • Config: .bandit (centralized)
  • Mode: blocking scan; findings should fail the job, then SARIF still uploads with if: always()
  • Keep .bandit in Bandit's project-level INI format and run bandit -r .; treat "Unable to parse config file" and malformed # nosec warnings as actionable
  • Baseline skips: B101 (pytest assert), B104 (0.0.0.0 in containers), B105/B106/B108 (test data), B603/B607 (subprocess in tests), plus documented low-risk test/runtime exceptions
  • Always exclude: .venv, site-packages, node_modules
Checkov (IaC)
  • Config: .checkov.yml
  • Scope: Dockerfiles + GitHub Actions workflows
  • CKV_GHA_7: Document exceptions for workflow_dispatch inputs (SLSA guideline)
  • CKV_GHA_5: Pin actions to SHAs, not floating tags
Zizmor (GitHub Actions Supply Chain)
  • Config: .zizmor.yml (baseline exceptions)
  • Focus: template-injection, dangerous-triggers, secrets-outside-env
  • Pre-commit integration: run before committing workflow changes
Triage Workflow
  1. CRITICAL/HIGH: Must fix OR documented baseline exception with runtime mitigation
  2. MEDIUM/LOW: Baseline exception acceptable if low exploitability
  3. False positive: Dismiss with noqa + inline rationale comment (never suppress silently)
  4. Real findings: Fix if trivial; otherwise document in docs/security/baseline-exceptions.md
  5. Green CI can hide risk: inspect scanner logs/SARIF for soft-fail, continue-on-error, parse warnings, and note-level findings before declaring a security review clean

Pattern 4: Logging Security

Prevent information disclosure in production logs while preserving debugging.

Two-Tier Exception Logging
python
except SomeError as exc:
logger.error("Operation failed: %s (%s)", message, type(exc).__name__)
logger.debug("Full stack trace:", exc_info=True)
Rules
  • Never use `logger.exception()` in production error paths — exposes stack traces
  • Never use `str(exc)` at production log level — may leak internal paths; use type(exc).__name__
  • Never log raw user input at INFO/ERROR level — use document ID or hash only
  • Never use `exc_info=True` at CRITICAL/ERROR level — reserve for DEBUG
API Error Response Pattern
python
try:
result = some_operation()
except AuthError as exc:
logger.critical("Auth failed: %s", type(exc).__name__)
logger.debug("Auth context:", exc_info=True)
raise HTTPException(status_code=401, detail="Invalid credentials")

CI Workflow Security Review Checklist

Before merging a workflow change:

  • [ ] Run zizmor .github/workflows/*.yml — no secrets-outside-env
  • [ ] All secrets use with: parameters, not step-level env:
  • [ ] Template expansions use ${{ ... }}, not $SHELL_VAR
  • [ ] Bot-authored PRs use pull_request_target + author guard
  • [ ] All actions pinned to SHAs
  • [ ] Token scopes match API operations
  • [ ] No hardcoded credentials
  • [ ] Logs don't expose secrets (test with dry-run)

Anti-Patterns

  • ❌ Using CLI flags instead of config files for scanners — centralized config is auditable
  • ❌ Suppressing scanner findings without rationale — bare noqa: S404 tells nothing
  • ❌ Scanning .venv directories — generates hundreds of third-party false positives
  • ❌ Using logger.exception() anywhere in auth/error paths
  • ❌ Relying on "we'll filter logs later" — logs are already shipped to monitoring
  • ❌ Hardcoded secrets in workflow files

References

  • .bandit, .checkov.yml, .zizmor.yml
  • .github/workflows/security-*.yml
  • docs/security/baseline-exceptions.md
  • PR #313 (secrets fix), Issue #294, PR #412 (Dependabot)
  • Zizmor: https://github.com/woodruffw/zizmor
  • SLSA Framework: https://slsa.dev/

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
1
Repository forks
1
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/jmservera/aithena/security-patterns/badge)](https://verified-skill.com/skills/jmservera/aithena/security-patterns)

Something wrong with this skill or its page? Tell us.