Skip to content

Korjaa DeepSec-turvatarkistusten kattavuus - #89

Merged
Insaner1980 merged 2 commits into
mainfrom
codex/security-coderabbit-fixes
Jul 26, 2026
Merged

Korjaa DeepSec-turvatarkistusten kattavuus#89
Insaner1980 merged 2 commits into
mainfrom
codex/security-coderabbit-fixes

Conversation

@Insaner1980

@Insaner1980 Insaner1980 commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes

    • Improved security analysis for Android manifests, URI sharing, FileProvider paths, foreground services, Health Connect flows, and sensitive logs.
    • Lock recovery now distinguishes recoverable locks from those requiring manual attention.
    • Added validation for missing command-line option values.
  • Tests

    • Added coverage for updated Android security detection scenarios and lock recovery behavior.
    • Added a dedicated matcher test command.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Insaner1980, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c6cea8a4-9b0d-4660-b6e8-4fa9e05591d1

📥 Commits

Reviewing files that changed from the base of the PR and between ee2e6c6 and 5e57dda.

📒 Files selected for processing (5)
  • .deepsec/matchers/android-uri-share-without-clipdata.ts
  • .deepsec/matchers/security-matchers.test.ts
  • .deepsec/matchers/sensitive-android-log.ts
  • .deepsec/matchers/utils.ts
  • .deepsec/scripts/recover-processing-locks.test.mjs
📝 Walkthrough

Walkthrough

The change broadens Android and Health Connect security matcher detection, adds scoped parsing for URI shares and balanced Android log calls, introduces matcher tests and execution configuration, and refines processing-lock recovery plus CLI argument validation.

Changes

Security matcher updates

Layer / File(s) Summary
Matcher syntax coverage
.deepsec/matchers/android-exported-component.ts, .deepsec/matchers/fileprovider-broad-path.ts, .deepsec/matchers/foreground-audio-service-start.ts, .deepsec/matchers/health-connect-sensitive-flow.ts, .deepsec/matchers/security-matchers.test.ts
Matchers accept additional XML quoting, foreground-service call forms, and broader Health Connect indicators; tests cover these patterns.
Scoped share and log analysis
.deepsec/matchers/android-uri-share-without-clipdata.ts, .deepsec/matchers/sensitive-android-log.ts, .deepsec/matchers/security-matchers.test.ts
URI share detection evaluates each send scope, while log detection finds balanced calls and checks sensitive arguments; tests cover both behaviors.
Matcher test execution
.deepsec/package.json, .deepsec/.gitignore, .deepsec/pnpm-workspace.yaml
Adds the matcher test script, ignores temporary build output, and pins the workspace override for @hono/node-server.

Processing-lock recovery

Layer / File(s) Summary
Recovery result handling
.deepsec/scripts/recover-processing-locks.mjs, .deepsec/scripts/recover-processing-locks.test.mjs
Recoverable locks are excluded from remaining; dry-run recovery and deterministic remaining-lock assertions are tested.
CLI option validation
.deepsec/scripts/recover-processing-locks.mjs, .deepsec/scripts/recover-processing-locks.test.mjs
Required values for recovery CLI options are validated through a shared helper, with missing-value process failures tested.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: improving DeepSec security check coverage and matcher behavior.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/security-coderabbit-fixes

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

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

Copy link
Copy Markdown

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: ee2e6c6386

ℹ️ 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".

Comment on lines +40 to +41
const enclosingBlockEnd = findEnclosingBlockEnd(content, start);
const end = Math.min(nextShareStart, enclosingBlockEnd);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep scanning after nested intent construction blocks

When an ACTION_SEND intent is created inside an if, when, or run block and EXTRA_STREAM is added after that block, findEnclosingBlockEnd stops the scope at the inner closing brace. The scope therefore contains no EXTRA_STREAM, so the matcher emits nothing even if the subsequently configured share omits both URI grants and ClipData; use the owning function/statement scope or syntax-aware intent tracking instead.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
.deepsec/scripts/recover-processing-locks.test.mjs (1)

147-155: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover option-like values too.

This only exercises an absent next token; add a case such as --data-dir --dry-run to cover the value.startsWith("--") rejection branch.

Proposed test addition
     assert.notEqual(result.status, 0);
     assert.match(result.stderr, new RegExp(`Missing value for ${option}`));
+
+    const optionLikeValue = spawnSync(
+      process.execPath,
+      [scriptPath, option, "--dry-run"],
+      { encoding: "utf8" },
+    );
+    assert.notEqual(optionLikeValue.status, 0);
+    assert.match(optionLikeValue.stderr, new RegExp(`Missing value for ${option}`));
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.deepsec/scripts/recover-processing-locks.test.mjs around lines 147 - 155,
Add a test covering an option-like token supplied as the value for a required
option, such as invoking recover-processing-locks.mjs with --data-dir --dry-run.
Assert the command fails and reports the missing value, exercising the
value.startsWith("--") rejection branch alongside the existing absent-value
cases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.deepsec/matchers/android-uri-share-without-clipdata.ts:
- Around line 46-67: Update findEnclosingBlockEnd to resolve the block belonging
to the share builder opened after the Intent action, rather than defaulting to
the enclosing function’s end; preserve correct nesting and use the containing
expression end when appropriate. Add a regression covering an unsafe share
followed by an unrelated share with ClipData and a read grant, ensuring the
unrelated share cannot suppress the unsafe match.

In @.deepsec/matchers/security-matchers.test.ts:
- Around line 38-43: Update the regression test around writeNoiseDose(report) so
the subsequent statement contains a sensitive token such as “export” or “uri”,
making accidental consumption across the call boundary observable; keep the
assertion verifying that only the intended matches are returned.

In @.deepsec/matchers/sensitive-android-log.ts:
- Around line 34-54: Update the call-scanning loop around the quote/depth
tracking to recognize and skip both Kotlin line comments (`//` through the
newline) and block comments (`/*` through `*/`) before processing parentheses,
while preserving quote and escape handling. Add a regression case covering a `)`
inside each comment form and verify the sensitive Log call is still detected.

---

Nitpick comments:
In @.deepsec/scripts/recover-processing-locks.test.mjs:
- Around line 147-155: Add a test covering an option-like token supplied as the
value for a required option, such as invoking recover-processing-locks.mjs with
--data-dir --dry-run. Assert the command fails and reports the missing value,
exercising the value.startsWith("--") rejection branch alongside the existing
absent-value cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3279ab7d-0177-424a-81dd-aea1c4ab8a29

📥 Commits

Reviewing files that changed from the base of the PR and between 8bc5eea and ee2e6c6.

⛔ Files ignored due to path filters (1)
  • .deepsec/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (12)
  • .deepsec/.gitignore
  • .deepsec/matchers/android-exported-component.ts
  • .deepsec/matchers/android-uri-share-without-clipdata.ts
  • .deepsec/matchers/fileprovider-broad-path.ts
  • .deepsec/matchers/foreground-audio-service-start.ts
  • .deepsec/matchers/health-connect-sensitive-flow.ts
  • .deepsec/matchers/security-matchers.test.ts
  • .deepsec/matchers/sensitive-android-log.ts
  • .deepsec/package.json
  • .deepsec/pnpm-workspace.yaml
  • .deepsec/scripts/recover-processing-locks.mjs
  • .deepsec/scripts/recover-processing-locks.test.mjs

Comment thread .deepsec/matchers/android-uri-share-without-clipdata.ts Outdated
Comment thread .deepsec/matchers/security-matchers.test.ts
Comment thread .deepsec/matchers/sensitive-android-log.ts Outdated
@sonarqubecloud

Copy link
Copy Markdown

@Insaner1980
Insaner1980 merged commit 38b93c7 into main Jul 26, 2026
11 checks passed
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