Giter Club home page Giter Club logo

semgrep-docs's Introduction

Semgrep logo

Lightweight static analysis for many languages.
Find bugs and enforce code standards.


This repository powers Semgrep’s documentation. Docs are built using Docusaurus 2.

Contributing

Contributions to the docs are welcome! To start contributing, first please make sure you read and agree with the Semgrep’s Contributor Covenant Code of Conduct.

Building docs locally

  1. Clone the repository.
  2. Install: yarn install.
  3. On a clean git state, enter yarn build.
  4. Enter git checkout . The previous command yarn build overwrites some placeholders with exact values and these should not be committed. In most cases, there is no need to run yarn build after this initial set up process.
  5. There are two options to run the docs locally:
    1. Enter yarn dev and then go to <http://localhost:3000/>. This option is for contributors and writers.
    2. Enter yarn start and then go to: <http://localhost:3000/>. This option is for displaying an accurate preview of the live documentation. It runs a script that replaces certain identifiers with code or file templates. These replacements ensure that certain code or file templates are up-to-date.

Congratulations. You have set up your local repository for development.

Preview production build

yarn build

This command generates static content into the build directory. Preview the production build by running:

yarn serve

Note: Production build allows you to test redirects. Manage redirects in docusaurus.config.js.

Creating content

Content is written in regular Markdown or MDX files. Markdown and MDX files optionally contain YAML style metadata (front matter) at the top of the file. You can use front matter to override attributes like the slug and other things.

Read more about creating documentation using Docusaurus here.

Submitting PRs

Please submit suggested changes via PRs made against this repository’s main branch.

semgrep-docs's People

Contributors

0xdc0de avatar adamboros avatar adamkvitek avatar armchairlinguist avatar aryx avatar brendongo avatar chmccreery avatar colleend avatar dependabot[bot] avatar dlukeomalley avatar drewdennison avatar emjin avatar github-actions[bot] avatar holdenmcg avatar iagoabal avatar ievans avatar inkz avatar jason-lim00 avatar khorne3 avatar milanwilliams avatar mjambon avatar mmcqd avatar mschwager avatar pabloest avatar raghavjain3 avatar s-santillan avatar sabrinabrogren avatar sebasrevuelta avatar sinat101 avatar underyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

semgrep-docs's Issues

Add Testing Rules section to Writing Rules

From @msorens on the r2c community Slack:

Read an interesting thread above about // ruleid which I had not encountered before. So I then went to read about it in the docs but not able to find it. 😾 Could someone point me to info on it?

This documentation currently is available at https://github.com/returntocorp/semgrep-rules#testing-rules, but may fit nicely in the Writing Rules section of our documentation.

This section may also be an opportunity to discuss our rules template and Awesome Rulesets.

Instruction to build semgrep-core from source refers to missing Makefile target

I got an error when I ran make build-core as I was following the instructions to build semgrep-core from source.

make: *** No rule to make target `build-core'.  Stop.

This prevented me from following the recommended way to get a semgrep-core binary as I was setting up a development environment to contribute to semgrep-cli. I saw this slack thread, which showed that another person had encountered the same problem with that instruction. I ran git log -S'build-core' -- Makefile on the develop branch of semgrep and I found that the instruction fell out of date as a result of this code change which removed the Makefile target build-core.

I would like help to update the docs with the correct instruction for new contributors to build semgrep-core from source.

Links to r2c.dev are no longer resolvable

I came across some pages such as https://semgrep.dev/docs/semgrep-supply-chain/overview/#transitive-dependencies-and-reachability-analysis where they link to

### Further reading
[Software supply chain security is hard](https://r2c.dev/blog/2022/software-supply-chain-security-is-hard/)
[The best free, open-source supply-chain security tool? The lockfile](https://r2c.dev/blog/2022/the-best-free-open-source-supply-chain-tool-the-lockfile/)

r2c.dev -> DNS_PROBE_FINISHED_NXDOMAIN

I'm guessing all of these should be rebased to semgrep.dev, when I do this the links are still valid.

Old docs still lives and cached

I suspect that the old docs still live in the server, where it was not overwritten by Docusaurus.
One example is CLI reference which is still cached by Google.
The new page has an URL named CLI usage, but the page title is still CLI reference.

Suggestion: Another XSS vector

I was reading the documentation provided here and I noted that there was something missing in the XSS prevention documentation: Template strings.

As noted here, template strings can introduce an XSS vector in Django, it also might be a good ideia to add a static code analysis rule for that, but I'm not sure if Semgrep already has this rule implemented.

Plural of ellipsis is ellipses

English is not my native language, but I think this is used incorrectly a few times. E.g. under Ellipsis Metavariables

I think

You can combine ellipsis and metavariables to match

should be

You can combine ellipses and metavariables to match

Similarly,
under Function definitions

In that case you can use ellipsis in place of the name

should be

In that case you can use an ellipsis in place of the name

Discoverability of inline PR comment feature in docs

Right now all the information around inline pr comments is just in a comment in an example yaml file. It would be easier to find if it had its own header.

(After making these changes, verify that searching the docs for inline pr comments will return a relevant result, which it doesn't do currently)

SAST_EXCLUDED_PATHS shouldn't have spaces

docs/troubleshooting/gitlab-sast.md has SAST_EXCLUDED_PATHS: "*.py, tests" but when GitLab converts that to --exclude rules it ends up as --exclude *.py --exclude tests where there's 2 spaces before tests. This was causing semgrep to not ignore paths containing "tests" because, I imagine, it's looking for " tests". I'm not sure if there should be follow-up issues for GitLab or semgrep but for now, the docs shouldn't suggest a broken value.

Navigation side bar and links

Last week we had worked to change the sidebar design. We changed the colors used in the background. we also changed our global link color.

for reference:
Nav background color- #29343D
Link color- #359DFD

can we have it back?

Restore search bar

Semgrep-docs used to have a search bar in the top-left corner, which made it very easy to navigate.

That search bar seems to have disappeared

Add playground link for each example

We provide lots of examples in the pattern syntax and rule syntax pages. It would be awesome if each of these examples had an accompanying link to a playground snippet with the code + pattern filled out. That would allow users to quickly play around with our docs examples 👍

At some point it may make sense to have a small, embeddable version of the editor that we can simply iframe in the docs examples and can be run from there. Until then, this is a step in that direction.

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.