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

Unable to add/use Governance rulesets whilst using Postgres DB #3592

Open
Chilliwiddit opened this issue Feb 13, 2025 · 0 comments
Open

Unable to add/use Governance rulesets whilst using Postgres DB #3592

Chilliwiddit opened this issue Feb 13, 2025 · 0 comments

Comments

@Chilliwiddit
Copy link

Description

The default rulesets (Style guidelines, OWASP Top 10 and Design guidelines) are unable to be added to the Postgres database due to the ruleset table expecting Binary data while the distribution is attempting to add Integer values. Therefore there are no default rulesets and one is unable to add there own custom ruleset. The error stack for one of the rulesets is shown below:

[2025-02-13 18:55:27,496] ERROR - APIMGovernanceUtil Error while adding default ruleset: wso2_api_design_guidelines.yaml org.wso2.carbon.apimgt.governance.api.error.GovernanceException: 200002:Ruleset creation failed::Ruleset creation failed with name: 'WSO2 API Design Guidelines' in the organization: 'carbon.super'. at org.wso2.carbon.apimgt.governance.impl.dao.impl.RulesetMgtDAOImpl.createRuleset(RulesetMgtDAOImpl.java:117) ~[org.wso2.carbon.apimgt.governance.impl_9.31.14.jar:?] at org.wso2.carbon.apimgt.governance.impl.RulesetManager.createNewRuleset(RulesetManager.java:76) ~[org.wso2.carbon.apimgt.governance.impl_9.31.14.jar:?] at org.wso2.carbon.apimgt.governance.impl.util.APIMGovernanceUtil.lambda$loadDefaultRulesets$0(APIMGovernanceUtil.java:161) ~[org.wso2.carbon.apimgt.governance.impl_9.31.14.jar:?] at java.util.Iterator.forEachRemaining(Iterator.java:133) ~[?:?] at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) ~[?:?] at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658) ~[?:?] at org.wso2.carbon.apimgt.governance.impl.util.APIMGovernanceUtil.loadDefaultRulesets(APIMGovernanceUtil.java:151) ~[org.wso2.carbon.apimgt.governance.impl_9.31.14.jar:?] at org.wso2.carbon.apimgt.governance.impl.listener.ServerStartupListener.completedServerStartup(ServerStartupListener.java:44) ~[org.wso2.carbon.apimgt.governance.impl_9.31.14.jar:?] at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.notifyAfter(CarbonCoreServiceComponent.java:264) ~[?:?] at org.wso2.carbon.core.internal.StartupFinalizerServiceComponent.completeInitialization(StartupFinalizerServiceComponent.java:214) ~[?:?] at org.wso2.carbon.core.internal.StartupFinalizerServiceComponent.serviceChanged(StartupFinalizerServiceComponent.java:309) ~[?:?] at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.wso2.carbon.throttling.agent.internal.ThrottlingAgentServiceComponent.registerThrottlingAgent(ThrottlingAgentServiceComponent.java:118) ~[org.wso2.carbon.tenant.throttling.agent_4.9.31.jar:?] at org.wso2.carbon.throttling.agent.internal.ThrottlingAgentServiceComponent.activate(ThrottlingAgentServiceComponent.java:96) ~[org.wso2.carbon.tenant.throttling.agent_4.9.31.jar:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(ServiceComponent.java:260) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?] at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(ServiceComponentProp.java:146) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?] at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.build(ServiceComponentProp.java:345) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?] at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(InstanceProcess.java:620) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?] at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(InstanceProcess.java:197) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?] at org.eclipse.equinox.internal.ds.Resolver.getEligible(Resolver.java:343) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?] at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(SCRManager.java:222) ~[org.eclipse.equinox.ds_1.4.400.v20160226-2036.jar:?] at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:113) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:985) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:866) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:804) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:228) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:525) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:544) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:529) ~[org.wso2.carbon.core_4.9.27.jar:?] at org.wso2.carbon.core.init.CarbonServerManager.removePendingItem(CarbonServerManager.java:305) ~[org.wso2.carbon.core_4.9.27.jar:?] at org.wso2.carbon.core.init.PreAxis2ConfigItemListener.bundleChanged(PreAxis2ConfigItemListener.java:112) ~[org.wso2.carbon.core_4.9.27.jar:?] at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:973) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?] Caused by: org.postgresql.util.PSQLException: ERROR: column "content" is of type bytea but expression is of type bigint Hint: You will need to rewrite or cast the expression. Position: 91 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2733) ~[postgresql-42.7.4.jar:42.7.4] at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2420) ~[postgresql-42.7.4.jar:42.7.4] at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372) ~[postgresql-42.7.4.jar:42.7.4] at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:517) ~[postgresql-42.7.4.jar:42.7.4] at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:434) ~[postgresql-42.7.4.jar:42.7.4] at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:194) ~[postgresql-42.7.4.jar:42.7.4] at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:180) ~[postgresql-42.7.4.jar:42.7.4] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.apache.tomcat.jdbc.pool.StatementFacade$StatementProxy.invoke(StatementFacade.java:118) ~[jdbc-pool_9.0.65.wso2v1.jar:?] at com.sun.proxy.$Proxy53.execute(Unknown Source) ~[?:?] at org.wso2.carbon.apimgt.governance.impl.dao.impl.RulesetMgtDAOImpl.addRuleContent(RulesetMgtDAOImpl.java:220) ~[org.wso2.carbon.apimgt.governance.impl_9.31.14.jar:?] at org.wso2.carbon.apimgt.governance.impl.dao.impl.RulesetMgtDAOImpl.createRuleset(RulesetMgtDAOImpl.java:107) ~[org.wso2.carbon.apimgt.governance.impl_9.31.14.jar:?] ... 49 more

Due to there being no rulesets, one is unable to create a governance policy

Steps to Reproduce

  1. Configure APIM with a postgres DB
  2. Launch the pack
  3. Attempt to add a custom ruleset

Version

4.5.0

Environment Details (with versions)

  • Ubuntu 22.0
  • Postgres driver v42.7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant