cisco-ai-skill-scanner 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cisco_ai_skill_scanner-1.0.0/.cursor/rules/codeguard-0-additional-cryptography.mdc +58 -0
- cisco_ai_skill_scanner-1.0.0/.cursor/rules/codeguard-0-framework-and-languages.mdc +111 -0
- cisco_ai_skill_scanner-1.0.0/.cursor/rules/codeguard-0-iac-security.mdc +79 -0
- cisco_ai_skill_scanner-1.0.0/.cursor/rules/codeguard-0-mobile-apps.mdc +108 -0
- cisco_ai_skill_scanner-1.0.0/.cursor/rules/codeguard-0-supply-chain-security.mdc +47 -0
- cisco_ai_skill_scanner-1.0.0/.cursor/rules/codeguard-1-crypto-algorithms.mdc +136 -0
- cisco_ai_skill_scanner-1.0.0/.cursor/rules/codeguard-1-digital-certificates.mdc +123 -0
- cisco_ai_skill_scanner-1.0.0/.cursor/rules/codeguard-1-hardcoded-credentials.mdc +45 -0
- cisco_ai_skill_scanner-1.0.0/.env.example +40 -0
- cisco_ai_skill_scanner-1.0.0/.github/ISSUE_TEMPLATE/bug_report.md +55 -0
- cisco_ai_skill_scanner-1.0.0/.github/ISSUE_TEMPLATE/feature_request.md +56 -0
- cisco_ai_skill_scanner-1.0.0/.github/PULL_REQUEST_TEMPLATE.md +100 -0
- cisco_ai_skill_scanner-1.0.0/.github/workflows/integration-tests.yml +118 -0
- cisco_ai_skill_scanner-1.0.0/.github/workflows/python-tests.yml +112 -0
- cisco_ai_skill_scanner-1.0.0/.github/workflows/release.yml +42 -0
- cisco_ai_skill_scanner-1.0.0/.gitignore +83 -0
- cisco_ai_skill_scanner-1.0.0/.pre-commit-config.yaml +48 -0
- cisco_ai_skill_scanner-1.0.0/.windsurf/rules/codeguard-0-additional-cryptography.md +59 -0
- cisco_ai_skill_scanner-1.0.0/.windsurf/rules/codeguard-0-framework-and-languages.md +112 -0
- cisco_ai_skill_scanner-1.0.0/.windsurf/rules/codeguard-0-iac-security.md +80 -0
- cisco_ai_skill_scanner-1.0.0/.windsurf/rules/codeguard-0-mobile-apps.md +109 -0
- cisco_ai_skill_scanner-1.0.0/.windsurf/rules/codeguard-0-supply-chain-security.md +48 -0
- cisco_ai_skill_scanner-1.0.0/.windsurf/rules/codeguard-1-crypto-algorithms.md +135 -0
- cisco_ai_skill_scanner-1.0.0/.windsurf/rules/codeguard-1-digital-certificates.md +122 -0
- cisco_ai_skill_scanner-1.0.0/.windsurf/rules/codeguard-1-hardcoded-credentials.md +44 -0
- cisco_ai_skill_scanner-1.0.0/CODEOWNERS +3 -0
- cisco_ai_skill_scanner-1.0.0/CODE_OF_CONDUCT.md +132 -0
- cisco_ai_skill_scanner-1.0.0/CONTRIBUTING.md +73 -0
- cisco_ai_skill_scanner-1.0.0/LICENSE +17 -0
- cisco_ai_skill_scanner-1.0.0/PKG-INFO +253 -0
- cisco_ai_skill_scanner-1.0.0/README.md +195 -0
- cisco_ai_skill_scanner-1.0.0/SECURITY.md +109 -0
- cisco_ai_skill_scanner-1.0.0/TESTING.md +235 -0
- cisco_ai_skill_scanner-1.0.0/docs/aidefense-analyzer.md +235 -0
- cisco_ai_skill_scanner-1.0.0/docs/api-rationale.md +112 -0
- cisco_ai_skill_scanner-1.0.0/docs/api-server.md +629 -0
- cisco_ai_skill_scanner-1.0.0/docs/architecture.md +480 -0
- cisco_ai_skill_scanner-1.0.0/docs/behavioral-analyzer.md +310 -0
- cisco_ai_skill_scanner-1.0.0/docs/binary-handling.md +197 -0
- cisco_ai_skill_scanner-1.0.0/docs/developing.md +148 -0
- cisco_ai_skill_scanner-1.0.0/docs/llm-analyzer.md +379 -0
- cisco_ai_skill_scanner-1.0.0/docs/meta-analyzer.md +325 -0
- cisco_ai_skill_scanner-1.0.0/docs/quickstart.md +181 -0
- cisco_ai_skill_scanner-1.0.0/docs/remote-skills-analysis.md +139 -0
- cisco_ai_skill_scanner-1.0.0/docs/threat-taxonomy.md +220 -0
- cisco_ai_skill_scanner-1.0.0/evals/EVALUATION_GUIDE.md +260 -0
- cisco_ai_skill_scanner-1.0.0/evals/HOW_EVAL_WORKS.md +294 -0
- cisco_ai_skill_scanner-1.0.0/evals/README.md +197 -0
- cisco_ai_skill_scanner-1.0.0/evals/__init__.py +23 -0
- cisco_ai_skill_scanner-1.0.0/evals/benchmark_runner.py +342 -0
- cisco_ai_skill_scanner-1.0.0/evals/eval_runner.py +608 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/backdoor/magic-string-trigger/SKILL.md +14 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/backdoor/magic-string-trigger/_expected.json +58 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/backdoor/magic-string-trigger/process.py +65 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/behavioral-analysis/multi-file-exfiltration/SKILL.md +21 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/behavioral-analysis/multi-file-exfiltration/_expected.json +87 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/behavioral-analysis/multi-file-exfiltration/analyze.py +69 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/behavioral-analysis/multi-file-exfiltration/collector.py +67 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/behavioral-analysis/multi-file-exfiltration/encoder.py +50 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/behavioral-analysis/multi-file-exfiltration/reporter.py +57 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/command-injection/eval-execution/SKILL.md +14 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/command-injection/eval-execution/_expected.json +23 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/command-injection/eval-execution/calculate.py +38 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/data-exfiltration/environment-secrets/SKILL.md +14 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/data-exfiltration/environment-secrets/_expected.json +43 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/data-exfiltration/environment-secrets/get_info.py +73 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/obfuscation/base64-payload/SKILL.md +14 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/obfuscation/base64-payload/_expected.json +48 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/obfuscation/base64-payload/process.py +41 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/path-traversal/file-reader/SKILL.md +14 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/path-traversal/file-reader/_expected.json +23 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/path-traversal/file-reader/read.py +43 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/prompt-injection/jailbreak-override/SKILL.md +27 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/prompt-injection/jailbreak-override/_expected.json +48 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/resource-exhaustion/infinite-loop/SKILL.md +14 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/resource-exhaustion/infinite-loop/_expected.json +28 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/resource-exhaustion/infinite-loop/analyze.py +44 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/safe-skills/simple-math/SKILL.md +27 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/safe-skills/simple-math/_expected.json +7 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/safe-skills/simple-math/math_ops.py +52 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/safe-skills-2/file-validator/SKILL.md +20 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/safe-skills-2/file-validator/_expected.json +7 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/safe-skills-2/file-validator/validate.py +61 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/sql-injection/database-query/SKILL.md +14 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/sql-injection/database-query/_expected.json +23 -0
- cisco_ai_skill_scanner-1.0.0/evals/skills/sql-injection/database-query/query.py +46 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/malicious/eicar-test/SKILL.md +15 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/malicious/eicar-test/_expected.json +13 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/malicious/eicar-test/assets/test-binary.bin +0 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/malicious/exfiltrator/SKILL.md +16 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/malicious/exfiltrator/_expected.json +27 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/malicious/exfiltrator/analyze.py +40 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/malicious/prompt-injection/SKILL.md +17 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/safe/simple-formatter/SKILL.md +29 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/safe/simple-formatter/_expected.json +6 -0
- cisco_ai_skill_scanner-1.0.0/evals/test_skills/safe/simple-formatter/formatter.py +53 -0
- cisco_ai_skill_scanner-1.0.0/evals/update_expected_findings.py +216 -0
- cisco_ai_skill_scanner-1.0.0/examples/__init__.py +17 -0
- cisco_ai_skill_scanner-1.0.0/examples/advanced_scanning.py +172 -0
- cisco_ai_skill_scanner-1.0.0/examples/api_usage.py +195 -0
- cisco_ai_skill_scanner-1.0.0/examples/basic_scan.py +43 -0
- cisco_ai_skill_scanner-1.0.0/examples/batch_scanning.py +125 -0
- cisco_ai_skill_scanner-1.0.0/examples/behavioral_analyzer_example.py +116 -0
- cisco_ai_skill_scanner-1.0.0/examples/integration_example.py +132 -0
- cisco_ai_skill_scanner-1.0.0/examples/llm_analyzer_example.py +131 -0
- cisco_ai_skill_scanner-1.0.0/examples/programmatic_usage.py +130 -0
- cisco_ai_skill_scanner-1.0.0/pyproject.toml +214 -0
- cisco_ai_skill_scanner-1.0.0/scripts/pre-commit-hook.sh +128 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/__init__.py +45 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/_version.py +34 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/api/__init__.py +25 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/api/api.py +34 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/api/api_cli.py +78 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/api/api_server.py +634 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/api/router.py +527 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/cli/__init__.py +25 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/cli/cli.py +816 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/config/__init__.py +26 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/config/config.py +149 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/config/config_parser.py +122 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/config/constants.py +85 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/__init__.py +24 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/__init__.py +75 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/aidefense_analyzer.py +872 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/base.py +53 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/behavioral/__init__.py +30 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/behavioral/alignment/__init__.py +45 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/behavioral/alignment/alignment_llm_client.py +240 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/behavioral/alignment/alignment_orchestrator.py +216 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/behavioral/alignment/alignment_prompt_builder.py +422 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/behavioral/alignment/alignment_response_validator.py +136 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/behavioral/alignment/threat_vulnerability_classifier.py +198 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/behavioral_analyzer.py +453 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/cross_skill_analyzer.py +490 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/llm_analyzer.py +440 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/llm_prompt_builder.py +270 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/llm_provider_config.py +215 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/llm_request_handler.py +284 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/llm_response_parser.py +81 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/meta_analyzer.py +845 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/static.py +1105 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/trigger_analyzer.py +341 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/analyzers/virustotal_analyzer.py +463 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/exceptions.py +77 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/loader.py +377 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/models.py +300 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/reporters/__init__.py +26 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/reporters/json_reporter.py +65 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/reporters/markdown_reporter.py +209 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/reporters/sarif_reporter.py +246 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/reporters/table_reporter.py +195 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/rules/__init__.py +19 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/rules/patterns.py +165 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/rules/yara_scanner.py +157 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/scanner.py +437 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/__init__.py +27 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/cfg/__init__.py +21 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/cfg/builder.py +439 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/context_extractor.py +742 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/dataflow/__init__.py +25 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/dataflow/forward_analysis.py +715 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/interprocedural/__init__.py +21 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/interprocedural/call_graph_analyzer.py +406 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/interprocedural/cross_file_analyzer.py +190 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/parser/__init__.py +21 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/parser/python_parser.py +380 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/semantic/__init__.py +28 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/semantic/name_resolver.py +206 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/semantic/type_analyzer.py +200 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/taint/__init__.py +21 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/taint/tracker.py +252 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/core/static_analysis/types/__init__.py +36 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/__init__.py +30 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/prompts/boilerplate_protection_rule_prompt.md +26 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/prompts/code_alignment_threat_analysis_prompt.md +901 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/prompts/llm_response_schema.json +71 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/prompts/skill_meta_analysis_prompt.md +303 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/prompts/skill_threat_analysis_prompt.md +263 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/prompts/unified_response_schema.md +97 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/rules/signatures.yaml +440 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/autonomy_abuse.yara +66 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/code_execution.yara +61 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/coercive_injection.yara +115 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/command_injection.yara +54 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/credential_harvesting.yara +115 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/prompt_injection.yara +71 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/script_injection.yara +83 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/skill_discovery_abuse.yara +57 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/sql_injection.yara +73 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/system_manipulation.yara +65 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/tool_chaining_abuse.yara +60 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/transitive_trust_abuse.yara +73 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/data/yara_rules/unicode_steganography.yara +65 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/hooks/__init__.py +21 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/hooks/pre_commit.py +450 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/threats/__init__.py +25 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/threats/threats.py +480 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/utils/__init__.py +28 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/utils/command_utils.py +129 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/utils/di_container.py +154 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/utils/file_utils.py +86 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/utils/logging_config.py +96 -0
- cisco_ai_skill_scanner-1.0.0/skillanalyzer/utils/logging_utils.py +71 -0
- cisco_ai_skill_scanner-1.0.0/tests/__init__.py +19 -0
- cisco_ai_skill_scanner-1.0.0/tests/behavioral/README.md +31 -0
- cisco_ai_skill_scanner-1.0.0/tests/behavioral/__init__.py +17 -0
- cisco_ai_skill_scanner-1.0.0/tests/behavioral/test_behavioral_analyzer.py +458 -0
- cisco_ai_skill_scanner-1.0.0/tests/behavioral/test_enhanced_behavioral.py +242 -0
- cisco_ai_skill_scanner-1.0.0/tests/conftest.py +35 -0
- cisco_ai_skill_scanner-1.0.0/tests/static_analysis/README.md +30 -0
- cisco_ai_skill_scanner-1.0.0/tests/static_analysis/__init__.py +17 -0
- cisco_ai_skill_scanner-1.0.0/tests/static_analysis/test_static_analyzer.py +171 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_aidefense_analyzer.py +741 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_api_endpoints.py +559 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_cli_formats.py +420 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_config.py +224 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_integration.py +262 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_llm_analyzer.py +594 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_loader.py +239 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_meta_analyzer.py +445 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_models.py +177 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_reporters.py +111 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_scanner.py +186 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_threats.py +263 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_virustotal_analyzer.py +246 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_virustotal_benign.py +150 -0
- cisco_ai_skill_scanner-1.0.0/tests/test_virustotal_upload.py +154 -0
- cisco_ai_skill_scanner-1.0.0/uv.lock +3976 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Additional Cryptography guidance
|
|
3
|
+
globs: **/*.c,**/*.go,**/*.h,**/*.java,**/*.js,**/*.jsx,**/*.kt,**/*.kts,**/*.m,**/*.mjs,**/*.php,**/*.py,**/*.pyi,**/*.pyx,**/*.rb,**/*.swift,**/*.ts,**/*.tsx,**/*.wsdl,**/*.xml,**/*.xsd,**/*.xslt,**/*.yaml,**/*.yml
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
rule_id: codeguard-0-additional-cryptography
|
|
8
|
+
|
|
9
|
+
## Additional Cryptography & TLS
|
|
10
|
+
|
|
11
|
+
Apply modern, vetted cryptography for data at rest and in transit. Manage keys safely, configure TLS correctly, deploy HSTS, and consider pinning only when appropriate.
|
|
12
|
+
|
|
13
|
+
### Algorithms and Modes
|
|
14
|
+
- Symmetric: AES‑GCM or ChaCha20‑Poly1305 preferred. Avoid ECB. CBC/CTR only with encrypt‑then‑MAC.
|
|
15
|
+
- Asymmetric: RSA ≥2048 or modern ECC (Curve25519/Ed25519). Use OAEP for RSA encryption.
|
|
16
|
+
- Hashing: SHA‑256+ for integrity; avoid MD5/SHA‑1.
|
|
17
|
+
- RNG: Use CSPRNG appropriate to platform (e.g., SecureRandom, crypto.randomBytes, secrets module). Never use non‑crypto RNGs.
|
|
18
|
+
|
|
19
|
+
### Key Management
|
|
20
|
+
- Generate keys within validated modules (HSM/KMS) and never from passwords or predictable inputs.
|
|
21
|
+
- Separate keys by purpose (encryption, signing, wrapping). Rotate on compromise, cryptoperiod, or policy.
|
|
22
|
+
- Store keys in KMS/HSM or vault; never hardcode; avoid plain env vars. Use KEK to wrap DEKs; store separately.
|
|
23
|
+
- Control access to trust stores; validate updates; audit all key access and operations.
|
|
24
|
+
|
|
25
|
+
### Data at Rest
|
|
26
|
+
- Encrypt sensitive data; minimize stored secrets; tokenize where possible.
|
|
27
|
+
- Use authenticated encryption; manage nonces/IVs properly; keep salts unique per item.
|
|
28
|
+
- Protect backups: encrypt, restrict access, test restores, manage retention.
|
|
29
|
+
|
|
30
|
+
### TLS Configuration
|
|
31
|
+
- Protocols: TLS 1.3 preferred; allow TLS 1.2 only for legacy compatibility; disable TLS 1.0/1.1 and SSL. Enable TLS_FALLBACK_SCSV.
|
|
32
|
+
- Ciphers: prefer AEAD suites; disable NULL/EXPORT/anon. Keep libraries updated; disable compression.
|
|
33
|
+
- Key exchange groups: prefer x25519/secp256r1; configure secure FFDHE groups if needed.
|
|
34
|
+
- Certificates: 2048‑bit+ keys, SHA‑256, correct CN/SAN. Manage lifecycle and revocation (OCSP stapling).
|
|
35
|
+
- Application: HTTPS site‑wide; redirect HTTP→HTTPS; prevent mixed content; set cookies `Secure`.
|
|
36
|
+
|
|
37
|
+
### HSTS
|
|
38
|
+
- Send Strict‑Transport‑Security only over HTTPS. Phase rollout:
|
|
39
|
+
- Test: short max‑age (e.g., 86400) with includeSubDomains
|
|
40
|
+
- Prod: ≥1 year max‑age; includeSubDomains when safe
|
|
41
|
+
- Optional preload once mature; understand permanence and subdomain impact
|
|
42
|
+
|
|
43
|
+
### Pinning
|
|
44
|
+
- Avoid browser HPKP. Consider pinning only for controlled clients (e.g., mobile) and when you own both ends.
|
|
45
|
+
- Prefer SPKI pinning with backup pins; plan secure update channels; never allow user bypass.
|
|
46
|
+
- Thoroughly test rotation and failure handling; understand operational risk.
|
|
47
|
+
|
|
48
|
+
### Implementation Checklist
|
|
49
|
+
- AEAD everywhere; vetted libraries only; no custom crypto.
|
|
50
|
+
- Keys generated and stored in KMS/HSM; purpose‑scoped; rotation documented.
|
|
51
|
+
- TLS 1.3/1.2 with strong ciphers; compression off; OCSP stapling on.
|
|
52
|
+
- HSTS deployed per phased plan; mixed content eliminated.
|
|
53
|
+
- Pinning used only where justified, with backups and update path.
|
|
54
|
+
|
|
55
|
+
### Test Plan
|
|
56
|
+
- Automated config scans (e.g., SSL Labs, testssl.sh) for protocol/cipher/HSTS.
|
|
57
|
+
- Code review for crypto API misuse; tests for key rotation, backup/restore.
|
|
58
|
+
- Pinning simulations for rotation/failures if deployed.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Framework & language security guides (Django/DRF, Laravel/Symfony/Rails, .NET, Java/JAAS, Node.js, PHP config)
|
|
3
|
+
globs: **/*.c,**/*.h,**/*.java,**/*.js,**/*.jsx,**/*.kt,**/*.kts,**/*.mjs,**/*.php,**/*.py,**/*.pyi,**/*.pyx,**/*.rb,**/*.ts,**/*.tsx,**/*.wsdl,**/*.xml,**/*.xsd,**/*.xslt,**/*.yaml,**/*.yml
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
rule_id: codeguard-0-framework-and-languages
|
|
8
|
+
|
|
9
|
+
## Framework & Language Guides
|
|
10
|
+
|
|
11
|
+
Apply secure‑by‑default patterns per platform. Harden configurations, use built‑in protections, and avoid common pitfalls.
|
|
12
|
+
|
|
13
|
+
### Django
|
|
14
|
+
- Disable DEBUG in production; keep Django and deps updated.
|
|
15
|
+
- Enable `SecurityMiddleware`, clickjacking middleware, MIME sniffing protection.
|
|
16
|
+
- Force HTTPS (`SECURE_SSL_REDIRECT`); configure HSTS; set secure cookie flags (`SESSION_COOKIE_SECURE`, `CSRF_COOKIE_SECURE`).
|
|
17
|
+
- CSRF: ensure `CsrfViewMiddleware` and `{% csrf_token %}` in forms; proper AJAX token handling.
|
|
18
|
+
- XSS: rely on template auto‑escaping; avoid `mark_safe` unless trusted; use `json_script` for JS.
|
|
19
|
+
- Auth: use `django.contrib.auth`; validators in `AUTH_PASSWORD_VALIDATORS`.
|
|
20
|
+
- Secrets: generate via `get_random_secret_key`; store in env/secrets manager.
|
|
21
|
+
|
|
22
|
+
### Django REST Framework (DRF)
|
|
23
|
+
- Set `DEFAULT_AUTHENTICATION_CLASSES` and restrictive `DEFAULT_PERMISSION_CLASSES`; never leave `AllowAny` for protected endpoints.
|
|
24
|
+
- Always call `self.check_object_permissions(request, obj)` for object‑level authz.
|
|
25
|
+
- Serializers: explicit `fields=[...]`; avoid `exclude` and `"__all__"`.
|
|
26
|
+
- Throttling: enable rate limits (and/or at gateway/WAF).
|
|
27
|
+
- Disable unsafe HTTP methods where not needed. Avoid raw SQL; use ORM/parameters.
|
|
28
|
+
|
|
29
|
+
### Laravel
|
|
30
|
+
- Production: `APP_DEBUG=false`; generate app key; secure file perms.
|
|
31
|
+
- Cookies/sessions: enable encryption middleware; set `http_only`, `same_site`, `secure`, short lifetimes.
|
|
32
|
+
- Mass assignment: use `$request->only()` / `$request->validated()`; avoid `$request->all()`.
|
|
33
|
+
- SQLi: use Eloquent parameterization; validate dynamic identifiers.
|
|
34
|
+
- XSS: rely on Blade escaping; avoid `{!! ... !!}` for untrusted data.
|
|
35
|
+
- File uploads: validate `file`, size, and `mimes`; sanitize filenames with `basename`.
|
|
36
|
+
- CSRF: ensure middleware and form tokens enabled.
|
|
37
|
+
|
|
38
|
+
### Symfony
|
|
39
|
+
- XSS: Twig auto‑escaping; avoid `|raw` unless trusted.
|
|
40
|
+
- CSRF: use `csrf_token()` and `isCsrfTokenValid()` for manual flows; Forms include tokens by default.
|
|
41
|
+
- SQLi: Doctrine parameterized queries; never concatenate inputs.
|
|
42
|
+
- Command execution: avoid `exec/shell_exec`; use Filesystem component.
|
|
43
|
+
- Uploads: validate with `#[File(...)]`; store outside public; unique names.
|
|
44
|
+
- Directory traversal: validate `realpath`/`basename` and enforce allowed roots.
|
|
45
|
+
- Sessions/security: configure secure cookies and authentication providers/firewalls.
|
|
46
|
+
|
|
47
|
+
### Ruby on Rails
|
|
48
|
+
- Avoid dangerous functions:
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
eval("ruby code here")
|
|
52
|
+
system("os command here")
|
|
53
|
+
`ls -al /` # (backticks contain os command)
|
|
54
|
+
exec("os command here")
|
|
55
|
+
spawn("os command here")
|
|
56
|
+
open("| os command here")
|
|
57
|
+
Process.exec("os command here")
|
|
58
|
+
Process.spawn("os command here")
|
|
59
|
+
IO.binread("| os command here")
|
|
60
|
+
IO.binwrite("| os command here", "foo")
|
|
61
|
+
IO.foreach("| os command here") {}
|
|
62
|
+
IO.popen("os command here")
|
|
63
|
+
IO.read("| os command here")
|
|
64
|
+
IO.readlines("| os command here")
|
|
65
|
+
IO.write("| os command here", "foo")
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- SQLi: always parameterize; use `sanitize_sql_like` for LIKE patterns.
|
|
69
|
+
- XSS: default auto‑escape; avoid `raw`, `html_safe` on untrusted data; use `sanitize` allow‑lists.
|
|
70
|
+
- Sessions: database‑backed store for sensitive apps; force HTTPS (`config.force_ssl = true`).
|
|
71
|
+
- Auth: use Devise or proven libraries; configure routes and protected areas.
|
|
72
|
+
- CSRF: `protect_from_forgery` for state‑changing actions.
|
|
73
|
+
- Secure redirects: validate/allow‑list targets.
|
|
74
|
+
- Headers/CORS: set secure defaults; configure `rack-cors` carefully.
|
|
75
|
+
|
|
76
|
+
### .NET (ASP.NET Core)
|
|
77
|
+
- Keep runtime and NuGet packages updated; enable SCA in CI.
|
|
78
|
+
- Authz: use `[Authorize]` attributes; perform server‑side checks; prevent IDOR.
|
|
79
|
+
- Authn/sessions: ASP.NET Identity; lockouts; cookies `HttpOnly`/`Secure`; short timeouts.
|
|
80
|
+
- Crypto: use PBKDF2 for passwords, AES‑GCM for encryption; DPAPI for local secrets; TLS 1.2+.
|
|
81
|
+
- Injection: parameterize SQL/LDAP; validate with allow‑lists.
|
|
82
|
+
- Config: enforce HTTPS redirects; remove version headers; set CSP/HSTS/X‑Content‑Type‑Options.
|
|
83
|
+
- CSRF: anti‑forgery tokens on state‑changing actions; validate on server.
|
|
84
|
+
|
|
85
|
+
### Java and JAAS
|
|
86
|
+
- SQL/JPA: use `PreparedStatement`/named parameters; never concatenate input.
|
|
87
|
+
- XSS: allow‑list validation; sanitize output with reputable libs; encode for context.
|
|
88
|
+
- Logging: parameterized logging to prevent log injection.
|
|
89
|
+
- Crypto: AES‑GCM; secure random nonces; never hardcode keys; use KMS/HSM.
|
|
90
|
+
- JAAS: configure `LoginModule` stanzas; implement `initialize/login/commit/abort/logout`; avoid exposing credentials; segregate public/private credentials; manage subject principals properly.
|
|
91
|
+
|
|
92
|
+
### Node.js
|
|
93
|
+
- Limit request sizes; validate and sanitize input; escape output.
|
|
94
|
+
- Avoid `eval`, `child_process.exec` with user input; use `helmet` for headers; `hpp` for parameter pollution.
|
|
95
|
+
- Rate limit auth endpoints; monitor event loop health; handle uncaught exceptions cleanly.
|
|
96
|
+
- Cookies: set `secure`, `httpOnly`, `sameSite`; set `NODE_ENV=production`.
|
|
97
|
+
- Keep packages updated; run `npm audit`; use security linters and ReDoS testing.
|
|
98
|
+
|
|
99
|
+
### PHP Configuration
|
|
100
|
+
- Production php.ini: `expose_php=Off`, log errors not display; restrict `allow_url_fopen/include`; set `open_basedir`.
|
|
101
|
+
- Disable dangerous functions; set session cookie flags (`Secure`, `HttpOnly`, `SameSite=Strict`); enable strict session mode.
|
|
102
|
+
- Constrain upload size/number; set resource limits (memory, post size, execution time).
|
|
103
|
+
- Use Snuffleupagus or similar for additional hardening.
|
|
104
|
+
|
|
105
|
+
### Implementation Checklist
|
|
106
|
+
- Use each framework’s built‑in CSRF/XSS/session protections and secure cookie flags.
|
|
107
|
+
- Parameterize all data access; avoid dangerous OS/exec functions with untrusted input.
|
|
108
|
+
- Enforce HTTPS/HSTS; set secure headers.
|
|
109
|
+
- Centralize secret management; never hardcode secrets; lock down debug in production.
|
|
110
|
+
- Validate/allow‑list redirects and dynamic identifiers.
|
|
111
|
+
- Keep dependencies and frameworks updated; run SCA and static analysis regularly.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Infrastructure as Code Security
|
|
3
|
+
globs: **/*.bash,**/*.c,**/*.d,**/*.h,**/*.js,**/*.jsx,**/*.mjs,**/*.ps1,**/*.rb,**/*.sh,**/*.yaml,**/*.yml
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
rule_id: codeguard-0-iac-security
|
|
8
|
+
|
|
9
|
+
# Infrastructure as Code (IaC) Security
|
|
10
|
+
|
|
11
|
+
When designing cloud infrastructure and writing Infrastructure as Code (IaC) in languages like Terraform and CloudFormation, always use secure practices and defaults such as preventing public exposure and follow the principle of least privilege. Actively identify security misconfigurations and provide secure alternatives.
|
|
12
|
+
|
|
13
|
+
## Critical Security Patterns In Infrastructure as Code
|
|
14
|
+
|
|
15
|
+
### Network security
|
|
16
|
+
- **ALWAYS** restrict the access to remote administrative services, databases, LDAP, TACACS+, or other sensitive services. No service should be accessible from the entire Internet if it does not need to be. Instead, restrict access to a specific set of IP addresses or CIDR blocks which require access.
|
|
17
|
+
- Security Group and ACL inbound rules should **NEVER** allow `0.0.0.0/0` to remote administration ports (such as SSH 22, RDP 3389).
|
|
18
|
+
- Security Group and ACL inbound rules should **NEVER** allow `0.0.0.0/0` to database ports (such as 3306, 5432, 1433, 1521, 27017).
|
|
19
|
+
- Kubernetes API endpoints allow lists should **NEVER** allow `0.0.0.0/0`. EKS, AKS, GKE, and any other Kubernetes API endpoint should be restricted to an allowed list of CIDR addresses which require administrative access.
|
|
20
|
+
- **NEVER** expose cloud platform database services (RDS, Azure SQL, Cloud SQL) to all IP addresses `0.0.0.0/0`.
|
|
21
|
+
- Generally prefer private networking, such as internal VPC, VNET, VPN, or other internal transit unless public network access is required.
|
|
22
|
+
- **ALWAYS** enable VPC/VNET flow logs for network monitoring and security analysis.
|
|
23
|
+
- **ALWAYS** implement default deny rules and explicit allow rules for required traffic only.
|
|
24
|
+
- Generally prefer blocking egress traffic to the Internet by default. If egress is required appropriate traffic control solutions might include:
|
|
25
|
+
- Egress firewall or proxy with rules allowing access to specific required services.
|
|
26
|
+
- Egress security group (SG) or access control list (ACL) with rules allowing access to specific required IPs or CIDR blocks.
|
|
27
|
+
- DNS filtering to prevent access to malicious domains.
|
|
28
|
+
|
|
29
|
+
### Data protection
|
|
30
|
+
- **ALWAYS** configure data encryption at rest for all storage services including databases, file systems, object storage, and block storage.
|
|
31
|
+
- Enable encryption for cloud storage services (S3, Azure Blob, GCS buckets).
|
|
32
|
+
- Configure database encryption at rest for all database engines (RDS, Azure SQL, Cloud SQL, DocumentDB, etc.).
|
|
33
|
+
- Enable EBS/disk encryption for virtual machine storage volumes.
|
|
34
|
+
- **ALWAYS** configure encryption in transit for all data communications.
|
|
35
|
+
- Use TLS 1.2 or higher for all HTTPS/API communications.
|
|
36
|
+
- Configure SSL/TLS for database connections with certificate validation.
|
|
37
|
+
- Enable encryption for inter-service communication within VPCs/VNETs.
|
|
38
|
+
- Use encrypted protocols for remote access (SSH, HTTPS, secure RDP).
|
|
39
|
+
- **ALWAYS** implement data classification and protection controls based on sensitivity levels.
|
|
40
|
+
- Apply stricter encryption and access controls for PII, PHI, financial data, and intellectual property.
|
|
41
|
+
- Use separate encryption keys for different data classification levels.
|
|
42
|
+
- **ALWAYS** configure secure data retention and disposal policies.
|
|
43
|
+
- Define data retention periods based on regulatory and business requirements.
|
|
44
|
+
- Implement automated data lifecycle management with secure deletion.
|
|
45
|
+
- **ALWAYS** enable comprehensive data access monitoring and auditing.
|
|
46
|
+
- Log all data access, modification, and deletion operations.
|
|
47
|
+
- Monitor for unusual data access patterns and potential data exfiltration.
|
|
48
|
+
- Implement real-time alerting for sensitive data access violations.
|
|
49
|
+
- **ALWAYS** encrypt data backups.
|
|
50
|
+
- Encrypt all backup data using separate encryption keys from production data.
|
|
51
|
+
- Store backups in geographically distributed locations with appropriate access controls.
|
|
52
|
+
- Test backup restoration procedures regularly and verify backup integrity.
|
|
53
|
+
|
|
54
|
+
### Access control
|
|
55
|
+
- **NEVER** leave critical administration or data services with anonymous access (backups, storage, container registries, file shares) unless otherwise labeled as public classification or intended to be public.
|
|
56
|
+
- **NEVER** use wildcard permissions in IAM policies or cloud RBAC (`"Action": "*"`, `"Resource": "*"`)
|
|
57
|
+
- **NEVER** overprivilege service accounts with Owner/Admin roles when it is not necessary.
|
|
58
|
+
- **NEVER** use service API Keys and client secrets and instead use workload identity with role-based access control to eliminate the need for long-lived credentials.
|
|
59
|
+
- **NEVER** enable or use the legacy Instance Metadata Service version 1 (IMDSv1) in AWS.
|
|
60
|
+
- **NEVER** use legacy or outdated authentication methods (such as local users) when there is a more secure alternative such as OAuth.
|
|
61
|
+
|
|
62
|
+
### Container and VM images
|
|
63
|
+
- **NEVER** use non-hardened VM and container images.
|
|
64
|
+
- **ALWAYS** choose distroless or minimal container images.
|
|
65
|
+
- **RECOMMEND** using secure baseline virtual machine images from trusted sources.
|
|
66
|
+
- **RECOMMEND** using minimal distroless container images from trusted sources.
|
|
67
|
+
|
|
68
|
+
### Logging and administrative access
|
|
69
|
+
- **NEVER** disable administrative activity logging for sensitive services.
|
|
70
|
+
- **ALWAYS** enable audit logging for privileged operations.
|
|
71
|
+
|
|
72
|
+
### Secrets management
|
|
73
|
+
- **NEVER** hardcode secrets, passwords, API keys, or certificates directly in IaC source code.
|
|
74
|
+
- **ALWAYS** in Terraform mark secrets with "sensitive = true", in other IaC code use appropriate annotations or metadata to indicate sensitive values.
|
|
75
|
+
|
|
76
|
+
### Backup and data recovery
|
|
77
|
+
- **NEVER** create backups without encryption at rest and in transit.
|
|
78
|
+
- **ALWAYS** configure multi-region data storage for backups with cross-region replication.
|
|
79
|
+
- **NEVER** configure backups without retention policies and lifecycle management.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 'Mobile app security (iOS/Android): storage, transport, code integrity, biometrics, permissions'
|
|
3
|
+
globs: **/*.java,**/*.js,**/*.jsx,**/*.kt,**/*.kts,**/*.m,**/*.mjs,**/*.pl,**/*.pm,**/*.swift,**/*.wsdl,**/*.xml,**/*.xsd,**/*.xslt
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
rule_id: codeguard-0-mobile-apps
|
|
8
|
+
|
|
9
|
+
## Mobile Application Security Guidelines
|
|
10
|
+
|
|
11
|
+
Essential security practices for developing secure mobile applications across iOS and Android platforms.
|
|
12
|
+
|
|
13
|
+
### Architecture and Design
|
|
14
|
+
|
|
15
|
+
Implement secure design principles from the start:
|
|
16
|
+
- Follow least privilege and defense in depth principles
|
|
17
|
+
- Use standard secure authentication protocols (OAuth2, JWT)
|
|
18
|
+
- Perform all authentication and authorization checks server-side
|
|
19
|
+
- Request only necessary permissions for app and backend services
|
|
20
|
+
- Establish security controls for app updates, patches, and releases
|
|
21
|
+
- Use only trusted and validated third-party libraries and components
|
|
22
|
+
|
|
23
|
+
### Authentication and Authorization
|
|
24
|
+
|
|
25
|
+
Never trust the client for security decisions:
|
|
26
|
+
- Perform authentication/authorization server-side only
|
|
27
|
+
- Do not store user passwords on device; use revocable access tokens
|
|
28
|
+
- Avoid hardcoding credentials in the mobile app
|
|
29
|
+
- Encrypt credentials in transmission
|
|
30
|
+
- Use platform-specific secure storage (iOS Keychain, Android Keystore)
|
|
31
|
+
- Require password complexity and avoid short PINs (4 digits)
|
|
32
|
+
- Implement session timeouts and remote logout functionality
|
|
33
|
+
- Require re-authentication for sensitive operations
|
|
34
|
+
- Use platform-supported biometric authentication with secure fallbacks
|
|
35
|
+
|
|
36
|
+
### Data Storage and Privacy
|
|
37
|
+
|
|
38
|
+
Protect sensitive data at rest and in transit:
|
|
39
|
+
- Encrypt sensitive data using platform APIs; avoid custom encryption
|
|
40
|
+
- Leverage hardware-based security features (Secure Enclave, Strongbox)
|
|
41
|
+
- Store private data on device's internal storage only
|
|
42
|
+
- Minimize PII collection to necessity and implement automatic expiration
|
|
43
|
+
- Avoid caching, logging, or background snapshots of sensitive data
|
|
44
|
+
- Always use HTTPS for network communications
|
|
45
|
+
|
|
46
|
+
### Network Communication
|
|
47
|
+
|
|
48
|
+
Assume all network communication is insecure:
|
|
49
|
+
- Use HTTPS for all network communication
|
|
50
|
+
- Do not override SSL certificate validation for self-signed certificates
|
|
51
|
+
- Use strong, industry standard cipher suites with appropriate key lengths
|
|
52
|
+
- Use certificates signed by trusted CA providers
|
|
53
|
+
- Consider certificate pinning for additional security
|
|
54
|
+
- Encrypt data even if sent over SSL
|
|
55
|
+
- Avoid sending sensitive data via SMS
|
|
56
|
+
|
|
57
|
+
### Code Quality and Integrity
|
|
58
|
+
|
|
59
|
+
Maintain application security throughout development:
|
|
60
|
+
- Use static analysis tools to identify vulnerabilities
|
|
61
|
+
- Make security a focal point during code reviews
|
|
62
|
+
- Keep all libraries up to date to patch known vulnerabilities
|
|
63
|
+
- Disable debugging in production builds
|
|
64
|
+
- Include code to validate integrity of application code
|
|
65
|
+
- Obfuscate the app binary
|
|
66
|
+
- Implement runtime anti-tampering controls:
|
|
67
|
+
- Check for debugging, hooking, or code injection
|
|
68
|
+
- Detect emulator or rooted/jailbroken devices
|
|
69
|
+
- Verify app signatures at runtime
|
|
70
|
+
|
|
71
|
+
### Platform-Specific Security
|
|
72
|
+
|
|
73
|
+
#### Android Security
|
|
74
|
+
- Use Android's ProGuard for code obfuscation
|
|
75
|
+
- Avoid storing sensitive data in SharedPreferences
|
|
76
|
+
- Disable backup mode to prevent sensitive data in backups
|
|
77
|
+
- Use Android Keystore with hardware backing (TEE or StrongBox)
|
|
78
|
+
- Implement Google's Play Integrity API for device and app integrity checks
|
|
79
|
+
|
|
80
|
+
#### iOS Security
|
|
81
|
+
- Configure Shortcuts permissions to require device unlock for sensitive actions
|
|
82
|
+
- Set Siri intent `requiresUserAuthentication` to true for sensitive functionality
|
|
83
|
+
- Implement authentication checks on deep link endpoints
|
|
84
|
+
- Use conditional logic to mask sensitive widget content on lock screen
|
|
85
|
+
- Store sensitive data in iOS Keychain, not plist files
|
|
86
|
+
- Use Secure Enclave for cryptographic key storage
|
|
87
|
+
- Implement App Attest API for app integrity validation
|
|
88
|
+
- Use DeviceCheck API for persistent device state tracking
|
|
89
|
+
|
|
90
|
+
### Testing and Monitoring
|
|
91
|
+
|
|
92
|
+
Validate security controls through comprehensive testing:
|
|
93
|
+
- Perform penetration testing including cryptographic vulnerability assessment
|
|
94
|
+
- Leverage automated tests to ensure security features work as expected
|
|
95
|
+
- Ensure security features do not harm usability
|
|
96
|
+
- Use real-time monitoring to detect and respond to threats
|
|
97
|
+
- Have a clear incident response plan in place
|
|
98
|
+
- Plan for regular updates and implement forced update mechanisms when necessary
|
|
99
|
+
|
|
100
|
+
### Input and Output Validation
|
|
101
|
+
|
|
102
|
+
Prevent injection and execution attacks:
|
|
103
|
+
- Validate and sanitize all user input
|
|
104
|
+
- Validate and sanitize output to prevent injection attacks
|
|
105
|
+
- Mask sensitive information on UI fields to prevent shoulder surfing
|
|
106
|
+
- Inform users about security-related activities (logins from new devices)
|
|
107
|
+
|
|
108
|
+
By following these practices derived from the OWASP Mobile Application Security framework, you can significantly improve the security posture of your mobile applications across both development and operational phases.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Dependency & supply chain security (pinning, SBOM, provenance, integrity, private registries)
|
|
3
|
+
globs: **/*.dockerfile,**/*.js,**/*.jsx,**/*.mjs,**/*.yaml,**/*.yml,Dockerfile*,docker-compose*
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
rule_id: codeguard-0-supply-chain-security
|
|
8
|
+
|
|
9
|
+
## Dependency & Supply Chain Security
|
|
10
|
+
|
|
11
|
+
Control third‑party risk across ecosystems, from selection and pinning to provenance, scanning, and rapid response.
|
|
12
|
+
|
|
13
|
+
### Policy and Governance
|
|
14
|
+
- Maintain allow‑listed registries and scopes; disallow direct installs from untrusted sources.
|
|
15
|
+
- Require lockfiles and version pinning; prefer digest pinning for images and vendored assets.
|
|
16
|
+
- Generate SBOMs for apps/images; store with artifacts; attest provenance (SLSA, Sigstore).
|
|
17
|
+
|
|
18
|
+
### Package Hygiene (npm focus applicable to others)
|
|
19
|
+
- Regularly audit (`npm audit`, ecosystem SCA) and patch; enforce SLAs by severity.
|
|
20
|
+
- Use deterministic builds: `npm ci` (not `npm install`) in CI/CD; maintain lockfile consistency.
|
|
21
|
+
- Avoid install scripts that execute on install when possible; review for risk.
|
|
22
|
+
- Use `.npmrc` to scope private registries; avoid wildcard registries; enable integrity verification.
|
|
23
|
+
- Enable account 2FA for publishing
|
|
24
|
+
|
|
25
|
+
### Development Practices
|
|
26
|
+
- Minimize dependency footprint; remove unused packages; prefer stdlib/first‑party for trivial tasks.
|
|
27
|
+
- Protect against typosquatting and protestware: pin maintainers, monitor releases, and use provenance checks.
|
|
28
|
+
- Hermetic builds: no network in compile/packaging stages unless required; cache with authenticity checks.
|
|
29
|
+
|
|
30
|
+
### CI/CD Integration
|
|
31
|
+
- SCA, SAST, IaC scans in gates; fail on criticals; require approvals for overrides with compensating controls.
|
|
32
|
+
- Sign artifacts; verify signatures at deploy; enforce policy in admission.
|
|
33
|
+
|
|
34
|
+
### Vulnerability Management
|
|
35
|
+
- For patched vulnerabilities: test and deploy updates; document any API breaking changes.
|
|
36
|
+
- For unpatched vulnerabilities: implement compensating controls (input validation, wrappers) based on CVE type; prefer direct dependency fixes over transitive workarounds.
|
|
37
|
+
- Document risk decisions; escalate acceptance to appropriate authority with business justification.
|
|
38
|
+
|
|
39
|
+
### Incident Response
|
|
40
|
+
- Maintain rapid rollback; isolate compromised packages; throttle rollouts; notify stakeholders.
|
|
41
|
+
- Monitor threat intel feeds (e.g., npm advisories); auto‑open tickets for critical CVEs.
|
|
42
|
+
|
|
43
|
+
### Implementation Checklist
|
|
44
|
+
- Lockfiles present; integrity checks on; private registries configured.
|
|
45
|
+
- SBOM + provenance stored; signatures verified pre‑deploy.
|
|
46
|
+
- Automated dependency updates with tests and review gates.
|
|
47
|
+
- High‑sev vulns remediated within SLA or mitigated and documented.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Cryptographic Security Guidelines
|
|
3
|
+
globs: **/*
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
rule_id: codeguard-1-crypto-algorithms
|
|
9
|
+
|
|
10
|
+
# Cryptographic Security Guidelines
|
|
11
|
+
|
|
12
|
+
## Banned (Insecure) Algorithms
|
|
13
|
+
|
|
14
|
+
The following algorithms are known to be broken or fundamentally insecure. **NEVER** generate or use code with these algorithms.
|
|
15
|
+
Examples:
|
|
16
|
+
|
|
17
|
+
* Hash: `MD2`, `MD4`, `MD5`, `SHA-0`
|
|
18
|
+
* Symmetric: `RC2`, `RC4`, `Blowfish`, `DES`, `3DES`
|
|
19
|
+
* Key Exchange: Static RSA, Anonymous Diffie-Hellman
|
|
20
|
+
* Classical: `Vigenère`
|
|
21
|
+
|
|
22
|
+
## Deprecated (Legacy/Weak) Algorithms
|
|
23
|
+
|
|
24
|
+
The following algorithms are not outright broken, but have known weaknesses, or are considered obsolete. **NEVER** generate or use code with these algorithms.
|
|
25
|
+
Examples:
|
|
26
|
+
|
|
27
|
+
* Hash: `SHA-1`
|
|
28
|
+
* Symmetric: `AES-CBC`, `AES-ECB`
|
|
29
|
+
* Signature: RSA with `PKCS#1 v1.5` padding
|
|
30
|
+
* Key Exchange: DHE with weak/common primes
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Deprecated SSL/Crypto APIs - FORBIDDEN
|
|
34
|
+
NEVER use these deprecated functions. Use the replacement APIs listed below:
|
|
35
|
+
|
|
36
|
+
### Symmetric Encryption (AES)
|
|
37
|
+
- Deprecated: `AES_encrypt()`, `AES_decrypt()`
|
|
38
|
+
- Replacement: Use EVP high-level APIs:
|
|
39
|
+
```c
|
|
40
|
+
EVP_EncryptInit_ex()
|
|
41
|
+
EVP_EncryptUpdate()
|
|
42
|
+
EVP_EncryptFinal_ex()
|
|
43
|
+
EVP_DecryptInit_ex()
|
|
44
|
+
EVP_DecryptUpdate()
|
|
45
|
+
EVP_DecryptFinal_ex()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### RSA Operations
|
|
49
|
+
- Deprecated: `RSA_new()`, `RSA_up_ref()`, `RSA_free()`, `RSA_set0_crt_params()`, `RSA_get0_n()`
|
|
50
|
+
- Replacement: Use EVP key management APIs:
|
|
51
|
+
```c
|
|
52
|
+
EVP_PKEY_new()
|
|
53
|
+
EVP_PKEY_up_ref()
|
|
54
|
+
EVP_PKEY_free()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Hash Functions
|
|
58
|
+
- Deprecated: `SHA1_Init()`, `SHA1_Update()`, `SHA1_Final()`
|
|
59
|
+
- Replacement: Use EVP digest APIs:
|
|
60
|
+
```c
|
|
61
|
+
EVP_DigestInit_ex()
|
|
62
|
+
EVP_DigestUpdate()
|
|
63
|
+
EVP_DigestFinal_ex()
|
|
64
|
+
EVP_Q_digest() // For simple one-shot hashing
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### MAC Operations
|
|
68
|
+
- Deprecated: `CMAC_Init()`, `HMAC()` (especially with SHA1)
|
|
69
|
+
- Replacement: Use EVP MAC APIs:
|
|
70
|
+
```c
|
|
71
|
+
EVP_Q_MAC() // For simple MAC operations
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Key Wrapping
|
|
75
|
+
- Deprecated: `AES_wrap_key()`, `AES_unwrap_key()`
|
|
76
|
+
- Replacement: Use EVP key wrapping APIs or implement using EVP encryption
|
|
77
|
+
|
|
78
|
+
### Other Deprecated Functions
|
|
79
|
+
- Deprecated: `DSA_sign()`, `DH_check()`
|
|
80
|
+
- Replacement: Use corresponding EVP APIs for DSA and DH operations
|
|
81
|
+
|
|
82
|
+
## Banned Insecure Algorithms - STRICTLY FORBIDDEN
|
|
83
|
+
These algorithms MUST NOT be used in any form:
|
|
84
|
+
|
|
85
|
+
### Hash Algorithms (Banned)
|
|
86
|
+
- MD2, MD4, MD5, SHA-0
|
|
87
|
+
- Reason: Cryptographically broken, vulnerable to collision attacks
|
|
88
|
+
- Use Instead: SHA-256, SHA-384, SHA-512
|
|
89
|
+
|
|
90
|
+
### Symmetric Ciphers (Banned)
|
|
91
|
+
- RC2, RC4, Blowfish, DES, 3DES
|
|
92
|
+
- Reason: Weak key sizes, known vulnerabilities
|
|
93
|
+
- Use Instead: AES-128, AES-256, ChaCha20
|
|
94
|
+
|
|
95
|
+
### Key Exchange (Banned)
|
|
96
|
+
- Static RSA key exchange
|
|
97
|
+
- Anonymous Diffie-Hellman
|
|
98
|
+
- Reason: No forward secrecy, vulnerable to man-in-the-middle attacks
|
|
99
|
+
- Use Instead: ECDHE, DHE with proper validation
|
|
100
|
+
|
|
101
|
+
## Broccoli Project Specific Requirements
|
|
102
|
+
- HMAC() with SHA1: Deprecated per Broccoli project requirements
|
|
103
|
+
- Replacement: Use HMAC with SHA-256 or stronger:
|
|
104
|
+
```c
|
|
105
|
+
// Instead of HMAC() with SHA1
|
|
106
|
+
EVP_Q_MAC(NULL, "HMAC", NULL, "SHA256", NULL, key, key_len, data, data_len, out, out_size, &out_len);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Secure Crypto Implementation Pattern
|
|
110
|
+
```c
|
|
111
|
+
// Example: Secure AES encryption
|
|
112
|
+
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
|
113
|
+
if (!ctx) handle_error();
|
|
114
|
+
|
|
115
|
+
if (EVP_EncryptInit_ex(ctx, EVP_aes_256_gcm(), NULL, key, iv) != 1)
|
|
116
|
+
handle_error();
|
|
117
|
+
|
|
118
|
+
int len, ciphertext_len;
|
|
119
|
+
if (EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len) != 1)
|
|
120
|
+
handle_error();
|
|
121
|
+
ciphertext_len = len;
|
|
122
|
+
|
|
123
|
+
if (EVP_EncryptFinal_ex(ctx, ciphertext + len, &len) != 1)
|
|
124
|
+
handle_error();
|
|
125
|
+
ciphertext_len += len;
|
|
126
|
+
|
|
127
|
+
EVP_CIPHER_CTX_free(ctx);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Code Review Checklist
|
|
131
|
+
- [ ] No deprecated SSL/crypto APIs used
|
|
132
|
+
- [ ] No banned algorithms (MD5, DES, RC4, etc.)
|
|
133
|
+
- [ ] HMAC uses SHA-256 or stronger (not SHA1)
|
|
134
|
+
- [ ] All crypto operations use EVP high-level APIs
|
|
135
|
+
- [ ] Proper error handling for all crypto operations
|
|
136
|
+
- [ ] Key material properly zeroed after use
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Certificate Best Practices
|
|
3
|
+
globs: **/*
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
rule_id: codeguard-1-digital-certificates
|
|
9
|
+
|
|
10
|
+
When you encounter data that appears to be an X.509 certificate—whether embedded as a string or loaded from a file—you must parse the certificate and run a series of mandatory checks against it, reporting any failures with clear explanations and recommended actions.
|
|
11
|
+
|
|
12
|
+
### 1. How to Identify Certificate Data
|
|
13
|
+
|
|
14
|
+
Actively scan for certificate data using the following heuristics:
|
|
15
|
+
|
|
16
|
+
- PEM-Encoded Strings: Identify multi-line string literals or constants that begin with `-----BEGIN CERTIFICATE-----` and end with `-----END CERTIFICATE-----`.
|
|
17
|
+
|
|
18
|
+
- File Operations: Pay close attention to file read operations on files with common certificate extensions, such as `.pem`, `.crt`, `.cer`, and `.der`.
|
|
19
|
+
|
|
20
|
+
- Library Function Calls: Recognize the usage of functions from cryptographic libraries used to load or parse certificates (e.g., OpenSSL's `PEM_read_X509`, Python's `cryptography.x509.load_pem_x509_certificate`, Java's `CertificateFactory`).
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### 2. Mandatory Sanity Checks
|
|
24
|
+
|
|
25
|
+
Once certificate data is identified, you must perform the following validation steps and report the results.
|
|
26
|
+
|
|
27
|
+
#### Check 1: Expiration Status
|
|
28
|
+
|
|
29
|
+
- Condition: The certificate's `notAfter` (expiration) date is before June 23, 2025.
|
|
30
|
+
|
|
31
|
+
- Severity: CRITICAL VULNERABILITY
|
|
32
|
+
|
|
33
|
+
- Report Message: `This certificate expired on [YYYY-MM-DD]. It is no longer valid and will be rejected by clients, causing connection failures. It must be renewed and replaced immediately.`
|
|
34
|
+
|
|
35
|
+
- Condition: The certificate's `notBefore` (validity start) date is after June 23, 2025.
|
|
36
|
+
|
|
37
|
+
- Severity: Warning
|
|
38
|
+
|
|
39
|
+
- Report Message: `This certificate is not yet valid. Its validity period begins on [YYYY-MM-DD].`
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
#### Check 2: Public Key Strength
|
|
43
|
+
|
|
44
|
+
- Condition: The public key algorithm or size is weak.
|
|
45
|
+
|
|
46
|
+
- Weak Keys: RSA keys with a modulus smaller than 2048 bits. Elliptic Curve (EC) keys using curves with less than a 256-bit prime modulus (e.g., `secp192r1`, `P-192`, `P-224`).
|
|
47
|
+
|
|
48
|
+
- Severity: High-Priority Warning
|
|
49
|
+
|
|
50
|
+
- Report Message: `The certificate's public key is cryptographically weak ([Algorithm], [Key Size]). Keys of this strength are vulnerable to factorization or discrete logarithm attacks. The certificate should be re-issued using at least an RSA 2048-bit key or an ECDSA key on a P-256 (or higher) curve.`
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
#### Check 3: Signature Algorithm
|
|
54
|
+
|
|
55
|
+
- Condition: The algorithm used to sign the certificate is insecure.
|
|
56
|
+
|
|
57
|
+
- Insecure Algorithms: Any signature algorithm using MD5 or SHA-1 (e.g., `md5WithRSAEncryption`, `sha1WithRSAEncryption`).
|
|
58
|
+
|
|
59
|
+
- Severity: High-Priority Warning
|
|
60
|
+
|
|
61
|
+
- Report Message: `The certificate is signed with the insecure algorithm '[Algorithm]'. This makes it vulnerable to collision attacks, potentially allowing for certificate forgery. It must be re-issued using a signature based on the SHA-2 family (e.g., sha256WithRSAEncryption).`
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
#### Check 4: Issuer Type (Self-Signed Check)
|
|
65
|
+
|
|
66
|
+
- Condition: The certificate's `Issuer` and `Subject` fields are identical.
|
|
67
|
+
|
|
68
|
+
- Severity: Informational
|
|
69
|
+
|
|
70
|
+
- Report Message: `This is a self-signed certificate. Ensure this is intentional and only used for development, testing, or internal services where trust is explicitly configured. Self-signed certificates should never be used for public-facing production systems as they will not be trusted by browsers or standard clients.`
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### 3. Actionable Examples
|
|
74
|
+
|
|
75
|
+
Your feedback should be direct and easy to understand.
|
|
76
|
+
|
|
77
|
+
Example 1: Flagging an Expired, In-line Certificate
|
|
78
|
+
|
|
79
|
+
- Code Snippet:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
# Certificate for connecting to legacy_service
|
|
83
|
+
LEGACY_CERT = """
|
|
84
|
+
-----BEGIN CERTIFICATE-----
|
|
85
|
+
MIIC... (data for a certificate that expired on 2024-12-01) ...
|
|
86
|
+
-----END CERTIFICATE-----
|
|
87
|
+
"""
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- Your Analysis and Report:
|
|
91
|
+
|
|
92
|
+
> CRITICAL VULNERABILITY: The certificate stored in the `LEGACY_CERT` variable is invalid.
|
|
93
|
+
>
|
|
94
|
+
> - Reason: It expired on 2024-12-01.
|
|
95
|
+
>
|
|
96
|
+
> - Impact: Any TLS connection attempting to use this certificate will fail.
|
|
97
|
+
>
|
|
98
|
+
> - Action: This certificate must be renewed and the variable updated with the new PEM data immediately.
|
|
99
|
+
>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
Example 2: Flagging a Weak Key in a Loaded Certificate
|
|
103
|
+
|
|
104
|
+
- Code Snippet:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
// Load the server certificate from disk
|
|
108
|
+
cert, err := tls.LoadX509KeyPair("server.crt", "server.key")
|
|
109
|
+
// Assume server.crt contains a 1024-bit RSA key.
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- Your Analysis and Report:
|
|
113
|
+
|
|
114
|
+
> High-Priority Warning: The certificate being loaded from `server.crt` is using a weak public key.
|
|
115
|
+
>
|
|
116
|
+
> - Reason: It uses an RSA key with a 1024-bit modulus.
|
|
117
|
+
>
|
|
118
|
+
> - Impact: This key strength is insufficient and vulnerable to modern cryptanalytic attacks.
|
|
119
|
+
>
|
|
120
|
+
> - Action: A new certificate and key must be generated with at least a 2048-bit RSA key or a modern elliptic curve.
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
You must always explain how this rule was applied and why it was applied.
|