Skip to content

Detect loaded dependencies at runtime - #336

Open
hansott wants to merge 2 commits into
mainfrom
sca
Open

Detect loaded dependencies at runtime#336
hansott wants to merge 2 commits into
mainfrom
sca

Conversation

@hansott

@hansott hansott commented Aug 13, 2026

Copy link
Copy Markdown
Member

No uber jar support yet!

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

@hansott
hansott force-pushed the sca branch 4 times, most recently from f7d7397 to d3a5dfb Compare August 13, 2026 17:34
Comment thread agent_api/src/main/java/dev/aikido/agent_api/storage/RuntimePackagesStore.java Outdated
Comment thread agent_api/src/main/java/dev/aikido/agent_api/storage/RuntimePackagesStore.java Outdated
Comment thread agent/src/main/java/dev/aikido/agent/Agent.java Outdated
Comment thread agent_api/src/main/java/dev/aikido/agent_api/storage/RuntimePackagesStore.java Outdated
@hansott
hansott force-pushed the sca branch 2 times, most recently from 8eff64f to 4368a7a Compare August 14, 2026 09:37
}

public static void clear() {
PACKAGES.clear();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we clean packages every heartbeat, jar is only reported in the heartbeat where its first class loads, after that it stays loaded but never gets reported again

By default ui only shows deps seen in the last 24h

If application runs for more than a day, all reported dependencies will disappear from the dashboard. I think that's misleading

@hansott
hansott marked this pull request as ready for review August 14, 2026 15:04
HostnamesStore.clear();
RoutesStore.clear();
UsersStore.clear();
RuntimePackagesStore.clear();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium - Heartbeat drops the dependency inventory after the first report

RuntimePackagesStore is cleared on every heartbeat, but RuntimePackageCollector only ever enqueues a JAR location the first time it is seen because OBSERVED_LOCATIONS is never reset. That means already-loaded libraries disappear from all later heartbeats, and even a transient failure on the first report permanently loses the inventory because those locations will not be scanned again. The backend will therefore miss still-loaded dependencies and any vulnerability analysis built on this heartbeat data becomes incomplete.

Show fix

Do not treat loaded dependencies as per-heartbeat deltas. Keep RuntimePackagesStore persistent across heartbeats, or rebuild it from the full set of loaded classes before clearing anything; if you need delta reporting, only delete entries after a successful report and also make the collector able to repopulate them.

More info - Reply on this comment to give feedback or ignore the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants