skills/hack23/riksdagsmonitor/secure-development-policy

secure-development-policy

SKILL.md

๐Ÿ›ก๏ธ Secure Development Policy Skill

๐ŸŽฏ Purpose Statement

Apply Hack23 AB's Secure Development Policy to demonstrate how security-by-design creates competitive advantages through systematic DevSecOps implementation.

Reference: Hack23 Secure Development Policy

This skill provides comprehensive guidance for implementing all phases of the secure development lifecycle with clear, actionable requirements following STYLE_GUIDE.md icon standards.


๐Ÿ”„ Secure Development Lifecycle (SDLC) - All Phases

๐Ÿ“‹ Phase 1: Planning & Design

Clear Requirements:

  • โœ… Complete project classification per Classification Framework
  • โœ… Document CIA triad levels (Confidentiality, Integrity, Availability)
  • โœ… Define RTO/RPO aligned with business impact
  • โœ… Create SECURITY_ARCHITECTURE.md with Mermaid C4 diagrams
  • โœ… Perform STRIDE threat modeling documented in THREAT_MODEL.md
  • โœ… Complete risk assessment integrated with Risk Register
  • โœ… Calculate security investment ROI based on classification

Deliverables Checklist:

  • README.md includes "Project Classification" section
  • SECURITY_ARCHITECTURE.md created with current state
  • FUTURE_SECURITY_ARCHITECTURE.md created with roadmap
  • THREAT_MODEL.md includes STRIDE analysis
  • Risk assessment documented and registered
  • Cost-benefit analysis approved by CEO

๐Ÿ’ป Phase 2: Development

Clear Requirements:

  • โœ… Follow OWASP Top 10 secure coding standards
  • โœ… Implement language-specific security best practices
  • โœ… Require security-focused code review for all changes
  • โœ… Apply data classification to all code assets
  • โœ… Use GitHub secrets, never hardcode credentials
  • โœ… Implement secret rotation procedures
  • โœ… Use parameterized queries (no SQL injection)
  • โœ… Validate and sanitize all inputs
  • โœ… Encode outputs appropriately for context
  • โœ… Implement proper error handling (no information disclosure)

Code Review Security Checklist:

  • No hardcoded secrets or credentials
  • Input validation on all external data
  • Output encoding prevents XSS
  • Parameterized queries prevent injection
  • Authentication/authorization properly implemented
  • Error messages don't leak sensitive info
  • Logging captures security events
  • Dependencies are approved and scanned
  • Code follows least privilege principle
  • Sensitive data encrypted at rest and in transit

๐Ÿงช Phase 3: Security Testing

Clear Requirements:

๐Ÿ”ฌ SAST (Static Application Security Testing)

  • โœ… SonarCloud integration on every commit
  • โœ… Quality gate must pass (no Critical/High vulnerabilities)
  • โœ… Security hotspots reviewed and resolved
  • โœ… Code coverage โ‰ฅ80% lines, โ‰ฅ70% branches

๐Ÿ“ฆ SCA (Software Composition Analysis)

  • โœ… Automated dependency scanning (Dependabot/Renovate)
  • โœ… SBOM generation (CycloneDX or SPDX format)
  • โœ… License compliance via FOSSA scanning
  • โœ… Vulnerability remediation per classification SLAs:
    • Critical: 24 hours
    • High: 7 days
    • Medium: 30 days
    • Low: 90 days

โšก DAST (Dynamic Application Security Testing)

  • โœ… OWASP ZAP scanning in staging environment
  • โœ… API security testing (authentication, authorization, input validation)
  • โœ… Annual penetration testing for High/Critical projects

๐Ÿ” Secret Scanning

  • โœ… GitHub secret scanning enabled
  • โœ… Pre-commit hooks prevent secret commits
  • โœ… Immediate rotation for any exposed secrets

๐Ÿ”’ Test Data Protection

  • โœ… NEVER use production data in test environments
  • โœ… Anonymize/pseudonymize/mask all test data
  • โœ… Securely delete test data after use
  • โœ… Restrict test environment access (least privilege)

๐Ÿš€ Phase 4: Deployment

Clear Requirements:

  • โœ… Automated CI/CD with security gates
  • โœ… All GitHub Actions pinned to SHA commits
  • โœ… Harden-runner enabled with egress auditing
  • โœ… Least privilege permissions in workflows
  • โœ… Manual approval required for production
  • โœ… Deployment checklist completed
  • โœ… Security metrics and monitoring configured
  • โœ… Rollback plan documented and tested

