-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: compare sha512 hashes of static resoruces to reference files (#343
- Loading branch information
1 parent
93003ff
commit e8d4fcf
Showing
2 changed files
with
74 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Static Resource Checking | ||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
|
||
jobs: | ||
static-resource-checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Fetch Sources | ||
uses: actions/checkout@v4 | ||
|
||
- name: Check Static Resources | ||
run: | | ||
declare -A resources | ||
# Add each resource as a key, value pair, mapping the local resource to the reference file (which should be stored in the lanaguage server repository). For example: | ||
# resources["<path_to_local_file>"]="<url_of_reference_file>" | ||
resources["Snyk.VisualStudio.Extension.2022/Resources/LoadingSummary.html"]="https://raw.githubusercontent.com/snyk/snyk-ls/refs/heads/main/shared_ide_resources/ui/html/ScanSummaryInit.html" | ||
for key in ${!resources[@]}; do | ||
candidate=$(sha512sum $key | awk {'print $1'}) | ||
candidate=${candidate:="null"} | ||
reference=$(curl -s ${resources[$key]} | sha512sum | awk {'print $1'}) | ||
echo "Candidate file $key has sha512sum $candidate" | ||
echo "Reference file ${resources[$key]} has sha512sum $reference" | ||
[[ $candidate == $reference ]] | ||
done | ||
139 changes: 46 additions & 93 deletions
139
Snyk.VisualStudio.Extension.2022/Resources/LoadingSummary.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,55 @@ | ||
<!DOCTYPE html> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv='Content-Type' content='text/html; charset=unicode' /> | ||
<meta http-equiv='X-UA-Compatible' content='IE=edge' /> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="Content-Security-Policy" | ||
content="style-src 'self' 'nonce-${nonce}' 'nonce-ideNonce' https://fonts.googleapis.com; | ||
<meta http-equiv='Content-Type' content='text/html; charset=unicode' /> | ||
<meta http-equiv='X-UA-Compatible' content='IE=edge' /> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta http-equiv="Content-Security-Policy" | ||
content="style-src 'self' 'nonce-${nonce}' 'nonce-ideNonce' https://fonts.googleapis.com; | ||
script-src 'nonce-${nonce}' https://fonts.googleapis.com; | ||
font-src 'self' https://fonts.gstatic.com;" /> | ||
<style> | ||
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap'); | ||
|
||
:root { | ||
font-size: var(--main-font-size); | ||
--default-font: "SF Pro Text", "Segoe UI", "Ubuntu", Geneva, Verdana, Tahoma, sans-serif; | ||
--ide-background-color: var(--vscode-sideBar-background); | ||
--text-color: var(--vscode-foreground); | ||
--input-border: var(--vscode-input-border); | ||
} | ||
|
||
p { | ||
font-size: 1.3rem; | ||
margin: .8rem 0; | ||
} | ||
|
||
hr { | ||
margin: 2rem 0; | ||
} | ||
|
||
body { | ||
background-color: var(--ide-background-color); | ||
color: var(--text-color); | ||
font-family: var(--default-font); | ||
} | ||
|
||
.snx-loader { | ||
display: inline-block; | ||
width: 12px; | ||
height: 12px; | ||
border: 2px solid rgba(125,125,125,.65); | ||
border-bottom-color: transparent; | ||
border-radius: 50%; | ||
margin-right: .8rem; | ||
animation: spin 1s linear infinite; | ||
} | ||
|
||
.size-s { | ||
width: 12px; | ||
height: 12px; | ||
border-width: 2px | ||
} | ||
|
||
@keyframes spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
|
||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
.snx-h1 { | ||
font-size: 2rem; | ||
font-weight: 600; | ||
margin: .8rem 0; | ||
} | ||
|
||
.snx-status { | ||
display: flex; | ||
align-items: center; | ||
padding: .4rem 1.2rem; | ||
background-color: rgba(255,255,255,.1); | ||
border-radius: 1rem; | ||
} | ||
|
||
.snx-header { | ||
display: flex; | ||
gap: 1.6rem; | ||
} | ||
|
||
.snx-message { | ||
display: flex; | ||
align-items: center | ||
} | ||
</style> | ||
<style nonce=${nonce}> | ||
@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap'); | ||
|
||
:root { | ||
font-size: var(--main-font-size); | ||
--default-font: "SF Pro Text", "Segoe UI", "Ubuntu", Geneva, Verdana, Tahoma, sans-serif; | ||
--ide-background-color: var(--vscode-sideBar-background); | ||
--text-color: var(--vscode-foreground); | ||
--input-border: var(--vscode-input-border); | ||
} | ||
p { font-size:1.3rem; margin: .8rem 0; } | ||
hr { margin: 2rem 0; } | ||
body { background-color:var(--ide-background-color); color: var(--text-color); font-family: var(--default-font); } | ||
.snx-loader { display:inline-block; width: 12px; height: 12px; border: 2px solid rgba(125,125,125,.65); border-bottom-color: transparent; border-radius: 50%; margin-right:.8rem; animation: spin 1s linear infinite; | ||
} | ||
.size-s { width: 12px; height: 12px; border-width:2px } | ||
|
||
@keyframes spin { | ||
from { transform: rotate(0deg); } | ||
to { transform: rotate(360deg); } | ||
} | ||
|
||
.snx-h1 { font-size: 2rem; font-weight: 600; margin: .8rem 0; } | ||
|
||
.snx-status { display:flex; align-items:center; padding: .4rem 1.2rem; background-color: rgba(255,255,255,.1); border-radius: 1rem; } | ||
|
||
.snx-header { display: flex; gap:1.6rem; } | ||
.snx-message { display: flex; align-items: center } | ||
</style> | ||
${ideStyle} | ||
</head> | ||
<body> | ||
|
||
<div class="snx-header"> | ||
<h1 class="snx-title snx-h1">Snyk Security is loading...</h1> | ||
</div> | ||
<div class="snx-summary"> | ||
<div class="snx-status"> | ||
<span class="snx-loader size-s"></span> | ||
<p class="snx-message">Waiting for the Snyk CLI to be downloaded and the Language Server to be initialized. </p> | ||
</div> | ||
<div class="snx-header"> | ||
<h1 class="snx-title snx-h1">Snyk Security is loading...</h1> | ||
</div> | ||
<div class="snx-summary"> | ||
<div class="snx-status"> | ||
<span class="snx-loader size-s"></span> | ||
<p class="snx-message">Waiting for the Snyk CLI to be downloaded and the Language Server to be initialized. </p> | ||
</div> | ||
</div> | ||
</body> | ||
</html> | ||
</html> |