File tree Expand file tree Collapse file tree 3 files changed +20
-6
lines changed
Expand file tree Collapse file tree 3 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 3535 npm run test clean build package
3636
3737 - name : Upload artifacts
38- uses : actions/upload-artifact@v4
38+ uses : actions/upload-artifact@v5
3939 with :
4040 name : web-eid-webextension-${{github.run_number}}
4141 path : dist/
Original file line number Diff line number Diff line change @@ -22,13 +22,13 @@ jobs:
2222 uses : actions/checkout@v5
2323
2424 - name : Initialize CodeQL
25- uses : github/codeql-action/init@v3
25+ uses : github/codeql-action/init@v4
2626 with :
2727 languages : javascript
2828 queries : +security-and-quality
2929
3030 - name : Autobuild
31- uses : github/codeql-action/autobuild@v3
31+ uses : github/codeql-action/autobuild@v4
3232
3333 - name : Perform CodeQL Analysis
34- uses : github/codeql-action/analyze@v3
34+ uses : github/codeql-action/analyze@v4
Original file line number Diff line number Diff line change @@ -35,11 +35,25 @@ export default function injectPageScript(): void {
3535 * https://github.com/open-eid/chrome-token-signing/blob/master/extension/page.js
3636 */
3737 if ( ! document . querySelector ( "script[data-name='TokenSigning']" ) ) {
38+ // Inject if the document is HTML, or if the doctype is missing/unknown.
39+ const doctypeName = document . doctype ? String ( document . doctype . name ) . trim ( ) . toLowerCase ( ) : "" ;
40+ const docElName = document . documentElement ? String ( document . documentElement . nodeName ) . trim ( ) . toLowerCase ( ) : "" ;
41+ const isHtml = doctypeName === "html" || docElName === "html" ;
42+ const isUnknownDoctype = ! document . doctype || doctypeName === "" ;
43+ if ( ! isHtml && ! isUnknownDoctype ) {
44+ // Do not inject the script if the document is explicitly non-HTML (e.g. XML)
45+ return ;
46+ }
3847 const s = document . createElement ( "script" ) ;
3948
4049 s . type = "text/javascript" ;
41- s . dataset . name = "TokenSigning" ;
42- s . dataset . by = "Web-eID extension" ;
50+ if ( s . dataset ) {
51+ s . dataset . name = "TokenSigning" ;
52+ s . dataset . by = "Web-eID extension" ;
53+ } else {
54+ s . setAttribute ( "data-name" , "TokenSigning" ) ;
55+ s . setAttribute ( "data-by" , "Web-eID extension" ) ;
56+ }
4357
4458 if ( browser . runtime . getManifest ( ) [ "manifest_version" ] >= 3 ) {
4559 s . src = browser . runtime . getURL ( "token-signing-page-script.js" ) ;
You can’t perform that action at this time.
0 commit comments