saveourtool/save-cloud

HTTP 500 when trying to filter vulnerabilities by tag

Open

#2,994 opened on Nov 11, 2024

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Kotlin (4 forks)github user discovery
buggood first issue

Repository metrics

Stars
 (38 stars)
PR merge metrics
 (PR metrics pending)

Description

Example URL: http://localhost:8081/vuln/list?tag=AlmaLinux:8.

The UI displays the "Nothing was found" label:

image

THe back-end responds with HTTP 500 at http://localhost:5700/api/v1/vulnerabilities/by-filter?page=0&size=7 (POST) for the following payload:

{"statuses":["APPROVED","AUTO_APPROVED"],"tags":["AlmaLinux:8"]}

Stack trace:

18:24:22.553 [boundedElastic-1058] ERROR o.s.b.a.w.r.e.AbstractErrorWebExceptionHandler - [86e3a5a7-213]  500 Server Error for HTTP POST "/api/v1/vulnerabilities/by-filter?page=0&size=7" org.springframework.dao.InvalidDataAccessApiUsageException: Unable to locate Attribute  with the the given name [tag] on this ManagedType [com.saveourtool.common.spring.entity.BaseEntity]; nested exception is java.lang.IllegalArgumentException: Unable to locate Attribute  with the the given name [tag] on this ManagedType [com.saveourtool.common.spring.entity.BaseEntity]
	at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:374)
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	*__checkpoint ⇢ Handler com.saveourtool.cosv.backend.controllers.VulnerabilityController#getAllVulnerabilities(int, int, VulnerabilityFilter, Authentication) [DispatcherHandler]
	*__checkpoint ⇢ org.springframework.security.web.server.authentication.AuthenticationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.authorization.AuthorizationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.savedrequest.ServerRequestCacheWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.authentication.AuthenticationWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.context.ReactorContextWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.header.HttpHeaderWriterWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.config.web.server.ServerHttpSecurity$ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
	*__checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain]
	*__checkpoint ⇢ HTTP POST "/api/v1/vulnerabilities/by-filter?page=0&size=7" [ExceptionHandlingWebHandler]
Original Stack Trace:
		at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:374)
		at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:235)
		at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)
		at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
		at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:243)
Caused by: java.lang.IllegalArgumentException: Unable to locate Attribute  with the the given name [tag] on this ManagedType [com.saveourtool.common.spring.entity.BaseEntity]
	at org.hibernate.metamodel.model.domain.internal.AbstractManagedType.checkNotNull(AbstractManagedType.java:148)
	at org.hibernate.metamodel.model.domain.internal.AbstractManagedType.getAttribute(AbstractManagedType.java:119)
	at org.hibernate.metamodel.model.domain.internal.AbstractManagedType.getAttribute(AbstractManagedType.java:117)
	at org.hibernate.metamodel.model.domain.internal.AbstractManagedType.getAttribute(AbstractManagedType.java:44)
	at org.hibernate.query.criteria.internal.path.AbstractFromImpl.locateAttributeInternal(AbstractFromImpl.java:111)

Contributor guide