GitHub Actions Security Pattern:

permissions:
  contents: read  # Least privilege default

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: step-security/harden-runner@<SHA>
        with:
          egress-policy: audit
      
      - uses: actions/checkout@<SHA>
      
      # Pin ALL actions to SHA, not tags

๐Ÿ”ง Phase 5: Maintenance & Operations

Clear Requirements:

  • โœ… Active vulnerability management per Vulnerability Management
  • โœ… Security metrics tracked per Security Metrics
  • โœ… Regular dependency updates (automated via Dependabot)
  • โœ… Security patches applied per classification SLAs
  • โœ… Incident response integration per Incident Response Plan
  • โœ… Annual security review and threat model update
  • โœ… Quarterly dependency and license audits
  • โœ… Continuous monitoring and alerting

Monitoring Requirements:

  • Security event logging enabled
  • SIEM integration configured
  • Vulnerability alerts routed to security team
  • Performance metrics track security impact
  • Compliance dashboards updated real-time

๐Ÿค– AI-Augmented Development Controls

Clear Requirements for ALL AI-assisted development:

๐Ÿ” AI as Proposal Generator Only

  • โœ… All AI outputs require human review and approval
  • โœ… AI cannot bypass CI/CD, security gates, or approvals
  • โœ… Human developer retains accountability for all changes
  • โœ… AI cannot weaken security controls
  • โœ… AI cannot autonomously deploy to production

๐Ÿ“‹ Mandatory PR Review Process

  • โœ… All AI-assisted code goes through standard PR workflow
  • โœ… PR description documents AI assistance used
  • โœ… Security gates enforced (no exceptions for AI)
  • โœ… Human reviewer verifies security controls intact
  • โœ… Testing requirements unchanged (80%+ coverage)

๐Ÿ”ง Curator-Agent Governance

  • โœ… Changes to .github/agents/*.md require CEO approval
  • โœ… Changes to .github/copilot-mcp*.json require CEO approval
  • โœ… Changes to .github/workflows/copilot-setup-steps.yml require CEO approval
  • โœ… Treat as Normal Changes per Change Management
  • โœ… Document risk assessment for capability expansion
  • โœ… All new integrations require security review

๐Ÿ›ก๏ธ Security & Audit Requirements

  • โœ… Agents operate with least-privilege tool access
  • โœ… MCP configurations under change control
  • โœ… All agent activities logged and auditable
  • โœ… Capability expansion requires security review
  • โœ… Quarterly agent ecosystem security audit

๐ŸŽฏ Unit Test Coverage Requirements

Clear Requirements:

  • โœ… Minimum 80% line coverage
  • โœ… Minimum 70% branch coverage
  • โœ… Tests run on every commit and PR
  • โœ… UnitTestPlan.md documented in repository
  • โœ… Public coverage reports via badges
  • โœ… Historical coverage tracking (no regression)
  • โœ… Coverage reports published to public URL

Reference Implementations:


๐ŸŒ End-to-End Testing Requirements

Clear Requirements:

  • โœ… All critical user journeys covered
  • โœ… E2ETestPlan.md documented in repository
  • โœ… Public Mochawesome/Cypress reports
  • โœ… Cross-browser testing (Chrome, Firefox, Safari)
  • โœ… Performance assertions within tests
  • โœ… Authentication/authorization flows tested
  • โœ… Error handling and edge cases covered

Reference Implementations:


๐Ÿ•ท๏ธ Threat Modeling Requirements

Clear Requirements per Threat Modeling Policy:

๐Ÿ“‹ Required Documentation

  • โœ… THREAT_MODEL.md in repository root
  • โœ… STRIDE framework application (all 6 categories)
  • โœ… MITRE ATT&CK technique mapping
  • โœ… Attack tree analysis with probability/impact
  • โœ… Threat agent classification (external/internal/supply chain)
  • โœ… Quantitative risk assessment with business impact
  • โœ… Security control mapping with effectiveness validation

๐Ÿ”„ Maintenance Requirements

  • โœ… Threat model created during design phase
  • โœ… Updated for all architectural changes
  • โœ… Annual comprehensive review
  • โœ… Quarterly update cycle
  • โœ… Incident-driven updates after security events

Reference Implementations:


๐ŸŽ–๏ธ Public Evidence Requirements

Clear Requirements per STYLE_GUIDE.md:

Required Badges in README.md

  • โœ… OpenSSF Scorecard (target: โ‰ฅ7.0)
  • โœ… CII Best Practices (minimum: Passing)
  • โœ… SLSA Level 3 attestation
  • โœ… SonarCloud Quality Gate (must be "Passed")
  • โœ… Code Coverage badge (โ‰ฅ80%)
  • โœ… License badge (OSI-approved)
  • โœ… Threat Model link badge

Example Badge Configuration:

[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ORG/REPO/badge)](https://scorecard.dev/viewer/?uri=github.com/ORG/REPO)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/ID/badge)](https://bestpractices.coreinfrastructure.org/projects/ID)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=ORG_REPO&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=ORG_REPO)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=ORG_REPO&metric=coverage)](https://sonarcloud.io/summary/new_code?id=ORG_REPO)
[![Threat Model](https://img.shields.io/badge/Threat_Model-Documentation-blue)](https://github.com/ORG/REPO/blob/main/THREAT_MODEL.md)

๐Ÿ“‹ Master Verification Checklist

Use this comprehensive checklist before ANY deployment:

Phase 1: Planning & Design โœ…

  • Project classification complete (CIA + RTO/RPO + Business Impact)
  • SECURITY_ARCHITECTURE.md created with C4 diagrams
  • FUTURE_SECURITY_ARCHITECTURE.md created with roadmap
  • THREAT_MODEL.md includes STRIDE + MITRE ATT&CK
  • Attack trees documented with probability/impact
  • Risk assessment registered
  • Cost-benefit analysis approved

Phase 2: Development โœ…

  • OWASP Top 10 mitigations implemented
  • Language-specific security standards followed
  • Code review completed with security focus
  • Asset classification applied
  • No hardcoded secrets (verified with secret scanning)
  • Input validation implemented
  • Output encoding implemented
  • Error handling doesn't leak sensitive info
  • Logging captures security events

Phase 3: Testing โœ…

  • SAST passed (SonarCloud quality gate green)
  • SCA clean (all vulnerabilities remediated per SLA)
  • DAST completed (OWASP ZAP scan clean)
  • Secret scanning clean
  • Test data properly anonymized
  • Unit test coverage โ‰ฅ80% lines, โ‰ฅ70% branches
  • E2E tests cover all critical paths
  • UnitTestPlan.md documented
  • E2ETestPlan.md documented

Phase 4: Deployment โœ…

  • CI/CD security gates passed
  • All GitHub Actions pinned to SHA
  • Harden-runner enabled
  • Least privilege permissions
  • Manual approval obtained for production
  • Deployment checklist complete
  • Security metrics configured
  • Rollback plan tested

Phase 5: Operations โœ…

  • Vulnerability management active
  • Security metrics monitored
  • Dependency updates automated
  • Incident response integrated
  • Annual review scheduled
  • Quarterly audits scheduled

AI Controls โœ…

  • Human review for all AI outputs
  • No autonomous deployments
  • PR documentation complete
  • Agent permissions least-privilege
  • MCP config under change control
  • Audit trail enabled

Documentation โœ…

  • SECURITY_ARCHITECTURE.md
  • FUTURE_SECURITY_ARCHITECTURE.md
  • THREAT_MODEL.md
  • SECURITY.md (vulnerability disclosure)
  • WORKFLOWS.md (CI/CD documentation)
  • UnitTestPlan.md
  • E2ETestPlan.md
  • CRA-ASSESSMENT.md (if applicable)
  • README includes classification section
  • All required badges displayed

Public Evidence โœ…

  • OpenSSF Scorecard โ‰ฅ7.0
  • CII Best Practices (Passing+)
  • SLSA Level 3 attestation
  • Quality Gate passed
  • Coverage โ‰ฅ80%
  • License compliance (FOSSA clean)

๐Ÿ“š Authoritative References


๐Ÿ’ก Key Takeaways

  • ๐Ÿ›ก๏ธ Security by Design: Build security in from the start, not bolt on later
  • ๐ŸŒŸ Transparency: Public evidence through badges and documentation
  • ๐Ÿท๏ธ Classification-Driven: All decisions aligned with project classification
  • ๐Ÿ”„ Continuous Improvement: Regular reviews, updates, and learning from incidents
  • ๐Ÿค– Human Accountability: AI assists, humans decide and approve
  • ๐Ÿ“Š Evidence-Based: Every security claim backed by public, verifiable proof
  • โœ… Comprehensive Coverage: ALL 5 SDLC phases with clear, actionable requirements
Weekly Installs
7
GitHub Stars
2
First Seen
10 days ago
Installed on
opencode7
claude-code7
github-copilot7
codex7
amp7
cline7