From 22522509b1488a808b4fed656afcd6144b607852 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 9 Nov 2024 23:01:01 +0000 Subject: [PATCH] Deployed 6026495 with MkDocs version: 1.6.1 --- .nojekyll | 0 404.html | 555 ++ about/index.html | 975 +++ assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.83f73b43.min.js | 16 + assets/javascripts/bundle.83f73b43.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.6ce7567c.min.js | 42 + .../workers/search.6ce7567c.min.js.map | 7 + assets/stylesheets/main.0253249f.min.css | 1 + assets/stylesheets/main.0253249f.min.css.map | 1 + assets/stylesheets/palette.06af60db.min.css | 1 + .../stylesheets/palette.06af60db.min.css.map | 1 + contrib/index.html | 648 ++ install/index.html | 605 ++ parsers/index.html | 648 ++ quikstart/index.html | 595 ++ search/search_index.json | 1 + sitemap.xml | 3 + sitemap.xml.gz | Bin 0 -> 127 bytes 53 files changed, 11307 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 about/index.html create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.83f73b43.min.js create mode 100644 assets/javascripts/bundle.83f73b43.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.6ce7567c.min.js create mode 100644 assets/javascripts/workers/search.6ce7567c.min.js.map create mode 100644 assets/stylesheets/main.0253249f.min.css create mode 100644 assets/stylesheets/main.0253249f.min.css.map create mode 100644 assets/stylesheets/palette.06af60db.min.css create mode 100644 assets/stylesheets/palette.06af60db.min.css.map create mode 100644 contrib/index.html create mode 100644 install/index.html create mode 100644 parsers/index.html create mode 100644 quikstart/index.html create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..2716ec4 --- /dev/null +++ b/404.html @@ -0,0 +1,555 @@ + + + +
+ + + + + + + + + + + + + + +Appsec Discovery cli tool scan provided code projects and extract structured protobuf, graphql, swaggers, database schemas, python, go and java object DTOs, used api clients and methods, and other kinds of external contracts. It scores risk level for found object fields with provided in config static keywords ruleset and store results in own format json or sarif reports for fast integration with exist vuln management systems like Defectdojo.
+Cli tool can also use local LLM model Llama 3.2 3B from Huggingface and provided prompt to score objects without pre-existing knowledge about assets in code. Small open source models work fast on common hardware and are just enouth for such classification tasks.
+Appsec Discovery service continuosly fetch changes from local Gitlab via api, clone code for particular projects, scan for objects in code and score them with provided via UI rules, store result objects with projects, branches and MRs from Gitlab in local db and alert about critical changes via messenger or comments to MR in Gitlab.
+Under the hood tool powered by Semgrep OSS engine and specialy crafted discovery rules and parsers that extract particular objects from semgrep report meta variables.
+Install cli tool:
+pip install appsec-discovery
+
Provided rules in conf.yaml or leave it empty for default list:
+score_tags:
+ pii:
+ high:
+ - '(first_name|firstname)'
+ - 'last_name'
+ - 'phone'
+ - 'passport'
+ medium:
+ - 'address'
+ low:
+ - 'city'
+ finance:
+ high:
+ - 'pan'
+ - 'card_number'
+ medium:
+ - 'amount'
+ - 'balance'
+ auth:
+ high:
+ - 'password'
+ - 'pincode'
+ - 'codeword'
+ - 'token'
+ medium:
+ - 'login'
+
Run on yor folder with swaggers, protobuf and other structured contracts in code and get parsed objects and fields marked with severity and category tags:
+appsec-discovery --source tests/swagger_samples
+
+- hash: e491e2905199e066aa9fb37e05b82197
+ object_name: Swagger route /user (POST)
+ object_type: route
+ parser: swagger
+ severity: high
+ tags:
+ - pii
+ - auth
+ file: /swagger.yaml
+ line: 63
+ properties:
+ path:
+ prop_name: path
+ prop_value: /user
+ method:
+ prop_name: method
+ prop_value: post
+ fields:
+ ...
+ Output.User.id:
+ field_name: Output.User.id
+ field_type: integer
+ file: /swagger.yaml
+ line: 63
+ Output.User.lastName:
+ field_name: Output.User.lastName
+ field_type: string
+ file: /swagger.yaml
+ line: 63
+ severity: high
+ tags:
+ - pii
+ Output.User.password:
+ field_name: Output.User.password
+ field_type: string
+ file: /swagger.yaml
+ line: 63
+ severity: high
+ tags:
+ - auth
+ Output.User.phone:
+ field_name: Output.User.phone
+ field_type: string
+ file: /swagger.yaml
+ line: 63
+ severity: high
+ tags:
+ - pii
+ ...
+- hash: 2e20a348a612aa28d24c1bd0498eebf0
+ object_name: Swagger route /user/login (GET)
+ object_type: route
+ parser: swagger
+ severity: high
+ tags:
+ - auth
+ file: /swagger.yaml
+ line: 83
+ ...
+ fields:
+ Input.password:
+ field_name: Input.password
+ field_type: string
+ file: /swagger.yaml
+ line: 83
+ severity: high
+ tags:
+ - auth
+ ...
+
Replace or combine exist static keyword ruleset with LLM, fill conf.yaml with choosen LLM:
+ai_params:
+ model_id: "mradermacher/Llama-3.2-3B-Instruct-uncensored-GGUF"
+ gguf_file: "Llama-3.2-3B-Instruct-uncensored.Q8_0.gguf"
+ model_folder: "/app/tests/ai_samples/hf_home"
+ prompt: "You are security bot, for provided objects select only field names that contain personally identifiable information (pii), finance, authentication and other sensitive data. You return json list of selected critical field names like [\"field1\", \"field2\", ... ] or empty json list."
+
Run scan with new settings and get objects and fields severity from AI:
+appsec-discovery --source tests/swagger_samples --config tests/config_samples/ai_conf_llama.yaml
+
+- hash: 6ad58c7da41fc968c1de76f9233d645d
+ object_name: Swagger route /pet/{petId} (GET)
+ object_type: route
+ parser: swagger
+ file: /swagger.yaml
+ line: 41
+ properties:
+ path:
+ prop_name: path
+ prop_value: /pet/{petId}
+ method:
+ prop_name: method
+ prop_value: get
+ fields:
+ Input.petId:
+ field_name: Input.petId
+ field_type: integer
+ file: /swagger.yaml
+ line: 41
+ Output.Pet.id:
+ field_name: Output.Pet.id
+ field_type: integer
+ file: /swagger.yaml
+ line: 41
+ Output.Pet.name:
+ field_name: Output.Pet.name
+ field_type: string
+ file: /swagger.yaml
+ line: 41
+ ...
+- hash: 2e20a348a612aa28d24c1bd0498eebf0
+ object_name: Swagger route /user/login (GET)
+ object_type: route
+ parser: swagger
+ severity: medium
+ tags:
+ - llm
+ file: /swagger.yaml
+ line: 83
+ properties:
+ path:
+ prop_name: path
+ prop_value: /user/login
+ method:
+ prop_name: method
+ prop_value: get
+ fields:
+ ...
+ Input.password:
+ field_name: Input.password
+ field_type: string
+ file: /swagger.yaml
+ line: 83
+ severity: medium
+ tags:
+ - llm
+ ...
+
At first run tool with download provided model from Huggingface into local cache dir, for next offline scans use this dir with pre downloaded models.
+Play around with with various models from Huggingface and prompts for best results.
+Run scan with sarif output format:
+appsec-discovery --source tests/swagger_samples --config tests/config_samples/conf.yaml --output report.json --output-type sarif
+
Load result reports into vuln management system like Defectdojo:
+ + +Clone code to local folder:
+git clone https://github.com/dmarushkin/appsec-discovery
+cd appsec-discovery/appsec_discovery_service
+
Fillout .env file with your gitlab url and token, change passwords for local db and ui user, for alerts register new telegram bot or use exist one, or just leave TG args empty to only store objects:
+POSTGRES_HOST=discovery_postgres
+POSTGRES_DB=discovery_db
+POSTGRES_USER=discovery_user
+POSTGRES_PASSWORD=some_secret_str
+GITLAB_PRIVATE_TOKEN=some_secret_str
+GITLAB_URL=https://gitlab.examle.com
+GITLAB_PROJECTS_PREFIX=backend/,frontend/,test/
+UI_ADMIN_EMAIL=admin@example.com
+UI_ADMIN_PASSWORD=admin
+UI_JWT_KEY=some_secret_str
+MAX_WORKERS=5
+MR_ALERTS=1
+TG_ALERT_TOKEN=test
+TG_CHAT_ID=0000000000
+
Run service localy with docker compose:
+docker-compose up --build
+
Service will continuosly fetch new projects and MRs for provided prefixes from Gitlab api, clone code and scan it for objects, score found ones and save into local postgres db for any analysis.
+If sensitive fields in objects added on Merge requests service will alert via provided channel.
+To ajust default rule list authorize in Rules Management UI at http://127.0.0.1/ and make some new rules or make exclude rules for false positives:
+ +For now service does not provide any local UI for parsed and scored objects, so we recomend to use any kind of external analytic systems like Apache Superset, Grafana, Tableu etc.
+For prod environments bake Docker images in your k8s env, use external db.
+ +Appsec specialists can monitor codebase for critical changes and review them manualy, also sum scores for particular fields and get overall risk score for entire projects, and use it for prioritization of any kind of appsec rutines (triage vulns, plan security audits).
+Governance, Risk, and Compliance (GRC) specialists can use discovered data schemas for any kind of data governance (localize PII, payment and other critical data, dataflows), restricting access to and between critical services, focus on hardening environments that contain critical data.
+Monitoring or Incident Response specialists can focus attention on logs and anomalies in critical services or even particular routes in clients traffic.
+Infrastructure security specialists can use same approach to extract structured data about assets from IaC repositories like terraform or ansible (service now extracts VMs from terraform files).
+