cyber-security-clone / security-code /security-code__real_secure_coding_expansion.jsonl
adityabhushannagar's picture
Mirror Vyber07/cyber-security@bc7a780 (batch 2, 245 files)
b6d6fe4 verified
Raw History Blame Contribute Delete
21.4 kB
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Use OWASP Top 10 guidance to explain secure design controls for broken access control risk.", "role": "user"}, {"content": "Broken access control should be addressed with server-side authorization checks on every sensitive action, deny-by-default policies, centralized authorization logic, object-level access checks, and tests for horizontal and vertical privilege boundaries. Developers should avoid trusting client-side role indicators, hidden fields, or predictable object identifiers as authorization controls. Security reviews should verify that APIs enforce ownership and role constraints consistently, and logging should capture authorization failures without exposing sensitive data.", "role": "assistant"}], "metadata": {"difficulty": "intermediate", "domain": "security-code", "provenance": "real_source_backed", "published_date": "2021-09-24", "safety_level": "defensive", "source_name": "OWASP Top 10 2021", "source_type": "OWASP", "source_url": "https://owasp.org/Top10/", "subdomain": "secure-coding", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Explain how SAST tools should be integrated into a secure development lifecycle.", "role": "user"}, {"content": "SAST tools analyze source code for security vulnerabilities without executing the application. Integration into the SDLC should include scanning on every pull request, blocking merges for high-severity findings, and running full scans on release branches. Developers should be trained to interpret and remediate findings, not just suppress them. SAST rules should be tuned to the project language and framework to reduce false positives. Findings should be tracked in the same ticketing system as other development work, with severity-based SLAs. SAST is most effective when combined with DAST and SCA for layered coverage.", "role": "assistant"}], "metadata": {"difficulty": "beginner", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Source Code Analysis Tools", "source_type": "OWASP", "source_url": "https://owasp.org/www-community/Source_Code_Analysis_Tools", "subdomain": "static-analysis", "task_type": "explanation"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe how to implement software composition analysis for dependency risk management.", "role": "user"}, {"content": "Software composition analysis identifies vulnerabilities in third-party libraries and dependencies. Implementation should include scanning all direct and transitive dependencies, blocking builds with known critical vulnerabilities, and generating a software bill of materials. Teams should define policies for acceptable vulnerability severity and remediation timelines. When a vulnerable dependency is found, teams should check if a patched version exists, evaluate whether the vulnerable code path is reachable, and apply patches or workarounds. Dependency scanning should run in CI/CD pipelines and be integrated into developer workflows for early detection.", "role": "assistant"}], "metadata": {"difficulty": "intermediate", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Software Component Verification Standard", "source_type": "OWASP", "source_url": "https://owasp.org/www-project-software-component-verification-standard/", "subdomain": "dependency-scanning", "task_type": "remediation"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Explain how to implement secret scanning in a development workflow.", "role": "user"}, {"content": "Secret scanning detects committed secrets such as API keys, passwords, and tokens in source code repositories. Implementation should include enabling pre-commit hooks to catch secrets before they are committed, enabling repository-level secret scanning, and integrating with secret management systems for remediation. When a secret is detected, teams should rotate the credential immediately, remove it from version control history, and investigate whether the secret was used by unauthorized parties. Secret scanning policies should define which patterns are monitored and the response process for each type of finding.", "role": "assistant"}], "metadata": {"difficulty": "beginner", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "GitHub Secret Scanning", "source_type": "GitHub", "source_url": "https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning", "subdomain": "secret-scanning", "task_type": "playbook"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe security-focused code review practices for development teams.", "role": "user"}, {"content": "Security-focused code reviews should check for input validation, authentication and authorization logic, error handling, cryptographic usage, dependency vulnerabilities, and sensitive data exposure. Reviewers should use a security checklist tailored to the application framework and threat model. Reviews should verify that security controls are implemented consistently, not just that the code compiles and passes tests. Security review findings should be tracked with severity and remediation requirements. Pair programming on security-sensitive features and dedicated security review sessions for high-risk changes complement the standard review process.", "role": "assistant"}], "metadata": {"difficulty": "beginner", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "Google Engineering Practices - Code Review", "source_type": "Google", "source_url": "https://google.github.io/eng-practices/review/", "subdomain": "code-review", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe security hardening for CI/CD pipelines.", "role": "user"}, {"content": "CI/CD pipeline hardening should include: use dedicated service accounts with minimal permissions, protect secrets with a secrets manager, enforce branch protection and signed commits, audit pipeline definitions for injection risks, use ephemeral build agents, restrict network access from build environments, and log all pipeline activity. Artifacts should be signed and verified before deployment. Pipeline changes should require review and approval. Regularly audit who has access to modify pipeline configurations and what permissions pipelines have in target environments.", "role": "assistant"}], "metadata": {"difficulty": "intermediate", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "CISA Secure Cloud Business Applications", "source_type": "CISA", "source_url": "https://www.cisa.gov/resources-tools/services/secure-cloud-business-applications", "subdomain": "ci-cd-security", "task_type": "hardening"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Explain defensive input validation principles for web application developers.", "role": "user"}, {"content": "Defensive input validation should use allowlists over blocklists, validate on the server side, and reject input that does not conform to expected format, length, and character set. Validation should be applied at the point of entry and before use in any security-sensitive operation such as database queries, file operations, or command execution. Parameterized queries should be used for database access rather than string concatenation. Output encoding should be applied at the point of output to prevent injection. Input validation is a defense-in-depth measure, not a substitute for proper output encoding and parameterized queries.", "role": "assistant"}], "metadata": {"difficulty": "beginner", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Input Validation Cheat Sheet", "source_type": "OWASP", "source_url": "https://cheatsheetseries.owasp.org/cheatsheets/Input_Validation_Cheat_Sheet.html", "subdomain": "input-validation", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe secure cryptographic storage practices for application developers.", "role": "user"}, {"content": "Cryptographic storage practices should include: use established libraries rather than custom crypto, encrypt sensitive data at rest with AES-256 or equivalent, use authenticated encryption modes such as AES-GCM, manage keys separately from encrypted data, rotate keys periodically, and use key derivation functions for password storage such as bcrypt or Argon2. Secrets should be stored in dedicated secret management systems. Encryption should be applied at the application or database level for sensitive fields. Key access should be audited and restricted to authorized services.", "role": "assistant"}], "metadata": {"difficulty": "intermediate", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Cryptographic Storage Cheat Sheet", "source_type": "OWASP", "source_url": "https://cheatsheetseries.owasp.org/cheatsheets/Cryptographic_Storage_Cheat_Sheet.html", "subdomain": "encryption-practices", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Explain secure error handling practices for web applications.", "role": "user"}, {"content": "Secure error handling should prevent information disclosure while maintaining usability. Error messages should not reveal internal details such as stack traces, database schemas, or server versions. Custom error pages should be configured for production environments. Errors should be logged server-side with full detail for debugging. User-facing messages should be generic and helpful without exposing security-sensitive information. Exception handling should be consistent across the application. Security-relevant errors such as authentication failures should be logged for monitoring and alerting.", "role": "assistant"}], "metadata": {"difficulty": "beginner", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Error Handling Cheat Sheet", "source_type": "OWASP", "source_url": "https://cheatsheetseries.owasp.org/cheatsheets/Error_Handling_Cheat_Sheet.html", "subdomain": "error-handling", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe secure session management practices for web applications.", "role": "user"}, {"content": "Secure session management should use cryptographically random session identifiers, set appropriate cookie attributes (Secure, HttpOnly, SameSite), implement session timeout and absolute expiration, regenerate session ID after authentication, and invalidate sessions on logout. Session storage should be server-side with only the session ID in the cookie. Concurrent session controls should be considered for sensitive applications. Session fixation attacks should be prevented by regenerating IDs. Session data should be protected from unauthorized access and tampering.", "role": "assistant"}], "metadata": {"difficulty": "intermediate", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Session Management Cheat Sheet", "source_type": "OWASP", "source_url": "https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html", "subdomain": "session-management", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe defensive controls for secure file upload functionality.", "role": "user"}, {"content": "Secure file upload controls should include: validate file type using content inspection not just extension, enforce file size limits, store uploads outside the webroot, rename files to prevent path traversal, scan uploaded files for malware, and serve files through a separate domain or CDN. Upload directories should not have execute permissions. File content should be validated before processing. Image uploads should be re-encoded to strip embedded code. Access to uploaded files should be controlled through application logic, not direct URL access.", "role": "assistant"}], "metadata": {"difficulty": "intermediate", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Unrestricted File Upload", "source_type": "OWASP", "source_url": "https://owasp.org/www-community/vulnerabilities/Unrestricted_File_Upload", "subdomain": "file-upload-security", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe prototype pollution vulnerabilities and defensive coding practices.", "role": "user"}, {"content": "Prototype pollution occurs when attacker-controlled input modifies JavaScript object prototypes, potentially affecting all objects in the application. Prevention should include: validate and sanitize input before object merging, use Object.create(null) for objects that should not inherit from prototype, freeze Object.prototype in security-sensitive contexts, and avoid using user input in property path resolution. Libraries such as lodash have had prototype pollution vulnerabilities that were patched. Security testing should include prototype pollution payloads in input validation testing.", "role": "assistant"}], "metadata": {"difficulty": "advanced", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Prototype Pollution", "source_type": "OWASP", "source_url": "https://owasp.org/www-community/vulnerabilities/Prototype_pollution", "subdomain": "prototype-pollution", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe insecure deserialization vulnerabilities and prevention.", "role": "user"}, {"content": "Insecure deserialization can lead to remote code execution when untrusted data is deserialized without validation. Prevention should include: avoid deserializing untrusted data, use safe serialization formats such as JSON instead of native serialization, implement integrity checks on serialized data, use allowlists for deserialized types, and isolate deserialization in restricted environments. Monitoring should detect deserialization exploitation indicators. Frameworks should be configured to restrict deserialization capabilities. Security testing should include known deserialization gadget chains for the technology stack.", "role": "assistant"}], "metadata": {"difficulty": "advanced", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Deserialization Cheat Sheet", "source_type": "OWASP", "source_url": "https://cheatsheetseries.owasp.org/cheatsheets/Deserialization_Cheat_Sheet.html", "subdomain": "deserialization", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe SSRF prevention from a developer perspective.", "role": "user"}, {"content": "SSRF prevention from a developer perspective should include: validate URLs against an allowlist of permitted destinations, resolve DNS once and validate the IP against allowed ranges, block requests to private IP ranges and metadata endpoints, use URL parsing libraries to prevent bypass through URL manipulation, and disable HTTP redirects to internal addresses. Network-level controls provide defense in depth. Libraries should be configured to restrict URL following. Input validation should reject URLs with encoded characters or unusual schemes.", "role": "assistant"}], "metadata": {"difficulty": "intermediate", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP SSRF Prevention Cheat Sheet", "source_type": "OWASP", "source_url": "https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html", "subdomain": "ssrf-prevention-code", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe server-side template injection prevention.", "role": "user"}, {"content": "Server-side template injection occurs when user input is embedded in templates before rendering. Prevention should include: never embed user input directly in templates, use template engine sandboxing where available, pass user data as parameters to templates rather than embedding in template code, validate and sanitize input before template rendering, and use auto-escaping template engines. Security testing should include template injection payloads for the specific template engine in use. Framework-specific security configurations should restrict template capabilities.", "role": "assistant"}], "metadata": {"difficulty": "advanced", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Server-Side Template Injection", "source_type": "OWASP", "source_url": "https://owasp.org/www-community/attacks/Server_Side_Template_Injection", "subdomain": "template-injection", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe race condition vulnerabilities in web applications and prevention.", "role": "user"}, {"content": "Race conditions occur when application behavior depends on the timing of concurrent operations, potentially allowing attackers to bypass security controls. Common examples include TOCTOU vulnerabilities in file operations and double-spending in financial transactions. Prevention should include: use atomic operations for critical state changes, implement proper locking mechanisms, use database transactions with appropriate isolation levels, and test for race conditions under concurrent load. Security testing should include concurrent request testing for sensitive operations such as payment processing and account transfers.", "role": "assistant"}], "metadata": {"difficulty": "advanced", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP Race Condition", "source_type": "OWASP", "source_url": "https://owasp.org/www-community/vulnerabilities/Race_condition", "subdomain": "race-conditions", "task_type": "secure_design"}}
{"messages": [{"content": "You are a cybersecurity assistant focused on defensive, source-backed analysis.", "role": "system"}, {"content": "Describe secure coding practices for GraphQL APIs.", "role": "user"}, {"content": "Secure GraphQL coding should include: implement field-level authorization, limit query depth and complexity, disable introspection in production, validate input types and enums, implement rate limiting based on query cost, and handle errors without exposing schema details. Pagination should be enforced to prevent excessive data retrieval. Batch queries should be limited. Custom scalar types should validate input format. Resolver functions should validate authorization for each field. Security testing should include query fuzzing and authorization testing across all types and fields.", "role": "assistant"}], "metadata": {"difficulty": "advanced", "domain": "security-code", "provenance": "real_source_backed", "published_date": "unknown", "safety_level": "defensive", "source_name": "OWASP GraphQL Cheat Sheet", "source_type": "OWASP", "source_url": "https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html", "subdomain": "graphql-security-code", "task_type": "secure_design"}}