Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Next generation admin interface for CKAN.
This extension is under development, so there are many things to do:
User edit
pageuser_list
action. Currently it's just a copy of contrib one with one small change. Maybe it's a good idea to write
our own versatile version.Extensions
page. What do we want: replace status_show
. This page should be more informative. Show here what extensions we are using with the respective versions. For now we don't have a standartized mechanism to retrieve versions from extensions, think about it.Available updates?
page. Show user if he could upgrade an extension or CKAN to a new version.Appearance
page. TODOHelp
page. TODOWe utilize the ISignal
interface for gathering configuration sections. For instance, to register a configuration section from your extension:
from __future__ import annotations
import ckan.types as types
import ckan.plugins as p
import ckan.plugins.toolkit as tk
import ckanext.ap_main.types as ap_types
class ExamplePlugin(p.SingletonPlugin):
...
p.implements(p.ISignal)
...
# ISignal
def get_signal_subscriptions(self) -> types.SignalMapping:
return {
tk.signals.ckanext.signal("ap_main:collect_config_sections"): [
self.collect_config_sections_subs
],
}
@staticmethod
def collect_config_sections_subs(sender: None):
return ap_types.SectionConfig(
name="Example plugin configuration",
configs=[
ap_types.ConfigurationItem(
name="Configuration",
blueprint="example_plugin.config,
info="Basic configuration options",
),
],
)
The structure of the section is outlined in the SectionConfig
and ConfigurationItem
here.
You can import these structures and use them to assemble the section or just return a dictionary mirroring the same structure. This method works the same as described above:
@staticmethod
def collect_config_sections_subs(sender: None):
return {
"name": "Example plugin configuration",
"configs": [
{
"name": "Configuration",
"blueprint": "example_plugin.config",
"info": "Basic configuration options",
},
],
}
If the section with the specified name
has already been registered by another plugin, the configuration options will be included into it.
The structure of ConfigurationItem
is as follows:
name
- defines the name of the configuration section linkblueprint
- indicates the configuration page blueprintinfo
(optional, default: No description
) - provides a description for the configuration linkCompatibility with core CKAN versions:
CKAN version | Compatible? |
---|---|
2.9 | no |
2.10 | yes |
2.11 | yes |
To install ckanext-admin-panel:
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
Clone the source and install it on the virtualenv
git clone https://github.com/DataShades/ckanext-admin-panel.git cd ckanext-admin-panel pip install -e . pip install -r requirements.txt
Add admin_panel admin_panel_cron
to the ckan.plugins
setting in your CKAN
config file (by default the config file is located at
/etc/ckan/default/ckan.ini
).
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
None at present
To store log messages in a database, you must enable the admin_panel_log
extension, initialize the database log table,
and create a handler in your 'ckan.ini' file.
Add admin_panel_log
to the ckan.plugins
setting in your CKAN config file.
Initialize all missing tables with: ckan db pending-migrations --apply
To register a handler, you must specify it in your CKAN configuration file. Due to some CKAN specifics, the logger needs to know the database URI to initialize itself. Provide it with the kwargs
option.
[handler_dbHandler]
class = ckanext.ap_log.log_handlers.DatabaseHandler
formatter = generic
level = NOTSET
kwargs={"db_uri": "postgresql://ckan_default:pass@localhost/master"}
The logging handler must be also included in [handlers]
section.
[handlers]
keys = console, dbHandler
The last thing you need to do is to add our handler to a logger you need. For example, if you want to log only ckan
logs, do this:
[logger_ckan]
level = INFO
handlers = console, dbHandler
Register a separate logger for a cron job logging. The DB handler must be initiated first if you want to have an access to logs via UI. Otherwise, you will be able to see logs only in CKAN logs files.
[logger_ap_cron]
level = DEBUG
handlers = console, dbHandler
qualname = ap_cron
propagate = 0
loggers
section.
[loggers]
keys = root, ckan, ckanext, werkzeug, flask_app, ap_cron
Each cron job can be manually triggered from the cron manager page. However, it's essential to schedule a single command with crontab to automatically trigger all jobs created within CKAN. For example:
*/10 * * * * /usr/lib/ckan/default/bin/ckan -c /etc/ckan/default/production.ini ap-cron trigger-jobs
This command checks all the jobs every 10 minutes to determine if they should be run again. Without scheduling this command, you can manually initiate a specific job through the user interface by clicking the Run
button. Alternatively, you can execute all scheduled jobs by clicking the Run active jobs
button.
To create a cron job, navigate to the cron manager page and click the Add cron job
button.
Each job must include the following components:
It is important to note that console commands are not permitted within cron jobs for security reasons. Instead, only CKAN actions can be executed. You can chain multiple actions together; each subsequent action will receive the result of the previous one as its arguments.
To install ckanext-admin-panel for development, activate your CKAN virtualenv and do:
git clone https://github.com/DataShades/ckanext-admin-panel.git
cd ckanext-admin-panel
python setup.py develop
pip install -r dev-requirements.txt
To run the tests, do:
pytest --ckan-ini=test.ini
FAQs
Custom admin panel for CKAN to expand default functionality
We found that ckanext-admin-panel demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.