Skip to content

Markings#3469

Draft
jalphonso wants to merge 44 commits intointegrationfrom
accumulo-access
Draft

Markings#3469
jalphonso wants to merge 44 commits intointegrationfrom
accumulo-access

Conversation

@jalphonso
Copy link
Copy Markdown
Collaborator

No description provided.

@jalphonso jalphonso self-assigned this Mar 23, 2026
@jalphonso jalphonso marked this pull request as draft March 23, 2026 17:25
@jalphonso jalphonso force-pushed the accumulo-access branch 8 times, most recently from e86e7ba to 0e0b4d2 Compare March 26, 2026 01:35
@jalphonso jalphonso force-pushed the accumulo-access branch 3 times, most recently from 07765cd to 65db1ad Compare March 27, 2026 17:27
@jalphonso jalphonso force-pushed the accumulo-access branch 5 times, most recently from 8bc250c to 98f8567 Compare April 2, 2026 17:24
@jalphonso jalphonso force-pushed the accumulo-access branch 2 times, most recently from cceab28 to e72fd54 Compare April 7, 2026 17:48
Comment on lines +158 to +161
@SuppressWarnings({"unchecked", "rawtypes"})
public static Markings<?> combine(MarkingFunctions<?> markingFunctions, Collection<? extends Markings<?>> markings) throws MarkingFunctions.Exception {
return ((MarkingFunctions) markingFunctions).combine(markings);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we can be a little more specific with generics here:

Suggested change
@SuppressWarnings({"unchecked", "rawtypes"})
public static Markings<?> combine(MarkingFunctions<?> markingFunctions, Collection<? extends Markings<?>> markings) throws MarkingFunctions.Exception {
return ((MarkingFunctions) markingFunctions).combine(markings);
}
public static <T extends Markings<?>, U extends MarkingFunctions<T>> T combine(U markingFunctions, Collection<T> markings) throws MarkingFunctions.Exception {
return markingFunctions.combine(markings);
}

Copy link
Copy Markdown
Collaborator Author

@jalphonso jalphonso May 7, 2026

Choose a reason for hiding this comment

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

lets see if we can address this down the road on another MR

Comment on lines +178 to +181
if (markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) {
AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1;
AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2;
return combine(markingFunctions, List.of(aem1, aem2));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If the above generic suggestion works, i think you'll need to modify this slightly:

Suggested change
if (markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) {
AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1;
AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2;
return combine(markingFunctions, List.of(aem1, aem2));
if (markingFunctions instanceof MarkingFunctions.Default && markings1 instanceof AccessExpressionMarkings && markings2 instanceof AccessExpressionMarkings) {
MarkingFunctions<AccessExpressionMarkings> defaultMarkingFunctions = (MarkingFunctions.Default) markingFunctions;
AccessExpressionMarkings aem1 = (AccessExpressionMarkings) markings1;
AccessExpressionMarkings aem2 = (AccessExpressionMarkings) markings2;
return combine(defaultMarkingFunctions, List.of(aem1, aem2));

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

lets see if we can address this down the road on another MR

import com.fasterxml.jackson.annotation.JsonTypeInfo;

@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
public interface Markings<T> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we restrict T here at all?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

lets see if we can address this down the road on another MR

Comment on lines 5 to 10
public interface HasMarkings {

void setMarkings(Map<String,String> markings);
void setMarkings(Markings<?> markings);

Map<String,String> getMarkings();
Markings<?> getMarkings();
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm guessing there's some issue you'll eventually run into, but here's a naive suggestion (which will require a lot of associated changes, some of which may be impossible):

public interface HasMarkings <T> {

    void setMarkings(Markings<T> markings);

    Markings<T> getMarkings();
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

lets see if we can address this down the road on another MR

Comment on lines -173 to -255
public void inheritFromRootPayload(RawRecordContainer event, Map<String,Collection<Object>> metadata) {
// TODO: No-op here, but need to refactor the following in upstream
// if (metadata == null)
// return;
//
// IBaseDataObject payload = (IBaseDataObject) event.getAuxData();
// if (payload != null) {
// for (String field : helper.getInheritedPayloadFields()) {
// if (metadata.containsKey(field) && (!payload.hasParameter(field))) {
// payload.putParameter(field, metadata.get(field));
// }
// }
// }
}

public void addMetadataFromParms(RawRecordContainer event, Map<String,Collection<Object>> metadata, String id) {

for (Map.Entry<String,Collection<Object>> entry : metadata.entrySet()) {
CharSequence key = entry.getKey();
for (Object value : entry.getValue()) {
if (value == null)
continue;

if (helper.getUuids().contains(key)) {
event.getAltIds().add(String.valueOf(value));
}
if (this.helper.getSecurityMarkingFieldDomainMap().containsKey(key)) {
addSecurityMetadataFromParms(key, value, event);
}
}
}

Multimap<String,String> newMetadata = HashMultimap.create();
Multimap<String,MetadataIdParser> fieldParsers = helper.getMetadataFieldParsers();
for (String field : fieldParsers.keySet()) {
if (metadata.containsKey(field) && metadata.get(field) != null) {
for (MetadataIdParser parser : fieldParsers.get(field)) {
for (Object v : metadata.get(field)) {
if (v == null)
continue;
try {
parser.addMetadata(event, newMetadata, v.toString());
} catch (Exception e) {
log.error("Unable to apply " + parser + " to " + field, e);
event.addError(RawDataErrorNames.FIELD_EXTRACTION_ERROR);
}
}
}
}
}

// If the ID is a UUID (i.e., contains no date), try to get
// event metadata from the parameters
if ((id != null) && (id.length() >= UUID_LENGTH) && id.matches(UUID_PATTERN)) {
fieldParsers = helper.getMetadataFieldUuidParsers();
for (String field : fieldParsers.keySet()) {
if (metadata.containsKey(field) && metadata.get(field) != null) {
for (MetadataIdParser parser : fieldParsers.get(field)) {
for (Object v : metadata.get(field)) {
if (v == null)
continue;
try {
parser.addMetadata(event, newMetadata, v.toString());
} catch (Exception e) {
log.error("Unable to apply " + parser + " to " + field, e);
event.addError(RawDataErrorNames.FIELD_EXTRACTION_ERROR);
}
}
}
}
}
}
}

protected void addSecurityMetadataFromParms(CharSequence key, Object value, RawRecordContainer event) {
// If fieldName is a security marking field (as configured by EVENT_SECURITY_MARKING_FIELD_NAMES),
// then put the marking value into this.securityMarkings, where 'key' maps to the domain for the marking
// (as configured by EVENT_SECURITY_MARKING_FIELD_DOMAINS)
if (!StringUtils.isEmpty(key.toString()) && !StringUtils.isEmpty(value.toString())) {
event.addSecurityMarking(this.helper.getSecurityMarkingFieldDomainMap().get(key.toString()), value.toString());
}
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is used anywhere but please doublecheck. There are other references to EVENT_SECURITY_MARKING_FIELD_NAMES and EVENT_SECURITY_MARKING_FIELD_DOMAINS that can be cleaned up once confirmed

@Override
public void setMarkings(Markings<?> markings) {
this.markings = markings;
this.setSecurityMarkings(markings.get("security"));
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

what is the key "security" used for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants