Closed Bug 1507424 Opened 6 years ago Closed 4 years ago

Correctly handle empty arrays or objects in about:policies

Categories

(Firefox :: Enterprise Policies, defect, P3)

defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox-esr60 --- unaffected
firefox63 --- wontfix
firefox64 --- affected
firefox65 --- affected

People

(Reporter: emilghitta, Assigned: nagy.ferenc.jr, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [lang=js])

Attachments

(2 files)

Attached file policies.json
[Affected versions]:
Firefox 65.0a1 (BuildId:20181114100226)
Firefox 64.0b9 (BuildId:20181112164519)
Firefox 63.0.1 (BuildId:20181030165643)

[Unaffected versions]:
Firefox 60.3.0esr (BuildId:20181017185317)

[Affected platforms]:
Windows 10 64bit.
macOS 10.14.
Ubuntu 16.04 64bit.

[Preconditions]:
Place the attached .json file inside the "distribution" folder.

[Steps to reproduce]:
1. Launch Firefox.
2. Access the about:policies page.

[Expected result]:
The active policies have different colors for uneven and even displayed policies.

[Actual result]:
The same color is being displayed for all the listed policies inside the about:policies#active page.

[Regression range]:
I don't think this is a regression.
What happens is that some policies of type=object have several fields, but none are required. E.g, the Extensions policy is:

Extensions: {
  Install: [ .. array .. ],
  Uninstall: [ .. array .. ],
  Locked: boolean,
}

but none of these fields are actually required. So it's possible that an empty object is used, and that will (correctly) pass validation.

What happens is that this won't generate any entries in the about:policies Active policies list, but it will still mess with the even/odd counting of the policies that sets the background color of the rows.

What we should do is to generate a row for this policy anyway.


This will be a matter of fixing the generateActivePolicies function, in the array/object cases where count ends up being 0.
Mentor: felipc
Keywords: good-first-bug
Priority: -- → P3
Summary: Same color is displayed for multiple policies inside the about:policies page if an empty policy is present → Correctly handle empty arrays or objects in about:policies
Whiteboard: [lang=js]
Two separate questions:

- we need to figure out what steps lead to Emil having an empty object using the macOS configuration profile support to see if there's something proactive that we need to do to prevent that
- we could add support to the validator using minProperties/minItems to not accept this object as valid

Those are independent problems so I'll file separate bugs for them. This bug should be about just displaying this correctly in about:policies
> This bug should be about just displaying this correctly in about:policies

I've submitted a solution. I had to refactor the code a bit, because there were already existing code duplications and my fix would have introduced more, I hope it's OK.
Assignee: nobody → nagy.ferenc.jr
Status: NEW → ASSIGNED

Ferenc: are you going to finish this?

Flags: needinfo?(nagy.ferenc.jr)

So we no longer need to do this. The code ignores empty arrays in policy.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Flags: needinfo?(nagy.ferenc.jr)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: