Visitar URL original
better documentation of Git-sourced fields when parsing · Issue #176 · haskell/security-advisories · GitHub
Skip to content

better documentation of Git-sourced fields when parsing #176

Open

Description

@MangoIV

The fact we use the Git history to deduce the published and modified date fields is
non-obvious and can confuse users, because parsing our advisory content will fail if
they are divorced from the Git repo. We should improve the documentation about this.

original summary retained below


Summary

  • remove an advisory
  • toml parsing fails

Expected behavior

  • toml parsing works on some bag of advisories, there shouldn't have to be any constraints on them

Cause of the bug

Activity

  1. changed the title [-]`toml` parsing fails if not all advisories are consecutive [/-] [+]`toml` parsing fails if you remove one of the advisories[/+] on Mar 29, 2024
  2. MangoIV commented on Mar 29, 2024

    @MangoIV
    ContributorAuthor

    yeah I have no idea of where this is coming from; the toml parser also fails if I just 1;1 copy the advisories to some empty directories.

  3. MangoIV commented on Mar 29, 2024

    @MangoIV
    ContributorAuthor
    ListAdvisoryValidationError
        "/nix/store/99blf5rfm6rp0sr18168xclkw1gnr47y-empty-dir-with-advisories"
        [ AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        , AdvisoryError
            [ MatchMessage
                { matchAnn = Nothing
                , matchPath = []
                , matchMessage =
                    "missing mandatory key: advisory.date"
                }
            ]
            "missing mandatory key: advisory.date in <top-level>\n"
        ]
  4. MangoIV commented on Mar 29, 2024

    @MangoIV
    ContributorAuthor

    is it possible that this has to do something with .git? this is the only way I could explain how just copying it to the store would break it.

  5. frasertweedale commented on Mar 29, 2024

    @frasertweedale
    Collaborator

    We use the git history to deduce the date and modified data. Advisory files that are not in a git repo need to include those fields explicitly.

  6. frasertweedale commented on Mar 29, 2024

    @frasertweedale
    Collaborator

    I can't reproduce the issue as described in the summary (remove one advisory). I deduce that this all
    occurred outside a git repo, which is the actual cause (and expected behaviour).

    FWIW, we will soon work on an index/archive format of some kind (#170) for efficient distribution of advisories, and which
    will allow them to be divorced from the git repo without losing metadata. In it's simplest form, this could be a
    re-rendering of the advisories with the derived date fields present in the TOML.

  7. MangoIV commented on Mar 29, 2024

    @MangoIV
    ContributorAuthor

    Ahhh makes sense yes. Thank you!

  8. MangoIV commented on Mar 30, 2024

    @MangoIV
    ContributorAuthor

    FWIW, we will soon work on an index/archive format of some kind (#170) for efficient distribution of advisories, and which
    will allow them to be divorced from the git repo without losing metadata. In it's simplest form, this could be a
    re-rendering of the advisories with the derived date fields present in the TOML.

    I think that's a good idea; fwiw if you provided not-only a toml parser but also pretty-printer, that should be really easy to do ;)

  9. frasertweedale commented on Mar 30, 2024

    @frasertweedale
    Collaborator

    Cheers, I'm going to leave this issue open as a reminder to improve the documentation about this implementation detail.

  10. changed the title [-]`toml` parsing fails if you remove one of the advisories[/-] [+]better documentation of Git-sourced fields when parsing[/+] on Mar 30, 2024
  11. MangoIV commented on Mar 30, 2024

    @MangoIV
    ContributorAuthor

    thank you <3

  12. MangoIV commented on Mar 31, 2024

    @MangoIV
    ContributorAuthor

    osv seems to be appropriate

  13. MangoIV commented on Mar 31, 2024

    @MangoIV
    ContributorAuthor

    I guess as a jsonl

  14. MangoIV commented on May 31, 2024

    @MangoIV
    ContributorAuthor

    without any code changes, this started breaking downstream @frasertweedale https://github.com/MangoIV/cabal-audit/actions/runs/9102576510/job/25656820603 I don't know what is wrong, I can use cabal-audit as usual locally, it only fails in the github runner now. I don't know what the issues is there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions