Skip to content

Move device classification app lists to YAML configuration #152

@NotYuSheng

Description

@NotYuSheng

Problem

DeviceClassifierService.java contains four hardcoded Set<String> collections used to classify devices by the nDPI application names observed in their traffic:

  • MOBILE_APPS — 13 entries (Instagram, TikTok, WhatsApp, etc.)
  • DESKTOP_APPS — 18 entries (Zoom, Teams, Steam, SSH, etc.)
  • SERVER_APPS — 12 entries (PostgreSQL, MySQL, Redis, Kafka, etc.)
  • IOT_CATEGORIES — 2 entries (IoT-Scada, Cloud)

Any new nDPI application that should influence device classification (e.g. a new messaging app) requires a Java recompile and redeployment.

Proposed Solution

Move these lists to a dedicated YAML configuration file loaded by Spring's @ConfigurationProperties. This makes classification rules configurable without touching Java code.

Example config (application.yml or dedicated device-classification.yml):

device-classification:
  mobile-apps:
    - Instagram
    - TikTok
    - Snapchat
    - WhatsApp
    - WeChat
    - Line
    - Viber
    - Telegram
    - Signal
    - iMessage
    - FaceTime
    - AirDrop
    - Siri
  desktop-apps:
    - Zoom
    - Teams
    - Slack
    - Discord
    - Skype
    - WebEx
    - GoToMeeting
    - BitTorrent
    - Steam
    - Battle.net
    - League of Legends
    - Valorant
    - Remote Desktop
    - SSH
    - SMB
    - NFS
    - VNC
    - TeamViewer
  server-apps:
    - PostgreSQL
    - MySQL
    - MongoDB
    - Redis
    - Elasticsearch
    - Kafka
    - RabbitMQ
    - Memcached
    - LDAP
    - Kerberos
    - SNMP
    - Syslog
  iot-categories:
    - IoT-Scada
    - Cloud

Implementation

@ConfigurationProperties(prefix = "device-classification")
@Component
public class DeviceClassificationProperties {
    private Set<String> mobileApps = new HashSet<>();
    private Set<String> desktopApps = new HashSet<>();
    private Set<String> serverApps = new HashSet<>();
    private Set<String> iotCategories = new HashSet<>();
    // getters/setters
}

Inject DeviceClassificationProperties into DeviceClassifierService and replace the static Set references.

Files to Change

  • backend/src/main/java/com/tracepcap/analysis/service/DeviceClassifierService.java
  • backend/src/main/resources/application.yml (or new device-classification.yml)
  • New DeviceClassificationProperties.java config class

Acceptance Criteria

  • MOBILE_APPS, DESKTOP_APPS, SERVER_APPS, IOT_CATEGORIES static sets removed from Java
  • Lists loaded from YAML via @ConfigurationProperties
  • Adding a new app to classification requires only a YAML change (no recompile)
  • Existing classification behaviour is unchanged

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions