Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "filetypes" metadata to rules #454

Open
tstromberg opened this issue Sep 15, 2024 · 4 comments
Open

Add "filetypes" metadata to rules #454

tstromberg opened this issue Sep 15, 2024 · 4 comments
Assignees

Comments

@tstromberg
Copy link
Collaborator

To improve performance and reduce false positives, I'd like to add metadata to our rules to constrain which file types they are associated with. For example:

meta:
   filetypes = "python,javascript"

I expect that most rules will be associated with a single file type. As far as standardization goes, I recommend basing it loosely on MIME types, specifically the second half of it. Looking at https://www.sitepoint.com/mime-types-complete-list/ - I would say our filetypes would look something like:

  • python
  • javascript
  • shell
  • c

For examples where the mime types don't exist or are excessively long, we can make up something meaningful, like:

  • macho
  • elf
@tstromberg
Copy link
Collaborator Author

cc @egibs for his thoughts.

This is related to #382

@egibs
Copy link
Member

egibs commented Sep 16, 2024

I'm all for this. The hard part will be going through each rule and adding the metadata and we still don't have a way to layer customizations on top of third party rules so TBD how complete our coverage will end up being.

@tstromberg
Copy link
Collaborator Author

tstromberg commented Sep 16, 2024 via email

@tstromberg
Copy link
Collaborator Author

A number of rules have this now: I think the next step will be updating our engine to respect this file type. Then we will be more likely to implement it everywhere.

For example, .py files should only run rules without a filetype defined, or those with "py" in the file types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants