
Research
/Security News
10 npm Typosquatted Packages Deploy Multi-Stage Credential Harvester
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.
@hmcts/media-viewer
Advanced tools
This is an angular library that can be used to view and annotate PDF documents and images
add @hmcts/media-viewer as a dependency in package.json
npm install --save @hmcts/media-viewer
import MediaViewerModule and declare it in your NgModule imports together with NGRX store if you don't have it already .
import { MediaViewerModule } from 'media-viewer';
@NgModule({
imports: [
...,
MediaViewerModule,
StoreModule.forRoot({}, {}),
EffectsModule.forRoot([]),
]
})
import assets to your angular.json
{
"glob": "**/*",
"input": "node_modules/@hmcts/media-viewer/assets",
"output": "/assets"
}
component entry point:
<mv-media-viewer [url]="'assets/example.pdf'"
[downloadFileName]="'example.pdf'"
[showToolbar]="true"
[contentType]="'pdf'">
</mv-media-viewer>
Add these styles to your component.scss if you need them. If you're writing your own toolbar styles then do not import those
// Import GOV.UK Frontend
@import "~govuk-frontend/govuk/all";
// Import Media Viewer Styles
@import "~media-viewer/src/assets/all"; // use this to import all the styles
Alternatively, it is possible to import file by file as required from assets/sass directory
eg. ~media-viewer/assets/sass/toolbar/main
The toolbar may be toggled off by setting showToolbar to false. The toolbar itself is available as a module that can be included into the DOM at a different location if necessary.
Toolbar buttons can be toggled on or off using the 'toolbarButtonOverrides' input. Each button can toggled on or off as follows:
toolbarButtons = { showRotate: true, showDownload: false }
<mv-media-viewer ...
[toolbarButtonOverrides]="toolbarButtons">
</mv-media-viewer>
The full list of buttons is as follows:
showPrint
showDownload
showNavigation
showZoom
showRotate
showHighlightButton
showDrawButton
showSearchBar
showSidebar
You can set height and width of the media viewer otherwise it will be set to default settings of 100%.
<mv-media-viewer ...
[height]="'500px'"
[width]="'500px'">
</mv-media-viewer>
To override the default Annotation API path (or URL for cross domain calls) use "annotationApiUrl" parameter
<mv-media-viewer annotationApiUrl=""http://my-gateway.com/my-context-path"" ... >
</mv-media-viewer>
In order to use annotations/redactions on the media viewer, you need to proxy backend calls.
Example:
import * as proxy from "http-proxy-middleware";
Annotation Config:
const annotation = {
endpoints: ["/em-anno"],
target: "Enter URL",
pathRewrite: {
"^/em-anno": "/api"
}
}
How to use the proxy:
this.app.use(proxy(annotation.endpoints, { target: annotation.target }));
The Media Viewer will return load status and provide exceptions if thrown for the host application to consume. It is up to the consuming application whether or not to notify the user of those exceptions, as the Media-Viewer will not
<mv-media-viewer [url]="'assets/example.pdf'"
[downloadFileName]="'example.pdf'"
[showToolbar]="true"
[contentType]="'pdf'"
[enableAnnotations]="true"
[enableRedactions]="true"
(mediaLoadStatus)="onMediaLoadStatus($event)"
(viewerException)="onMediaLoadException($event)">
</mv-media-viewer>
When exceptions are thrown by the different Media Viewers, the exception is encapsulated in an object called ViewerException and passed up the chain to be used by consuming service.
The structure of the ViewerException exception class can be seen below:
exceptionType: error.name,
detail: {
httpResponseCode: error.status,
message: error.message
}
The list of exceptions thrown by the Media Viewer are as follows:
npm run package, npm run e2e:cucumber
FAQs
Media Viewer
The npm package @hmcts/media-viewer receives a total of 1,273 weekly downloads. As such, @hmcts/media-viewer popularity was classified as popular.
We found that @hmcts/media-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.