Skip to content

Report extraction-relative source paths from artifact_processor#931

Merged
abrignoni merged 1 commit into
mainfrom
relative-source-paths
Jul 6, 2026
Merged

Report extraction-relative source paths from artifact_processor#931
abrignoni merged 1 commit into
mainfrom
relative-source-paths

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Problem

Audit of all 559 artifact functions: 483 (86%) return the raw absolute path as source_path, so the examiner's local filesystem (e.g. /Users/<name>/...) leaks into HTML report headers and LAVA metadata. Only 64 artifacts use context.get_relative_path().

Fix

One change in artifact_processor, applied after every artifact returns:

source_path = '\n'.join(
    Context.get_relative_path(p) for p in str(source_path).split('\n'))

Safe by construction: get_relative_path returns its input unchanged when the data_folder prefix is absent, so literals ("See source file column"), already-relative paths, and run types without a data_folder pass through untouched. The newline split handles the multi-source joined-path convention. Covers all 483 current artifacts plus anything written the same way in the future.

Reviewed with @JamesHabben, who correctly noted this is a partial solution: artifacts that drop absolute paths into per-row Source File columns are a separate population (~10 files after excluding false positives like FacebookMessenger's _src() helper) and will get a targeted follow-up PR.

Lint debt

CI lints the whole changed file, so this also clears ilapfuncs.py's pre-existing debt (9.72 → 10.00) with zero-behavior-change treatments: explicit datetime imports (verified timezone stays re-exported for the 5 artifacts importing it from ilapfuncs), a local rename for the shadowed timezone, dead pass/unused-var cleanups, and inline pragmas where renaming API params (id, type, source_file) or changing exception behavior would risk compatibility.

Testing

  • Transformation unit-tested: shortening, multi-path, literal passthrough, already-relative passthrough, no-data_folder passthrough — all pass
  • pylint 10.00/10; byte-compile; PluginLoader registers all 583 plugins
  • from scripts.ilapfuncs import timezone, datetime re-export verified intact

The same pattern likely applies to iLEAPP/RLEAPP/VLEAPP; will mirror there after this lands.

An audit of all 559 artifact functions found 483 returning the raw absolute
on-disk path as source_path, leaking the examiner's local filesystem into
HTML report headers and LAVA metadata. Only 64 artifacts shorten via
context.get_relative_path.

Fix it once in the decorator: after the artifact returns, each
newline-separated segment of source_path is passed through
Context.get_relative_path. The helper returns its input unchanged when the
data_folder prefix is absent, so literal values ('See source file column'),
already-relative paths, and runs without a data_folder pass through
untouched. Covers all current artifacts and any future ones.

Note: artifacts that place absolute paths inside per-row 'Source File'
columns are not covered by this and will be fixed separately (~10 files).

Also clears the file's pre-existing lint debt (9.72 -> 10.00) with
zero-behavior-change treatments: explicit datetime imports (timezone stays
re-exported for the 5 artifacts importing it from here), a local rename for
the shadowed timezone name, dead pass/unused-var cleanups, and inline
pragmas where changing signatures or exception behavior would risk the
public API.
@abrignoni abrignoni merged commit dcfe7e8 into main Jul 6, 2026
2 checks passed
@abrignoni abrignoni deleted the relative-source-paths branch July 6, 2026 18:35
abrignoni added a commit that referenced this pull request Jul 6, 2026
Shorten per-row Source File paths to extraction-relative (follow-up to #931)
stark4n6 pushed a commit to stark4n6/ALEAPP that referenced this pull request Jul 6, 2026
Follow-up to abrignoni#931 (which shortens the returned source_path centrally):
these artifacts also place the absolute on-disk path inside a per-record
Source File column, which the decorator cannot see. Wrap each row-inserted
copy with Context.get_relative_path; the absolute path is still used for
file/db access.

Fixed: Life360 (4 artifacts), SimpleStorage_applaunch, battery_usage_v9
(both artifacts), gmailIMAPEmails (emails + accounts), googleChat (all 4
artifacts), knuddels (chats, contacts, account incl. the active_row
sources join), thunderbird.

Verified false positives left as-is: FacebookMessenger (already shortens
via its _src helper), discreteNative (emits basename only),
honorMediaLibrary (Source File Path/Name columns are device-side paths
from the gallery.db evidence, not examiner paths).
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.

1 participant