Skip to content

Commit a262081

Browse files
committed
Fix codeql
1 parent 8bef99e commit a262081

3 files changed

Lines changed: 62 additions & 28 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- language: actions
4747
build-mode: none
4848
- language: java-kotlin
49-
build-mode: autobuild
49+
build-mode: manual
5050
- language: javascript-typescript
5151
build-mode: none
5252
- language: python
@@ -88,16 +88,19 @@ jobs:
8888
# to build your code.
8989
# ℹ️ Command-line programs to run using the OS shell.
9090
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
91+
- name: Set up JDK
92+
if: matrix.build-mode == 'manual'
93+
uses: actions/setup-java@v4
94+
with:
95+
java-version: '17'
96+
distribution: 'temurin'
97+
9198
- name: Run manual build steps
9299
if: matrix.build-mode == 'manual'
93100
shell: bash
94101
run: |
95-
echo 'If you are using a "manual" build mode for one or more of the' \
96-
'languages you are analyzing, replace this with the commands to build' \
97-
'your code, for example:'
98-
echo ' make bootstrap'
99-
echo ' make release'
100-
exit 1
102+
chmod +x gradlew
103+
./gradlew :app:compileGithubDebugKotlin :lib:compileDebugKotlin --no-daemon
101104
102105
- name: Perform CodeQL Analysis
103106
uses: github/codeql-action/analyze@v4

.github/workflows/generate-apk-release.yml

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ jobs:
8282
outputs:
8383
default_report: ${{ steps.scan.outputs.default_report }}
8484
armv7_report: ${{ steps.scan.outputs.armv7_report }}
85+
default_status: ${{ steps.scan.outputs.default_status }}
86+
armv7_status: ${{ steps.scan.outputs.armv7_status }}
8587
steps:
8688
- name: Download APKs
8789
uses: actions/download-artifact@v4
@@ -94,6 +96,8 @@ jobs:
9496
VT_API_KEY: ${{ secrets.VIRUSTOTAL_API_KEY }}
9597
VERSION: ${{ needs.build.outputs.version_name }}
9698
run: |
99+
RESULT_URL=""
100+
RESULT_STATUS=""
97101
upload_and_poll() {
98102
local file="$1"
99103
local sha256
@@ -107,7 +111,8 @@ jobs:
107111
--url https://www.virustotal.com/api/v3/files/upload_url \
108112
--header "x-apikey: $VT_API_KEY" | jq -r '.data')
109113
if [ -z "$upload_url" ] || [ "$upload_url" = "null" ]; then
110-
echo "https://www.virustotal.com/gui/file/$sha256/detection"
114+
RESULT_URL="https://www.virustotal.com/gui/file/$sha256/detection"
115+
RESULT_STATUS="⬜ N/A"
111116
return
112117
fi
113118
fi
@@ -117,23 +122,46 @@ jobs:
117122
--header "x-apikey: $VT_API_KEY" \
118123
--form "file=@$file" | jq -r '.data.id')
119124
if [ -z "$analysis_id" ] || [ "$analysis_id" = "null" ]; then
120-
echo "https://www.virustotal.com/gui/file/$sha256/detection"
125+
RESULT_URL="https://www.virustotal.com/gui/file/$sha256/detection"
126+
RESULT_STATUS="⬜ N/A"
121127
return
122128
fi
129+
local last_response=""
123130
for i in $(seq 1 30); do
124131
sleep 20
125-
local status
126-
status=$(curl -sS \
132+
last_response=$(curl -sS \
127133
--url "https://www.virustotal.com/api/v3/analyses/$analysis_id" \
128-
--header "x-apikey: $VT_API_KEY" | jq -r '.data.attributes.status')
129-
[ "$status" = "completed" ] && break
134+
--header "x-apikey: $VT_API_KEY")
135+
local poll_status
136+
poll_status=$(echo "$last_response" | jq -r '.data.attributes.status')
137+
[ "$poll_status" = "completed" ] && break
130138
done
131-
echo "https://www.virustotal.com/gui/file/$sha256/detection"
139+
local malicious suspicious undetected harmless total detected
140+
malicious=$(echo "$last_response" | jq -r '.data.attributes.stats.malicious // 0')
141+
suspicious=$(echo "$last_response" | jq -r '.data.attributes.stats.suspicious // 0')
142+
undetected=$(echo "$last_response" | jq -r '.data.attributes.stats.undetected // 0')
143+
harmless=$(echo "$last_response" | jq -r '.data.attributes.stats.harmless // 0')
144+
total=$((malicious + suspicious + undetected + harmless))
145+
detected=$((malicious + suspicious))
146+
if [ "$detected" -eq 0 ]; then
147+
RESULT_STATUS="✅ ${detected}/${total} Clean"
148+
else
149+
RESULT_STATUS="⚠️ ${detected}/${total} Detected"
150+
fi
151+
RESULT_URL="https://www.virustotal.com/gui/file/$sha256/detection"
132152
}
133-
DEFAULT_REPORT=$(upload_and_poll "PlainApp-${VERSION}-default.apk")
134-
ARMV7_REPORT=$(upload_and_poll "PlainApp-${VERSION}-armeabi-v7a.apk")
135-
echo "default_report=$DEFAULT_REPORT" >> $GITHUB_OUTPUT
136-
echo "armv7_report=$ARMV7_REPORT" >> $GITHUB_OUTPUT
153+
upload_and_poll "PlainApp-${VERSION}-default.apk"
154+
DEFAULT_REPORT="$RESULT_URL"
155+
DEFAULT_STATUS="$RESULT_STATUS"
156+
upload_and_poll "PlainApp-${VERSION}-armeabi-v7a.apk"
157+
ARMV7_REPORT="$RESULT_URL"
158+
ARMV7_STATUS="$RESULT_STATUS"
159+
{
160+
echo "default_report=$DEFAULT_REPORT"
161+
echo "armv7_report=$ARMV7_REPORT"
162+
echo "default_status=$DEFAULT_STATUS"
163+
echo "armv7_status=$ARMV7_STATUS"
164+
} >> $GITHUB_OUTPUT
137165
138166
release:
139167
needs: [build, provenance, virustotal]
@@ -162,10 +190,10 @@ jobs:
162190
## Security
163191
164192
### VirusTotal Scan
165-
| APK | Scan Report |
166-
|-----|-------------|
167-
| `PlainApp-${{ needs.build.outputs.version_name }}-default.apk` | [View Report](${{ needs.virustotal.outputs.default_report }}) |
168-
| `PlainApp-${{ needs.build.outputs.version_name }}-armeabi-v7a.apk` | [View Report](${{ needs.virustotal.outputs.armv7_report }}) |
193+
| APK | Status | Scan Report |
194+
|-----|--------|-------------|
195+
| `PlainApp-${{ needs.build.outputs.version_name }}-default.apk` | ${{ needs.virustotal.outputs.default_status }} | [View Report](${{ needs.virustotal.outputs.default_report }}) |
196+
| `PlainApp-${{ needs.build.outputs.version_name }}-armeabi-v7a.apk` | ${{ needs.virustotal.outputs.armv7_status }} | [View Report](${{ needs.virustotal.outputs.armv7_report }}) |
169197
170198
### SLSA Provenance (Level 3)
171199
The `.intoto.jsonl` file attached to this release is a signed SLSA provenance document.

app/src/main/java/com/ismartcoding/plain/ui/components/mediaviewer/previewer/MediaPreviewer.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import androidx.compose.ui.text.style.TextAlign
3333
import androidx.compose.ui.unit.dp
3434
import androidx.compose.ui.unit.sp
3535
import androidx.activity.ComponentActivity
36+
import androidx.compose.foundation.layout.fillMaxWidth
3637
import androidx.lifecycle.viewmodel.compose.viewModel
3738
import com.ismartcoding.plain.R
3839
import com.ismartcoding.plain.db.DTag
@@ -111,12 +112,14 @@ fun MediaPreviewer(
111112
@Composable
112113
private fun SpeedBoostIndicator(state: MediaPreviewerState) {
113114
AnimatedVisibility(visible = state.videoState.isSpeedBoostActive,
114-
modifier = Modifier.statusBarsPadding().padding(top = 16.dp), enter = fadeIn(tween(150)), exit = fadeOut(tween(150))) {
115-
Row(modifier = Modifier.background(color = Color.Black.copy(alpha = 0.6f),
116-
shape = androidx.compose.foundation.shape.RoundedCornerShape(20.dp)).padding(horizontal = 16.dp, vertical = 6.dp),
117-
verticalAlignment = Alignment.CenterVertically) {
118-
Icon(painter = painterResource(R.drawable.double_arrow_right), contentDescription = null, tint = Color.White, modifier = Modifier.size(20.dp))
119-
Text(text = " 2x", color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center)
115+
modifier = Modifier.fillMaxWidth().statusBarsPadding().padding(top = 16.dp), enter = fadeIn(tween(150)), exit = fadeOut(tween(150))) {
116+
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
117+
Row(modifier = Modifier.background(color = Color.Black.copy(alpha = 0.6f),
118+
shape = androidx.compose.foundation.shape.RoundedCornerShape(20.dp)).padding(horizontal = 16.dp, vertical = 6.dp),
119+
verticalAlignment = Alignment.CenterVertically) {
120+
Icon(painter = painterResource(R.drawable.double_arrow_right), contentDescription = null, tint = Color.White, modifier = Modifier.size(20.dp))
121+
Text(text = " 2x", color = Color.White, fontSize = 16.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center)
122+
}
120123
}
121124
}
122125
}

0 commit comments

Comments
 (0)