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

Are security indicators used ? #2680

Closed
VannTen opened this issue Aug 11, 2022 · 10 comments
Closed

Are security indicators used ? #2680

VannTen opened this issue Aug 11, 2022 · 10 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/stack-guidance Categorizes an issue or PR as relevant to SIG Stack Guidance. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@VannTen
Copy link
Member

VannTen commented Aug 11, 2022

Do anyone know if we're using the security indicators at all ?
Looking at the code in thoth/storages/security_indicators.py, it seems broken

Bug description

All security indicators use the type (security_indicator_type, "bandit", "cloc")
as the document_id when accessing document. So they can only ever access one
document named by the type.

Actual behavior

class _SecurityIndicatorBase:
    """A base class for security-indicators analyzers results."""

    ...

    def retrieve_document(self) -> Dict[str, Any]:
        """Retrieve security indicator document."""
        return self.ceph.retrieve_document(self.security_indicator_type)

    def document_exists(self) -> bool:
        """Check if the there is an object with the given key in bucket."""
        return self.ceph.document_exists(self.security_indicator_type)

the ceph methods are implemented like this

    def retrieve_document(self, document_id: str) -> dict:
        """Retrieve a dictionary stored as JSON from S3."""
        return json.loads(self.retrieve_blob(document_id).decode())

    def document_exists(self, document_id: str) -> bool:
        """Check if the there is an object with the given key in bucket.

        This check does only HEAD request.
        """
        try:
            self._s3.Object(self.bucket, f"{self.prefix}{document_id}").load()
        (...)

So can't possibly works.

Additional context

That could be fixed (That stuff should probably inherit from result_base) but
I'd first wanted to check if we actually use that; it seems like if we were, it
would cause pretty serious breakage.

@mayaCostantini : would you know if we do use it ?

If we can just get rid of the code entirely, that would also help with #2673

/kind bug
/triage needs-information
/sig stack-guidance
/priority important-soon

@VannTen VannTen added the kind/bug Categorizes issue or PR as related to a bug. label Aug 11, 2022
@sesheta sesheta added triage/needs-information Indicates an issue needs more information in order to work on it. sig/stack-guidance Categorizes an issue or PR as relevant to SIG Stack Guidance. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Aug 11, 2022
@goern
Copy link
Member

goern commented Aug 11, 2022

I think the concept of Security Indicators has been superseded by prescriptions, right?! @mayaCostantini @harshad16

@mayaCostantini
Copy link
Contributor

In adviser, security indicator steps are still part of the resolution logic for the security recommendation type, as they are run with other steps such as CVE etc.

However, scoring of a State based on security indicators for a package rely on the information retrieved from the database via

def get_si_aggregated_python_package_version(

but after inspection of a database dump from 22-07-08, it seems like the only security indicator document aggregated in the si_aggregated_run table is from 22-05-13 (which I did not find in the S3 bucket).

After verification, it seems like the security-indicators workflow has not been updated for 8 months, so my guess is this feature has been abandoned.

(cc @harshad16 for verification as I am still unsure if we are still aggregating those indicators).

@mayaCostantini
Copy link
Contributor

As for if we should remove the code entirely, I don't think that would be a good idea for the moment as we could decide to enable those indicators later in the future. However, I am lacking some context on why this feature ceased to be used.

@VannTen
Copy link
Member Author

VannTen commented Aug 11, 2022 via email

@mayaCostantini
Copy link
Contributor

You are right about the fact that the implementation of the retrieve_document and document_exists methods in the base class is wrong and could definitely introduce a bug if security indicators documents happen to be present again in the database.
A solution could be to fix those methods and to leave the security indicators-related code as is, so that it can be easily reused just in case, wdyt?

@VannTen
Copy link
Member Author

VannTen commented Aug 11, 2022 via email

@goern goern pinned this issue Aug 17, 2022
@harshad16
Copy link
Member

The security indicator is still in use, and the ingestion with respect to the security indicator is still taking a place.
The issue stated seems like a broken piece that we should fix.
The security indicator is not abandoned, just got lesser in priority as we were trying to get the other things in place.
Let's definitely pull this issue into some work cycle and work on it.

@VannTen
Copy link
Member Author

VannTen commented Aug 19, 2022 via email

@VannTen
Copy link
Member Author

VannTen commented Sep 1, 2022 via email

@sesheta sesheta closed this as completed Sep 1, 2022
@sesheta
Copy link
Member

sesheta commented Sep 1, 2022

@VannTen: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/stack-guidance Categorizes an issue or PR as relevant to SIG Stack Guidance. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

5 participants