Giter Club home page Giter Club logo

yuanzhongqiao / semgrep-cn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from semgrep/semgrep

0.0 0.0 0.0 58.59 MB

适用于多种语言的轻量级静态分析。查找具有类似于源代码的模式的错误变体。

Home Page: https://semgrep.dev

License: GNU Lesser General Public License v2.1

Shell 0.34% JavaScript 2.83% Ruby 0.32% C++ 0.28% Python 11.06% C 3.21% PHP 0.04% Java 4.28% OCaml 73.43% Scala 0.08% Go 0.46% C# 0.01% Rust 0.01% Standard ML 1.29% Max 0.01% TypeScript 0.08% Makefile 0.32% HTML 0.05% Liquid 0.01% Yacc 1.90%

semgrep-cn's Introduction


森格瑞普标志

代码扫描速度惊人。

自制 皮伊 文档 加入 Semgrep 社区 Slack 欢迎提出问题! GitHub 上的 Star Semgrep Docker 拉取 在 Twitter 上关注 @semgrep


Semgrep 通过以无与伦比的效率快速扫描代码和包依赖项以查找已知问题、软件漏洞和检测到的秘密,加速您的安全之旅。Semgrep 提供:

  • 使用自定义或预构建规则查找错误和漏洞的代码
  • 供应链查找具有已知漏洞的依赖项
  • 查找不应签入源代码的硬编码凭据的秘密

Semgrep 在您的计算机或构建环境中本地分析代码:默认情况下,代码永远不会上传开始吧→。

Semgrep CLI 映像

语言支持

Semgrep 代码支持 30 多种语言。

类别 语言
遗传算法 C# · Go · Java · JavaScript · JSX · JSON · PHP · Python · Ruby · Scala · Terraform · TypeScript · TSX
贝塔 科特林 · Rust
实验性的 Bash·C·C++·Clojure·Dart·Dockerfile·Elixir·HTML·Julia·Jsonnet·Lisp·Lua·OCaml·R·Scheme·Solidity·Swift·YAML·XML·通用(ERB、Jinja等)

Semgrep Supply Chain 支持 15 个包管理器中的 8 种语言。

类别 语言
遗传算法 Go(Go 模块、go mod)·Javascript/Typescript(npm、Yarn、Yarn 2、Yarn 3、pnpm)·Python(pip、pip-tool、Pipenv、Poetry)·Ruby (RubyGems)·Java(Gradle、Maven)
贝塔 C#(NuGet)
仅锁定文件 Rust(货物)·PHP(作曲家)

欲了解更多信息,请访问我们支持的语言页面。

开始使用🚀

  1. 来自 Semgrep 云平台
  2. 从 CLI

对于新用户,我们建议从Semgrep 云平台开始,因为它提供了可视化界面、演示项目、结果分类和探索工作流程,并且可以快速进行 CI/CD 中的设置。扫描仍然是本地的,代码不会上传。或者,您也可以从 CLI 开始并导航终端输出以运行一次性搜索。

选项 1:从 Semgrep 云平台开始(推荐)

Semgrep 平台镜像

  1. 在semgrep.dev上注册

  2. 探索演示结果以了解 Semgrep 的工作原理

  3. 通过导航至扫描您的项目Projects > Scan New Project > Run scan in CI

  4. 选择您的版本控制系统并按照入门步骤添加您的项目。完成此设置后,Semgrep 将在每次拉取请求后扫描您的项目。

  5. [可选] 如果您想在本地运行 Semgrep,请按照 CLI 部分中的步骤操作。

笔记:

如果有任何问题,请在 Semgrep Slack 中寻求帮助

选项 2:从 CLI 开始

  1. 安装 Semgrep CLI
# For macOS
$ brew install semgrep

For Ubuntu/WSL/Linux/macOS

$ python3 -m pip install semgrep

To try Semgrep without installation run via Docker

$ docker run -it -v "${PWD}:/src" returntocorp/semgrep semgrep login $ docker run -e SEMGREP_APP_TOKEN=<TOKEN> --rm -v "${PWD}:/src" returntocorp/semgrep semgrep ci

<clipboard-copy aria-label="Copy" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 tooltipped-no-delay d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w" value="# For macOS $ brew install semgrep

For Ubuntu/WSL/Linux/macOS

$ python3 -m pip install semgrep

To try Semgrep without installation run via Docker

$ docker run -it -v "${PWD}:/src" returntocorp/semgrep semgrep login $ docker run -e SEMGREP_APP_TOKEN= --rm -v "${PWD}:/src" returntocorp/semgrep semgrep ci" tabindex="0" role="button">

  1. 运行semgrep login以创建您的帐户并登录 Semgrep。

登录 Semgrep 可以让您访问:

  1. 转到应用程序的根目录并运行semgrep ci. 这将扫描您的项目以检查源代码及其依赖项中的漏洞。

Semgrep 生态系统

Semgrep 生态系统包括以下产品:

  • Semgrep 代码- 使用我们的跨文件和跨功能分析,使用 Semgrep 的专有规则(由我们的安全研究团队编写)扫描您的代码。旨在查找 OWASP Top 10 漏洞并防范关键安全风险。Semgrep 代码有免费和付费两种版本
  • Semgrep 供应链 (SSC) - 一种高信号依赖性扫描器,可检测整个软件开发生命周期 (SDLC) 中开源第三方库和功能中可触及的漏洞。Semgrep Supply Chain 提供免费和付费两种版本
  • Semgrep Secrets [新!] - 秘密检测结合使用语义分析、改进的熵分析和验证来准确检测开发人员工作流程中的敏感凭据。预订演示以请求尽早使用该产品。
  • Semgrep 云平台 (SCP) - 大规模部署、管理和监控 Semgrep,提供免费和付费级别。与 GitHub、GitLab、CircleCI 等持续集成 (CI) 提供商集成。
  • Semgrep OSS 引擎- 开源引擎和社区贡献的规则是一切的核心(这个项目)。

要了解有关 Semgrep 的更多信息,请访问:

  • Semgrep Playground - 用于编写和共享规则的在线交互式工具。
  • Semgrep 注册表- 2,000 多个社区驱动的规则,涵盖安全性、正确性和依赖性漏洞。

加入已经在 GitLab、Dropbox、Slack、Figma、Shopify、HashiCorp、Snowflake 和 Trail of Bits 等公司使用 Semgrep 的数十万其他开发人员和安全工程师的行列。

Semgrep 由软件安全公司 Semgrep, Inc.开发并提供商业支持。

Semgrep 规则

Semgrep 规则看起来就像您已经编写的代码;没有抽象语法树、正则表达式角力或痛苦的 DSL。下面是查找 Python 语句的快速规则print()

单击此处,在 Semgrep's Playground 中在线运行它。

用于查找 Python print() 语句的 Semgrep 规则示例

例子

访问文档 > 规则示例以获取用例和想法。

使用案例 语义规则
禁止危险API 防止使用 exec
搜索路由和身份验证 提取 Spring 路线
强制使用安全默认值 安全地设置 Flask cookie
受污染的数据流入接收器 ExpressJS 数据流进入 sandbox.run
实施项目最佳实践 使用assertEqual进行==检查始终检查子进程调用
整理项目特定知识 在进行交易之前验证交易
审计安全热点 在 Apache Airflow 中查找 XSS硬编码凭证
审核配置文件 查找 S3 ARN 用途
从已弃用的 API 迁移 DES 已弃用已弃用的 Flask API已弃用的 Bokeh API
应用自动修复 使用listenAndServeTLS

扩展

访问文档 > 扩展以了解如何在编辑器或预提交中使用 Semgrep。当集成到 CI 并配置为扫描拉取请求时,Semgrep 将仅报告该拉取请求引入的问题;这使您可以开始使用 Semgrep,而无需修复或忽略预先存在的问题!

文档

浏览网站上的完整 Semgrep文档。如果您是 Semgrep 新手,请查看文档 > 入门交互式教程

指标

使用注册表中的远程配置(如--config=p/ci)将假名规则指标报告给 semgrep.dev。

使用本地文件中的配置(例如--config=xyz.yml)不会启用指标。

要禁用注册表规则指标,请使用--metrics=off

Semgrep隐私政策描述了指导数据收集决策的原则以及启用指标时收集和未收集的数据的详细信息。

更多的

升级中

要升级,请运行以下与您安装 Semgrep 的方式相关的命令:

# Using Homebrew
$ brew upgrade semgrep

# Using pip $ python3 -m pip install --upgrade semgrep

# Using Docker $ docker pull returntocorp/semgrep:latest

<clipboard-copy aria-label="Copy" class="ClipboardButton btn btn-invisible js-clipboard-copy m-2 p-0 tooltipped-no-delay d-flex flex-justify-center flex-items-center" data-copy-feedback="Copied!" data-tooltip-direction="w" value="# Using Homebrew $ brew upgrade semgrep

Using pip

$ python3 -m pip install --upgrade semgrep

Using Docker

$ docker pull returntocorp/semgrep:latest" tabindex="0" role="button">

semgrep-cn's People

Contributors

aryx avatar brendongo avatar mjambon avatar iagoabal avatar emjin avatar drewdennison avatar brandonspark avatar nmote avatar underyx avatar ievans avatar mschwager avatar mmcqd avatar semgrep-ci[bot] avatar sjord avatar rcoh avatar ajbt200128 avatar nbrahms avatar tpetr avatar colleend avatar ihji avatar hannesm avatar dependabot[bot] avatar spencerdrak avatar zzeleznick avatar jbergler avatar cgdolan avatar kopecs avatar amchiclet avatar sabrinabrogren avatar pangngan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.