Skip to content

fix: mark malformed TFLite scans inconclusive#916

Merged
mldangelo-oai merged 2 commits intomainfrom
mdangelo/codex/tflite-boundary-audit
Apr 11, 2026
Merged

fix: mark malformed TFLite scans inconclusive#916
mldangelo-oai merged 2 commits intomainfrom
mdangelo/codex/tflite-boundary-audit

Conversation

@mldangelo-oai
Copy link
Copy Markdown
Contributor

Summary

  • mark invalid TFLite magic, FlatBuffer parse, and structure traversal failures with explicit inconclusive scan metadata
  • ensure aggregate scans return exit 2 instead of clean exit 0 for malformed TFLite files without security findings
  • add cache-rerun coverage so inconclusive metadata and exit-code behavior survive cached results

Validation

  • uv run pytest tests/scanners/test_tflite_scanner.py
  • uv run ruff format modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run ruff check --fix modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run mypy modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run pytest -n auto -m "not slow and not integration" --maxfail=1
  • uv run ruff format --check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • uv run ruff check modelaudit/ packages/modelaudit-picklescan/src packages/modelaudit-picklescan/tests tests/
  • git diff --check

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2026

Warning

Rate limit exceeded

@mldangelo-oai has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 11 minutes and 3 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 3 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3078df72-c35a-4338-bc8b-8fc3af8a59fc

📥 Commits

Reviewing files that changed from the base of the PR and between 9b3e216 and e4e0ce8.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • modelaudit/scanners/tflite_scanner.py
  • tests/scanners/test_tflite_scanner.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mdangelo/codex/tflite-boundary-audit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mldangelo-oai mldangelo-oai enabled auto-merge (squash) April 10, 2026 19:40
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

Workflow run and artifacts

Performance Benchmarks

Compared 6 shared benchmarks with a regression threshold of 15%.
Status: 0 regressions, 1 improved, 5 stable, 0 new, 0 missing.
Aggregate shared-benchmark median: 740.86ms -> 697.49ms (-5.9%).

Top improvements:

  • tests/benchmarks/test_scan_benchmarks.py::test_scan_mixed_directory -25.2% (184.98ms -> 138.30ms, mixed-corpus, size=1.7 MiB, files=54)
Benchmark Target Size Files Baseline Current Change Status
tests/benchmarks/test_scan_benchmarks.py::test_scan_mixed_directory mixed-corpus 1.7 MiB 54 184.98ms 138.30ms -25.2% improved
tests/benchmarks/test_scan_benchmarks.py::test_scan_safe_pickle safe_model.pkl 49.4 KiB 1 28.73ms 28.99ms +0.9% stable
tests/benchmarks/test_scan_benchmarks.py::test_validate_file_type_pytorch_zip state_dict.pt 1.5 MiB 1 42.4us 42.7us +0.9% stable
tests/benchmarks/test_scan_benchmarks.py::test_scan_duplicate_directory duplicate-corpus 840.0 KiB 81 491.35ms 494.24ms +0.6% stable
tests/benchmarks/test_scan_benchmarks.py::test_scan_pytorch_zip state_dict.pt 1.5 MiB 1 35.63ms 35.78ms +0.4% stable
tests/benchmarks/test_scan_benchmarks.py::test_detect_file_format_safe_pickle safe_model.pkl 49.4 KiB 1 131.4us 131.5us +0.1% stable

@mldangelo-oai mldangelo-oai merged commit 07c871a into main Apr 11, 2026
21 of 25 checks passed
@mldangelo-oai mldangelo-oai deleted the mdangelo/codex/tflite-boundary-audit branch April 11, 2026 05:45
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e4e0ce8914

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".



def _mark_inconclusive_scan_result(result: ScanResult, reason: str) -> None:
result.metadata["scan_outcome"] = INCONCLUSIVE_SCAN_OUTCOME
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve cacheability for malformed TFLite outcomes

Setting scan_outcome to inconclusive here makes malformed TFLite results non-cacheable under cache_policy.should_cache_scan_result(...). That means the second run will rescan instead of hitting cache, so the new cached-rerun behavior/coverage is not actually implemented and repeated malformed-file scans pay full cost each time.

Useful? React with 👍 / 👎.

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