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

bug(cicd): yaml parser transform number to string #6930

Open
jycamier opened this issue Mar 6, 2024 · 0 comments
Open

bug(cicd): yaml parser transform number to string #6930

jycamier opened this issue Mar 6, 2024 · 0 comments
Labels
bug Something isn't working community Community contribution query New query feature

Comments

@jycamier
Copy link
Contributor

jycamier commented Mar 6, 2024

KICS : 1.7.13

In Github Action, we've encounter side-effect about parsing.

name: parser test
on:
  pull_request: {}
jobs:
  matrix-fail:
    strategy:
      max-parallel: 8
      matrix:
        - name: foo
        - name: bar
    runs-on: [self-hosted, linter]
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-go@v5
        with:
          go-version: 1.20    

Go version 1.20 is parsed by Github as a number so, 1.20 is considered as 1.2 (and that's wrong). We want to create a query to check this.

However, the yaml perser of kics transform this number to a string, so it become impossible to check.

{
    "file": "/test/positive1.yaml",
    "id": "a30b26aa-f7ae-4864-a20d-443a361f7f00",
    "jobs": {
        "matrix-fail": {
            "runs-on": [
                "self-hosted",
                "linter"
            ],
            "steps": [
                {
                    "uses": "actions/checkout@v4"
                },
                {
                    "uses": "actions/setup-go@v5",
                    "with": {
                        "go-version": "1.20"
                    }
                }
            ],
            "strategy": {
                "matrix": [
                    {
                        "name": "foo"
                    },
                    {
                        "name": "bar"
                    }
                ],
                "max-parallel": 8
            }
        },
        "matrix-ok": {
            "runs-on": [
                "self-hosted",
                "linter"
            ],
            "steps": [
                {
                    "uses": "actions/checkout@v2"
                }
            ],
            "strategy": {
                "matrix": [
                    {
                        "name": "foo"
                    },
                    {
                        "name": "bar"
                    }
                ],
                "max-parallel": 7
            }
        }
    },
    "name": "parser test",
    "on": {
        "pull_request": {}
    }
}
@jycamier jycamier added bug Something isn't working community Community contribution labels Mar 6, 2024
@github-actions github-actions bot added the query New query feature label Mar 6, 2024
@gabriel-cx gabriel-cx changed the title bug(CICD): yaml parser transform number to string bug(cicd): yaml parser transform number to string Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community Community contribution query New query feature
Projects
None yet
Development

No branches or pull requests

1 participant