Skip to content

Pylint: Enable eval-used#2514

Merged
avylove merged 1 commit into
microsoft:mainfrom
avylove:pylint_5
Feb 28, 2023
Merged

Pylint: Enable eval-used#2514
avylove merged 1 commit into
microsoft:mainfrom
avylove:pylint_5

Conversation

@avylove
Copy link
Copy Markdown
Contributor

@avylove avylove commented Jan 9, 2023

eval() allows arbitrary code execution and should be avoided. This adds a Pylint check and removed cases where is was used. Most of those were simple changes, but ScriptTransformer required restricting what user input can do. simpleeval was used as it's close to the implementation of a mini-language without effort of creating one.

Comment thread pyproject.toml Outdated
Comment thread lisa/sut_orchestrator/azure/features.py
Comment thread lisa/sut_orchestrator/azure/features.py Outdated
@avylove
Copy link
Copy Markdown
Contributor Author

avylove commented Jan 19, 2023

@squirrelsc , @LiliDeng Any issues with this?

@avylove
Copy link
Copy Markdown
Contributor Author

avylove commented Jan 19, 2023

Runbook I used to for testing., just changed timeout_value and script to test different cases.
lisa -r test.yml --debug 2>&1 | grep lisa.transformer

name: local test
notifier:
  - type: html
environment:
  environments:
    - nodes:
        - type: local
platform:
  - type: ready

variable:
  - name: timeout_value
    value: 0

transformer:
  - type: script
    rename:
      script_should_run: should_run
    scripts:
      - name: should_run
        variables:
          - timeout_value
        script: int(timeout_value) <= 0

@squirrelsc
Copy link
Copy Markdown
Contributor

It needs to be tested with 1) gen1/gen2, 2) hibernate or rdma. Please let Lili know, if you don't know which test is suitable for this testing.

Copy link
Copy Markdown
Collaborator

@LiliDeng LiliDeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested TVM (gen2), sriov and RDMA, works well.

Copy link
Copy Markdown
Collaborator

@LiliDeng LiliDeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will double check once back from holiday, thanks!

squirrelsc
squirrelsc previously approved these changes Feb 27, 2023
@avylove avylove merged commit e3a962b into microsoft:main Feb 28, 2023
@avylove avylove deleted the pylint_5 branch August 8, 2023 15:39
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

Successfully merging this pull request may close these issues.

3 participants