Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't run CodeQL if only minimized JavaScript was changed and fix some issues #6214

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
push:
pull_request:
branches: [ master ]
paths-ignore:
- '**/*_min.js'
Copy link
Collaborator

@henning-gerhardt henning-gerhardt Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will hide any file ending of "_min.js" which must not be necessary a minimized JavaScript version of a bigger JavaScript file. Other minimized JavaScript files (f.e Kitodo/src/main/webapp/js/jquery-2.1.1.min.js or Kitodo/src/main/webapp/WEB-INF/resources/js/libs/wavesurfer/wavesurfer.esm.js) which have a other name schema for minimization will be checked still. If I would to ignore a file I would name it directly and not use a global big match pattern. But this is only my opinion and can be ignored if they did not right.

Copy link
Member Author

@stweil stweil Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think jquery-2.1.1.min.js should be removed because it is a ten years old security risk. Maybe Kitodo can use the JQuery package which is part of Debian / Ubuntu (libjs-jquery 3.6.1 in Debian stable) if this is required.


# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private static class ContextDescriptor {

private final String fileName;

@Override
public boolean equals(Object potentialContextDescriptor) {
if (potentialContextDescriptor instanceof ContextDescriptor) {
final ContextDescriptor contextDescriptor = ((ContextDescriptor) potentialContextDescriptor);
Expand All @@ -127,6 +128,7 @@ public boolean equals(Object potentialContextDescriptor) {
return false;
}

@Override
public int hashCode() {
return (clazz + fileName).hashCode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class MetsKitodoObjectFactory extends ObjectFactory {
*
* @return The KitodoType object.
*/
@Override
public KitodoType createKitodoType() {
KitodoType kitodoType = super.createKitodoType();
kitodoType.setVersion(VersionProvider.getDataFormatVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ public void setWorkpieces(List<Process> workpieces) {
* object
* @return int
*/
@Override
public int compareTo(Property property) {
int titleMatch = this.getTitle().toLowerCase().compareTo(property.getTitle().toLowerCase());
int valueMatch = this.getValue().toLowerCase().compareTo(property.getValue().toLowerCase());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ private void initiateClientWithAuth(String host, Integer port, String protocol,
*
* @return information about the server
*/
@Override
public String getServerInformation() throws IOException {
Request request = new Request(HttpMethod.GET, "/");
request.addParameter("pretty", "true");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ private String getDecodedPath(URI uri) {
return decodedPath;
}

@Override
public File getFile(URI uri) {
uri = fileMapper.mapUriToKitodoDataDirectoryUri(uri);
return new File(uri);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ public void setSelectedProcessesOrProcessDTOs(List<? extends Object> selectedPro
* Update selection and first row to show in datatable on PageEvent.
* @param pageEvent PageEvent triggered by data tables paginator
*/
@Override
public void onPageChange(PageEvent pageEvent) {
this.setFirstRow(((DataTable) pageEvent.getSource()).getFirst());
if (allSelected) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ public String getReferringView() {
* @param treeNode treeNode to be added
* @return whether the given ProcessDetail can be added or not
*/
@Override
public boolean canBeAdded(TreeNode treeNode) throws InvalidMetadataValueException {
if (Objects.isNull(treeNode.getParent().getParent())) {
if (Objects.nonNull(currentProcess.getProcessMetadata().getSelectedMetadataTreeNode())
Expand Down Expand Up @@ -746,6 +747,7 @@ public boolean canBeDeleted(ProcessDetail processDetail) {
* @param metadataNode TreeNode for which the check is performed
* @return whether given TreeNode contains ProcessFieldedMetadata and if any further metadata can be added to it
*/
@Override
public boolean metadataAddableToGroup(TreeNode metadataNode) {
if (metadataNode.getData() instanceof ProcessFieldedMetadata) {
return !(DataEditorService.getAddableMetadataForGroup(getMainProcess().getRuleset(), metadataNode).isEmpty());
Expand All @@ -757,6 +759,7 @@ public boolean metadataAddableToGroup(TreeNode metadataNode) {
* Prepare addable metadata for metadata group.
* @param treeNode metadataGroup treeNode
*/
@Override
public void prepareAddableMetadataForGroup(TreeNode treeNode) {
addMetadataDialog.prepareAddableMetadataForGroup(getMainProcess().getRuleset(), treeNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ void markLeadingMetadataFields(List<Map<MetadataEntry, Boolean>> leadingMetadata
* there is no setter corresponding to the name configured in
* the rule set
*/
@Override
public void preserve() throws InvalidMetadataValueException, NoSuchMetadataFieldException {
try {
if (Objects.nonNull(division)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public boolean isUndefined() {
return Objects.isNull(settings) || settings.isUndefined();
}

@Override
public boolean isRequired() {
ComplexMetadataViewInterface containerSettings = container.getMetadataView();
if (!(containerSettings instanceof StructuralElementViewInterface) && container.getChildMetadata().isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public String getInput() {
* @param skipEmpty boolean
* @return the metadata from this row
*/
@Override
public Collection<Metadata> getMetadata(boolean skipEmpty) {
value = value.trim();
if (skipEmpty && value.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@ public String getReferringView() {
* @param treeNode treeNode to be added
* @return whether the given ProcessDetail can be added or not
*/
@Override
public boolean canBeAdded(TreeNode treeNode) {
if (Objects.isNull(treeNode.getParent().getParent())) {
if (Objects.nonNull(metadataPanel.getSelectedMetadataTreeNode()) || Objects.isNull(addMetadataDialog.getAddableMetadata())) {
Expand Down Expand Up @@ -1116,13 +1117,15 @@ public void preserveMetadataPanel() {
*
* @return whether given TreeNode contains ProcessFieldedMetadata and if any further metadata can be added to it
*/
@Override
public boolean metadataAddableToGroup(TreeNode metadataNode) {
return metadataPanel.metadataAddableToGroup(metadataNode);
}

/**
* Prepare addable metadata for metadata group.
*/
@Override
public void prepareAddableMetadataForGroup(TreeNode treeNode) {
addMetadataDialog.prepareAddableMetadataForGroup(treeNode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class AddDataScript extends EditDataScript {
* @param process the related process
* @param metadataScript the script to execute
*/
@Override
public void executeScript(LegacyMetsModsDigitalDocumentHelper metadataFile, Process process,
MetadataScript metadataScript) throws KitodoScriptExecutionException {
Workpiece workpiece = metadataFile.getWorkpiece();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class DeleteDataScript extends EditDataScript {
* @param process the related process
* @param metadataScript the script to execute
*/
@Override
public void executeScript(LegacyMetsModsDigitalDocumentHelper metadataFile, Process process,
MetadataScript metadataScript) throws KitodoScriptExecutionException {
Workpiece workpiece = metadataFile.getWorkpiece();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ private int getNumberOfDatabaseObjects(ObjectType objectType) throws DAOExceptio
private ExecutorService createDeamonizedExecutorService(int threads) {
return Executors.newFixedThreadPool(threads,
new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public ProjectsPage() {
*
* @return The projects page.
*/
@Override
public ProjectsPage goTo() throws Exception {
Pages.getTopNavigation().gotoProjects();
await("Wait for execution of link click").pollDelay(Browser.getDelayMinAfterLinkClick(), TimeUnit.MILLISECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public UsersPage() {
*
* @return The users page.
*/
@Override
public UsersPage goTo() throws Exception {
Pages.getTopNavigation().gotoUsers();
await("Wait for execution of link click").pollDelay(Browser.getDelayMinAfterLinkClick(), TimeUnit.MILLISECONDS)
Expand Down