fix(security): fail closed on missing conversion-job authority - #348
fix(security): fail closed on missing conversion-job authority#348seonghobae wants to merge 9 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthrough
Changes권한 메타데이터 검증
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
|
@opencode-agent review Review exact head Review read-only; preserve independent reviewer identity. Do not mutate the branch, synthesize author approval, weaken protection, or merge. |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
requested_head='b38f1207d2ed03f72250e3a1eae046a83b5bb0ff'
repo='ContextualWisdomLab/clearfolio'
pr='348'
echo '== Local commit identity =='
git rev-parse HEAD
git status --short
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$requested_head"
if [ "$(git rev-parse HEAD)" = "$requested_head" ]; then
echo 'HEAD_MATCHES_REQUESTED=true'
else
echo 'HEAD_MATCHES_REQUESTED=false'
fi
echo '== Pull request metadata and changed files =='
gh pr view "$pr" --repo "$repo" --json number,state,isDraft,headRefOid,baseRefOid,url \
--jq '{number,state,isDraft,headRefOid,baseRefOid,url}'
gh pr diff "$pr" --repo "$repo" --name-only
echo '== Exact-head diff =='
base="$(gh pr view "$pr" --repo "$repo" --json baseRefOid --jq .baseRefOid)"
git diff --find-renames --find-copies "$base" "$requested_head" -- \
src/main/java/com/clearfolio/viewer/model/ConversionJob.java \
src/test/java/com/clearfolio/viewer/model/ConversionJobTenantAuthorityTest.java \
src/test/java/com/clearfolio/viewer/model/ConversionJobTest.java
echo '== ConversionJob structure =='
ast-grep outline src/main/java/com/clearfolio/viewer/model/ConversionJob.java --items all --view expanded
ast-grep outline src/test/java/com/clearfolio/viewer/model/ConversionJobTenantAuthorityTest.java --items all --view expanded
ast-grep outline src/test/java/com/clearfolio/viewer/model/ConversionJobTest.java --items all --view expanded
echo '== Constructor call sites and demo identifiers =='
rg -n -C 3 --glob '*.java' 'new\s+ConversionJob\s*\(' src
rg -n -C 3 --glob '*.java' '(buyer-demo|requireAuthority|tenantId|subjectId)' \
src/main/java/com/clearfolio/viewer/model/ConversionJob.java \
src/test/java/com/clearfolio/viewer/model/ConversionJobTenantAuthorityTest.java \
src/test/java/com/clearfolio/viewer/model/ConversionJobTest.java
echo '== Exact-head check runs =='
gh api "repos/$repo/commits/$requested_head/check-runs?per_page=100" \
--jq '.check_runs[] | [.name,.status,.conclusion,.details_url] | `@tsv`'
echo '== Pull request reviews and review threads =='
gh pr view "$pr" --repo "$repo" --json reviews \
--jq '.reviews[] | [.author.login,.state,.commit.oid,.submittedAt] | `@tsv`'
gh api graphql -F owner='ContextualWisdomLab' -F name='clearfolio' -F number="$pr" -f query='
query($owner: String!, $name: String!, $number: Int!) {
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
reviewThreads(first: 100) {
nodes {
isResolved
isOutdated
comments(first: 20) {
nodes { author { login } body path line originalLine commit { oid } }
}
}
}
}
}
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] |
select(.isResolved == false) |
{isOutdated, comments: [.comments.nodes[] | {author: .author.login, path, line, originalLine, oid: .commit.oid, body}]}'Length of output: 113155 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo '== ConversionJob constructors and authority helpers =='
sed -n '1,155p' src/main/java/com/clearfolio/viewer/model/ConversionJob.java
echo '== Tenant comparison behavior =='
sed -n '176,190p' src/main/java/com/clearfolio/viewer/model/ConversionJob.java
echo '== Production construction path =='
sed -n '150,215p' src/main/java/com/clearfolio/viewer/service/DefaultDocumentConversionService.java
echo '== Production explicit constructor calls =='
ast-grep run \
--pattern $'new ConversionJob($JOB_ID, $TENANT_ID, $SUBJECT_ID, $FILE_NAME, $CONTENT_TYPE, $HASH, $SIZE, $MAX_ATTEMPTS)' \
--lang java src/main/java
echo '== Legacy/demo constructor and explicit constructor declarations =='
ast-grep run \
--pattern $'public ConversionJob($$$PARAMS) { $$$BODY }' \
--lang java src/main/java/com/clearfolio/viewer/model/ConversionJob.java
echo '== Authority fallback references in production code =='
rg -n -C 2 --glob '*.java' '(DEFAULT_TENANT_ID|DEFAULT_SUBJECT_ID|buyer-demo|normalizeOrDefault\s*\()' src/main/javaLength of output: 17370
No actionable findings.
This was a read-only review. I did not mutate the branch, approve, or merge.
|
Pull request was converted to draft
Objective
Make the explicit tenant-aware
ConversionJobconstructor fail closed rather than silently replacing absent authority with buyer-demo identities.Exact current-head evidence
eb0a32e87e7470469c8fa0f8c67d9583654bef57;b38f1207d2ed03f72250e3a1eae046a83b5bb0ff;ConversionJob.javaand focused authority regressions only;Authority contract
The constructor whose signature receives tenant and subject authority rejects null, blank, NUL/control-only, and unusable values with controlled errors. Valid values are normalized once. Explicit legacy/demo convenience constructors remain separate compatibility surfaces.
Scope boundary
Conversion-job authority model only. This does not change viewer UI, repositories, lifecycle state, credentials, OIDC, Office conversion, or the legacy demo constructors.
Merge gate
Keep this exact head unchanged. Auto-merge may act only after live required checks remain terminal-success, zero valid unresolved findings remain, and a qualifying independent non-author approval is attached to this exact head.