question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bug: Validation of datatypes is too strict

See original GitHub issue

Background

In current implementation it requires all types in the rule parameter datatypes to be defined in conf/types.json. For example, following rule will return false even normalized type command is defined. It is because the fetch_values_by_datatype helper will return an empty list due to code to validate datatypes at here .

"""This is sample rule to alert on any suspicious use of wget"""
import fnmatch
from helpers.base import fetch_values_by_datatype

@rule(datatypes=['command', 'not_exist_normalized_type'])
def alert_suspecious_wget(rec):
    results = fetch_values_by_datatype(rec, 'command')
    for result in results:
        if fnmatch(result, "wget *"):
            return true
    return false

Desired Change

Return value of normalized types if defined, and ignore normalized types which are not defined in conf/types.json.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chunyong-lincommented, Oct 12, 2017

Yes, I have the fix already, will send PR soon.

1reaction
ghostcommented, Oct 12, 2017

After a use-case Javier raised, and giving it more thought, datatypes should be an OR vs. AND operation. @chunyong-lin - can you make the appropriate changes?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Datatypes validations are too strict! · Issue #4314 - GitHub
In my humble opinion; validations would be better off by default, and let the user decide if he/she wants an early validation or...
Read more >
Input validation errors: The root of all evil in web application ...
Input validation is the first step in sanitizing the type and content of data supplied by a user or application. Missing or improper...
Read more >
How to Validate Datatypes in Python - Start Data Engineering
Although this is possible, it can become hard to manually validate data types and handle all such cases.
Read more >
CWE-20: Improper Input Validation (4.9) - MITRE
The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required...
Read more >
Find Mode not validating Data Type… - Claris Community
I am trying to trap errors with a much more complicated search, but wish to see when a validation error occurs in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found